-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileRead.java
More file actions
41 lines (37 loc) · 895 Bytes
/
Copy pathFileRead.java
File metadata and controls
41 lines (37 loc) · 895 Bytes
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
package Tools;
import java.io.*;
public class FileRead {
private BufferedReader reader;
public FileRead(String path){
setup(path);
}
public FileRead(){}
public boolean setup(String path){
File f = new File(path);
try {
reader= new BufferedReader(new FileReader(f));
} catch (FileNotFoundException e) {
e.printStackTrace();
return false;
}
return true;
}{}
public String readNextLine(){
if(reader!=null){
try {
return reader.readLine();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
return null;
}
public void close(){
try {
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}