public static void save() { Main.status("Saving databases."); File file = new File(blogdir, "picpic.db"); List<Object> objects = new ArrayList<>(); objects.add(Main.post_post_hash); Helper.saveObjectToFile(file, objects); Main.status("Done saving databases."); }
public static void load() { Main.status("Loading databases."); File file = new File(blogdir, "picpic.db"); List<Object> objects = Helper.loadObjectFromFile(file); if (objects == null || objects.size() != 1) { Main.error("Unable to load database files so creating new database."); reset(); } else { Main.post_post_hash = (HashMap<Post, Post>) objects.get(0); Main.pic_pic_hash.clear(); Main.pic_post_hash.clear(); Main.dup_post_list.clear(); Main.setupPosts(); } Main.status("Done loading databases."); }