Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. public void readFromBinaryFile(String fName) {
  2. // Indlæs listen fra filen "Befolkning.obj"
  3.  
  4. File file = new File(fName);
  5.  
  6. try {
  7. try (ObjectInputStream ois = new ObjectInputStream(new FileInputStream(file))) {
  8. this.list = (List<DanishTown>)ois.readObject();
  9. }
  10. } catch (IOException ex) {
  11. System.out.println(ex.getMessage());
  12. } catch (ClassNotFoundException ex) {
  13. System.out.println(ex.getMessage());
  14. }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement