-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFReader.java
More file actions
35 lines (32 loc) · 837 Bytes
/
FReader.java
File metadata and controls
35 lines (32 loc) · 837 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
package com.company;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
public class FReader {
FileReader fReader;
BufferedReader bReader;
public FReader(){}
public void initReader(String file) throws IOException{
fReader = new FileReader(file);
bReader = new BufferedReader(fReader);
}
public String readLine() throws IOException{
return bReader.readLine();
}
public void closeReader() throws IOException{
fReader.close();
bReader.close();
}
public List<String> readInList(String prefixToIgnore) throws IOException {
String line;
List<String> stringList = new LinkedList<>();
while((line= bReader.readLine())!= null){
if(!line.startsWith(prefixToIgnore)){
stringList.add(line);
}
}
return stringList;
}
}