-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
30 lines (25 loc) · 795 Bytes
/
Main.java
File metadata and controls
30 lines (25 loc) · 795 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
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
public class Main {
public static void main(String args[]) {
Main app = new Main();
String fileName = args[0];
System.out.println(fileName);
app.printFile(Alignment.align(app.readFile(fileName)));
}
public List<String> readFile(String fileName) {
List<String> lines = new ArrayList<>();
try {
return Files.readAllLines(Paths.get(fileName), StandardCharsets.UTF_8);
} catch (IOException e) {
return lines;
}
}
public void printFile(List<String> lines) {
lines.forEach(System.out::println);
}
}