Package org.gittorr.ccerial
Interface Serializer<E>
- Type Parameters:
E- the type of object that this serializer handles
public interface Serializer<E>
The
Serializer interface defines the contract for serializing and deserializing
objects to and from binary streams in the Ccerial framework.
Implementations of this interface are responsible for converting Java objects into a compact binary format and reconstructing objects from that format.
-
Method Summary
Modifier and TypeMethodDescriptionDeserializes data from the providedInputStreamand reconstructs an instance of the object.voidserialize(OutputStream out, E entity) Serializes the specified entity into a binary format and writes it to the providedOutputStream.
-
Method Details
-
serialize
Serializes the specified entity into a binary format and writes it to the providedOutputStream.- Parameters:
out- theOutputStreamwhere the serialized data will be writtenentity- the entity to serialize- Throws:
IOException- if an I/O error occurs during serialization
-
deserialize
Deserializes data from the providedInputStreamand reconstructs an instance of the object.- Parameters:
in- theInputStreamcontaining the binary data to deserialize- Returns:
- the reconstructed object of type
E - Throws:
IOException- if an I/O error occurs during deserialization
-