forked from sermakov/JavaPatternMirea
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtsk12.java
More file actions
Latest commit
63 lines (51 loc) · 1.65 KB
/
Copy pathtsk12.java
File metadata and controls
63 lines (51 loc) · 1.65 KB
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
58
59
60
61
62
63
packagea;
importlombok.SneakyThrows;
importorg.springframework.boot.SpringApplication;
importorg.springframework.boot.autoconfigure.SpringBootApplication;
importorg.springframework.stereotype.Component;
importjavax.annotation.PostConstruct;
importjavax.annotation.PreDestroy;
importjava.io.File;
importjava.io.FileReader;
importjava.io.FileWriter;
@SpringBootApplication
publicclasstsk12 {
staticString__arg1;
staticString__arg2;
publicstaticvoidmain(String[] args) {
//noinspection ConstantConditions
finalvara = tsk12
.class
.getClassLoader()
.getResource(".")
.getPath();
__arg1 = a + "/a.txt"; // args[0]
__arg2 = a + "/b.hash"; // args[1]
SpringApplication.run(tsk12.class, args);
}
@Component
publicstaticclassA {
finalFilea = newFile(__arg1);
finalFileb = newFile(__arg2);
@SuppressWarnings("StringConcatenationInLoop")
@SneakyThrows
@PostConstruct
publicvoidst() {
varc = "";
vare = a.exists();
if (e) {
finalvarr = newFileReader(a);
vard = 0;
while ((d = r.read()) != -1)
c += (char) d;
r.close();
} elsec = "null";
assertb.exists() || b.createNewFile();
finalvarw = newFileWriter(b);
w.write(String.valueOf(e ? c.hashCode() : c));
w.close();
}
@SuppressWarnings("ResultOfMethodCallIgnored")
@PreDestroypublicvoiden() { a.delete(); }
}
}