Guest User

Untitled

a guest
May 21st, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. public static void main(String[] args) {
  2. BufferedReader rd = null;
  3. PipedInputStream pis = null;
  4. PipedOutputStream pos = null;
  5. ObjectInputStream ois = null;
  6. ObjectOutputStream oos = null;
  7. try {
  8. rd = new BufferedReader(new FileReader("countries.csv"));
  9. Labor_09.readFile(rd);
  10. pis = new PipedInputStream();
  11. pos = new PipedOutputStream(pis);
  12. oos = new ObjectOutputStream(pos);
  13. ois = new ObjectInputStream(pis);
  14. oos.writeObject(countries);
  15. do-> countries_2 = (List<Country>) ois.readObject();
  16. } catch (FileNotFoundException ex) {
  17. System.err.println("Datei wurde nicht gefunden!");
  18. } catch (IOException ex) {
  19. System.err.println("Allgemeiner Fehler ist aufgetreten!");
  20. } finally {
  21. if (rd != null) {
  22. try {
  23. rd.close();
  24. } catch (IOException ex) {
  25. }
  26. }
  27. }
  28. }
Add Comment
Please, Sign In to add comment