Matthew
Matthew

Reputation: 3946

Java ArrayList Serialization issues

I seem to recall an issue when you are trying to serialize ArrayLists in Java. I have run into the problem and cannot figure it out.

I send an ArrayList through a socket and then when I send it again, the ArrayList doesn't get transmitted correctly (even though the ArrayList has been modified) I recall this has something to do with not flushing the stream or something. Can anyone help me remember the issue and how to solve it?

Upvotes: 0

Views: 92

Answers (1)

user207421
user207421

Reputation: 310868

If by 'doesn't get transmitted correctly' you mean 'doesn't get updated at the peer' you need to call ObjectOutputStream.reset() before re-sendng an instance after it's been changed.

Upvotes: 1

Related Questions