-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJSONHandler.java
More file actions
32 lines (28 loc) · 783 Bytes
/
Copy pathJSONHandler.java
File metadata and controls
32 lines (28 loc) · 783 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
package node.server.main;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
public class JSONHandler {
/*
* Method saveToJSON
* process save string to JSON file
*/
public void saveToJSON(String stringContent, String nameFile){
FileWriter fileWriter = null;
try {
String content = stringContent;
File newTextFile = new File( nameFile +".json");
fileWriter = new FileWriter(newTextFile);
fileWriter.write(content);
fileWriter.close();
} catch (IOException ex) {
ex.getStackTrace();
} finally {
try {
fileWriter.close();
} catch (IOException ex) {
ex.getStackTrace();
}
}
}
}