-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConvert.java
57 lines (53 loc) · 1.7 KB
/
Convert.java
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class Convert {
private static final String PATH = "/Users/behnaz.changizi/Desktop/Dropbox/tz/calculation/";
public static void main(String[] a) throws IOException {
//ls();
//cat("rep.txt");
//cat("router.txt");
//cat("sync.txt");
//cat("fifo.txt");
//cat("syncprio.txt");
//cat("prioritysync.txt");
//cat("priorityfifo.txt");
cattt("b.txt", 8);
}
private static void cattt(String file, int no) throws IOException {
try (Stream<String> stream = Files.lines(Paths.get(PATH + file))) {
String joined = stream
.map(String::valueOf)
.filter(e -> e.trim().lastIndexOf('\t') > no && e.trim().endsWith("T"))
// .map(e -> e.replaceAll(" \\| ", ","))
// .sorted()
.collect(Collectors.joining("\n "));
System.out.println("List: " + joined);
}
}
/*
private static void ls() throws IOException {
try (Stream<Path> stream = Files.list(Paths.get(PATH))) {
String joined = stream
.map(String::valueOf)
.filter(path -> !path.startsWith("."))
.sorted()
.collect(Collectors.joining("; "));
System.out.println("List: " + joined);
}
}
private static void cat(String file) throws IOException {
try (Stream<String> stream = Files.lines(Paths.get(PATH+file))) {
String joined = stream
.map(String::valueOf)
.filter(e -> !e.trim().endsWith("F"))
// .map(e -> e.replaceAll(" \\| ", ","))
// .sorted()
.collect(Collectors.joining("\n "));
System.out.println("List: " + joined);
}
}*/
}
//