/
editFile.java
46 lines (37 loc) · 1.03 KB
/
editFile.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
package ontology;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
public class editFile {
public static void edit(String concept) {
// TODO Auto-generated method stub
String spl[], text = "";
try {
FileInputStream fis = new FileInputStream(new File(
"concepts/" + concept));
BufferedReader br = new BufferedReader(new InputStreamReader(fis));
String line = null;
while ((line = br.readLine()) != null) {
spl = line.split("_");
text += spl[0] + "\n";
}
br.close();
fis.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
PrintStream diskwriter;
try {
diskwriter = new PrintStream("concepts/" + concept);
diskwriter.print(text);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}