Package network
Interface ISerializer<T>
- Type Parameters:
T- The type of the object which this class serializes
public interface ISerializer<T>
Represents a serializer/deserializer that writes/reads objects to/from a byte buffer
- Author:
- pfouto
-
Method Summary
Modifier and Type Method Description Tdeserialize(io.netty.buffer.ByteBuf in)Deserializes an object from a byte buffer and returns it.voidserialize(T t, io.netty.buffer.ByteBuf out)Serializes the received object into the received byte buffer.intserializedSize(T t)Calculates the serialized size of a given object2
-
Method Details
-
serialize
Serializes the received object into the received byte buffer.- Parameters:
t- The object to serializeout- The byte buffer to which the object will the written
-
deserialize
Deserializes an object from a byte buffer and returns it.- Parameters:
in- The byte buffer which contains the object to be deserialized- Returns:
- The deserialized object
- Throws:
UnknownHostException- if the message to be deserialized contains a host that cannot be deserialized. Should never be thrown (visible for testing).
-
serializedSize
Calculates the serialized size of a given object2- Parameters:
t- The object whose size is to be calculated- Returns:
- The size of the object when serialized
-