Skip to content

Instantly share code, notes, and snippets.

@RammusXu
Created November 8, 2014 06:10
Show Gist options
  • Save RammusXu/ad1c3a16a4c5a9fd9b69 to your computer and use it in GitHub Desktop.
Save RammusXu/ad1c3a16a4c5a9fd9b69 to your computer and use it in GitHub Desktop.
private void writeObject(File file, Object object) {
try {
FileOutputStream fos = new FileOutputStream(file);
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(object);
oos.close();
} catch (Exception e) {
e.printStackTrace();
}
}
private Object readObject(File file) {
Object returnlist = null;
try {
FileInputStream fis = new FileInputStream(file);
ObjectInputStream ois = new ObjectInputStream(fis);
returnlist = ois.readObject();
ois.close();
} catch (Exception e) {
e.printStackTrace();
}
return returnlist;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment