- public static void saveObjects(ArrayList listData, String fileName) {
- FileOutputStream os = new FileOutputStream("fileName.dat");
- ObjectOutputStream oos = new ObjectOutputStream(os);
- oos.writeObject(listData);
- }
- public static ArrayList readObjects(String fileName) {
- ArrayList listDat;
- Object obj;
- try{
- FileInputStream is = new FileInputStream("fileName.dat");
- ObjectInputStream ois = new ObjectInputStream(is);
- obj = ois.readObject();
- }catch (Exception e) {
- e.printStackTrace();
- }