10 - Java Serialization with memory buffer - Code Demo 2

​@Rishi Srivastava -------------------------------------------------------------------------------- Chapter 02 - Serialization with memory buffer -------------------------------------------------------------------------------- Java Object ==| Serialize to byte array ==| Memory ByteArrayOutputStream class is used to serialize to byte array. This class implements an output stream in which the data is written into a byte array. The buffer automatically grows as data is written to it. The data can be retrieved using toByteArray() and toString(). Code snippet: final var bout = new ByteArrayOutputStream(); try (final var oos = new ObjectOutputStream( new BufferedOutputStream(bout))) { (“Before Serialization: “); (marketData); (marketData); } - Java Serialization Playlist:
Back to Top