Advertisement
Guest User

Untitled

a guest
Sep 17th, 2014
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.84 KB | None | 0 0
  1.         ByteArrayOutputStream baos = new ByteArrayOutputStream();
  2.         ObjectOutputStream out = null;
  3.         try {
  4.             out = new ObjectOutputStream(baos);
  5.         } catch (IOException e) {
  6.             e.printStackTrace();
  7.         }
  8.         for (Car element : carList) {
  9.             try {
  10.                 out.writeObject(element);
  11.             } catch (IOException e) {
  12.                 e.printStackTrace();
  13.             }
  14.         }
  15.         byte[] xaValue = baos.toByteArray();
  16.  
  17.  
  18. deserializacja
  19.  
  20. byte[] bytes = theInteraction.getValue(i);
  21.                 ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
  22.                 ObjectInputStream in = new ObjectInputStream(bais);
  23.                 while (in.available() > 0) {
  24.                     Car element = (Car)in.readObject();
  25.                     this.value.add(element);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement