/** * Recalls data from schedule_data.ser. * * @throws ClassNotFoundException * @throws IOException */ @SuppressWarnings("unchecked") public static void recallConfigFile() throws ClassNotFoundException, IOException { if (path.exists()) { FileInputStream recallConfig = new FileInputStream(path); ObjectInputStream fileRecall = new ObjectInputStream(recallConfig); days = (ArrayList<Day>) fileRecall.readObject(); workers = (ArrayList<Worker>) fileRecall.readObject(); schedule = (Schedule) fileRecall.readObject(); HTMLGenerator.setTables((String) fileRecall.readObject()); fileRecall.close(); recallConfig.close(); } }
/** Dumps data to the file schedule_data.ser. */ public static void dumpConfigFile() { try { path.delete(); path.createNewFile(); FileOutputStream dumpConfig = new FileOutputStream(path); ObjectOutputStream fileStore = new ObjectOutputStream(dumpConfig); fileStore.writeObject(days); fileStore.writeObject(workers); fileStore.writeObject(schedule); fileStore.writeObject(HTMLGenerator.getTables()); fileStore.close(); dumpConfig.close(); System.out.println("Stored"); } catch (FileNotFoundException exception) { exception.printStackTrace(); } catch (IOException exception) { exception.printStackTrace(); } }