Reputation: 1
How to serialize and deserialize objects using ByteArrayOutputStream and ByteArrayInputStream? I need a simple and explicit explanation of this topic.
It's a template of this method:
public class Cloner {
public <T> T clone(T value) { … }
}
Upvotes: 0
Views: 183
Reputation: 310936
You do just what you said:
ByteArrayOutputStream
ByteArrayOutputStream
, via new ObjectOutputStream(baos)
ByteArrayOutputStream
ByteArrayInputStream
around itObjectInputStream
around thatNB your generic signature could usefully be <T extends Serializable>
.
Upvotes: 1