Interface Serializer<T>
-
- All Known Implementing Classes:
UUIDSerializer
public interface Serializer<T>Writes/reads an object to/from a binary stream.- Author:
- Paul Ferraro
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Tread(DataInput input)Reads an object from the specified input stream.default OptionalIntsize(T object)Returns the size of the buffer to use for marshalling the specified object, if known.voidwrite(DataOutput output, T value)Writes the specified object to the specified output stream
-
-
-
Method Detail
-
write
void write(DataOutput output, T value) throws IOException
Writes the specified object to the specified output stream- Parameters:
output- the data output streamvalue- an object to serialize- Throws:
IOException- if an I/O error occurs
-
read
T read(DataInput input) throws IOException
Reads an object from the specified input stream.- Parameters:
input- a data input stream- Returns:
- the deserialized object
- Throws:
IOException- if an I/O error occurs
-
size
default OptionalInt size(T object)
Returns the size of the buffer to use for marshalling the specified object, if known.- Returns:
- the buffer size (in bytes), or empty if unknown.
-
-