-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataInputStreamReader.java
More file actions
70 lines (66 loc) · 2.22 KB
/
DataInputStreamReader.java
File metadata and controls
70 lines (66 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package Graph;
import java.io.*;
public class DataInputStreamReader {
public static void main(String[] args) throws IOException {
InputStream is = null;
DataInputStream dis = null;
FileOutputStream fos = null;
DataOutputStream dos = null;
is = new FileInputStream("/Users/LG/Documents/pratice/idea project/javaCoding/src/Graph/tinyG.txt");
DataInputStream dataInputStream=new DataInputStream(is);
System.out.println(dataInputStream.readLine());
// InputStreamReader inputStreamReader=new InputStreamReader(is);
//
// BufferedReader br = new BufferedReader(inputStreamReader);
// System.out.println(br.readLine());
// int[] i = {65};
//
// try{
// // create file output stream
// fos = new FileOutputStream("/Users/LG/Documents/pratice/idea project/javaCoding/src/Graph/test");
//
// // create data output stream
// dos = new DataOutputStream(fos);
//
// // for each int in int buffer
// for(int j:i)
// {
// // write int to data output stream
// dos.writeInt(j);
// }
//
// // force data to the underlying file output stream
// dos.flush();
//
// // create file input stream
// is = new FileInputStream("/Users/LG/Documents/pratice/idea project/javaCoding/src/Graph/test");
//
// // create new data input stream
// dis = new DataInputStream(is);
//
// // available stream to be read
// while(dis.available()>0)
// {
// // read four bytes from data input, return int
// int k = dis.readInt();
//
// // print int
// System.out.print(k+" ");
// }
// }catch(Exception e){
// // if any error occurs
// e.printStackTrace();
// }finally{
//
// // releases all system resources from the streams
// if(is!=null)
// is.close();
// if(dis!=null)
// dis.close();
// if(fos!=null)
// fos.close();
// if(dos!=null)
// dos.close();
// }
}
}