-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInput.java
More file actions
35 lines (28 loc) · 893 Bytes
/
Input.java
File metadata and controls
35 lines (28 loc) · 893 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
import java.util.*;
import java.io.*;
public class Input {
final String filename = "InputFile.txt";
List<String> bitString = new ArrayList<String>();
String line;
//Reads InputFile.txt line by line and sends it to bits array
public void parseThroughFile() throws IOException {
FileReader fileReader = new FileReader(filename);
BufferedReader bufferedReader = new BufferedReader(fileReader);
while ((line = bufferedReader.readLine()) != null)
{
bitString.add(line);
}
bufferedReader.close();
bitString.toArray(new String[bitString.size()]);
}
//Returns the bits array
public List<String> getBitString() {
try {
parseThroughFile();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return bitString;
}
}