Advertisement
Guest User

Untitled

a guest
May 21st, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. public void serializeAddress(ArrayList<Objeeect> objArr) {
  2.  
  3. FileOutputStream fout = null;
  4. ObjectOutputStream oos = null;
  5.  
  6. try {
  7.  
  8. fout = new FileOutputStream("file.ser");
  9. oos = new ObjectOutputStream(fout);
  10. oos.writeObject(objArr);
  11.  
  12. System.out.println("Done");
  13.  
  14. } catch (Exception ex) {
  15.  
  16. ex.printStackTrace();
  17.  
  18. } finally {
  19.  
  20. if (fout != null) {
  21. try {
  22. fout.close();
  23. } catch (IOException e) {
  24. e.printStackTrace();
  25. }
  26. }
  27.  
  28. if (oos != null) {
  29. try {
  30. oos.close();
  31. } catch (IOException e) {
  32. e.printStackTrace();
  33. }
  34. }
  35.  
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement