forked from brianfrankcooper/YCSB
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRandomStrfile.java
More file actions
31 lines (28 loc) · 1.08 KB
/
Copy pathRandomStrfile.java
File metadata and controls
31 lines (28 loc) · 1.08 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
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.FileNotFoundException;
public class RandomStrfile {
public static void main(String[] args) throws Exception {
String filename = args[0];
File file = new File(filename);
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
br.mark((int)file.length()+1);
for (int i=0; i<2; i++) {
while(br.ready()) {
String data = br.readLine();
if (data != null)
System.out.println("not null, data " + data);
else
System.out.println("null");
}
if (!br.ready()) {
System.out.println("null");
br.reset();
}
}
br.close();
}
}