diff options
author | JJ | 2022-12-27 05:38:32 +0000 |
---|---|---|
committer | JJ | 2022-12-27 15:30:20 +0000 |
commit | c14e53775591cb4d75b486d21f4849552d5c7c8c (patch) | |
tree | fc9d67b66107f4965f3173183ec846e4d8e090c4 /src/main/persistance | |
parent | 0e693fd4814572712a4192cb4f176e71f7a344f7 (diff) |
Remove garbage serialization/logging code
Diffstat (limited to 'src/main/persistance')
-rw-r--r-- | src/main/persistance/JsonAble.java | 7 | ||||
-rw-r--r-- | src/main/persistance/JsonUtils.java | 46 |
2 files changed, 0 insertions, 53 deletions
diff --git a/src/main/persistance/JsonAble.java b/src/main/persistance/JsonAble.java deleted file mode 100644 index 408cb06..0000000 --- a/src/main/persistance/JsonAble.java +++ /dev/null @@ -1,7 +0,0 @@ -package persistance; - -import org.json.JSONObject; - -public interface JsonAble { - public JSONObject serialize(); -} diff --git a/src/main/persistance/JsonUtils.java b/src/main/persistance/JsonUtils.java deleted file mode 100644 index c97e5fd..0000000 --- a/src/main/persistance/JsonUtils.java +++ /dev/null @@ -1,46 +0,0 @@ -package persistance; - -import org.json.JSONArray; -import org.json.JSONObject; - -import java.io.PrintWriter; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; - -public class JsonUtils { - - /** - * REQUIRES: A valid filepath path, a writeable JSONObject json - * EFFECTS: writes a String to a file - */ - public static void writeToFile(JSONArray json, String path) { - PrintWriter writer; - try { - writer = new PrintWriter(path); - writer.print(json); - writer.close(); - } catch (Exception e) { - System.out.printf("Write to file failed with %s", e.toString()); - } - } - - /** - * REQUIRES: a path to a valid file containing JSONObject-serialized data - * EFFECTS: reads a serialized String into a JSONObject - */ - public static JSONArray readFromFile(String pathString) { - String content; - JSONArray deread; - Path path; - try { - path = Paths.get(pathString); - content = new String(Files.readAllBytes(path)); - deread = new JSONArray(content); - } catch (Exception e) { - System.out.println("Read from file failed with %s"); - deread = new JSONArray(); - } - return deread; - } -} |