3

I know that i can send a ArrayList to a ip using code below.

List list = new ArrayList();
ByteArrayOutputStream out = new ByteArrayOutputStream();
ObjectOutputStream outputStream = new ObjectOutputStream(out);
outputStream.writeObject(list);
outputStream.close();

byte[] listData = out.toByteArray();

When I replace list with a HashMap why it do not work? How can I send the HashMap if I can't send it this way?

Lasitha Yapa
  • 4,309
  • 8
  • 38
  • 57
  • http://stackoverflow.com/questions/2836646/java-serializable-object-to-byte-array and http://stackoverflow.com/questions/8517323/how-to-convert-map-to-bytes-and-save-to-internal-storage – StanislavL Jan 05 '15 at 06:51

0 Answers0