|
@ -2,8 +2,14 @@ package org.bitbiome.classes; |
|
|
|
|
|
|
|
|
import org.json.JSONObject; |
|
|
import org.json.JSONObject; |
|
|
import org.json.JSONTokener; |
|
|
import org.json.JSONTokener; |
|
|
|
|
|
import org.json.JSONWriter; |
|
|
|
|
|
|
|
|
|
|
|
import java.io.FileWriter; |
|
|
|
|
|
import java.io.IOException; |
|
|
import java.io.InputStream; |
|
|
import java.io.InputStream; |
|
|
|
|
|
import java.io.StringWriter; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class JsonParser { |
|
|
public class JsonParser { |
|
|
|
|
|
|
|
@ -30,7 +36,20 @@ public class JsonParser { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
JSONTokener tokener = new JSONTokener(is); |
|
|
JSONTokener tokener = new JSONTokener(is); |
|
|
|
|
|
|
|
|
return new JSONObject(tokener); |
|
|
return new JSONObject(tokener); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void writeObject(String fileName, JSONObject object) { |
|
|
|
|
|
|
|
|
|
|
|
String resourceName = System.getProperty("user.dir") + "/src/main/resources/" + fileName; |
|
|
|
|
|
try { |
|
|
|
|
|
FileWriter fw = new FileWriter(resourceName, false); |
|
|
|
|
|
fw.write(object.toString(1)); |
|
|
|
|
|
fw.close(); |
|
|
|
|
|
} catch (IOException e) { |
|
|
|
|
|
throw new RuntimeException(e); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |