Interface BinarySerializer<T>
-
- Type Parameters:
T- the type of (de)serialized objects
- All Superinterfaces:
Converter<T,byte[]>,Function<T,byte[]>,Serializable,Serializer<T,byte[]>
- All Known Implementing Classes:
AbstractBinarySerializer
@ParametersAreNonnullByDefault public interface BinarySerializer<T> extends Serializer<T,byte[]>, Serializable
An object that is responsible ofObjecttobyte[]encoding and decoding.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Tdeserialize(DataInput in)Reads and assembles an object of typeTfrom the givenin.Tdeserialize(InputStream is)Reads and assembles an object of typeTfrom the givenis.voidserialize(T t, DataOutput out)Write an object of typeTto the givenout.voidserialize(T t, OutputStream os)Write an object of typeTto the givenos.-
Methods inherited from interface org.atlanmod.commons.io.serializer.Serializer
convert, deserialize, revert, serialize
-
-
-
-
Method Detail
-
serialize
void serialize(T t, @WillNotClose OutputStream os) throws IOException
Write an object of typeTto the givenos.If the
osalso implementsDataOutput, prefer usingserialize(Object, DataOutput). This method will create a adapter onosbefore calling it.- Parameters:
t- the object to serializeos- the output stream- Throws:
IOException- if an I/O error occurs during the serialization
-
serialize
void serialize(T t, @WillNotClose DataOutput out) throws IOException
Write an object of typeTto the givenout.- Parameters:
t- the object to serializeout- the output stream- Throws:
IOException- if an I/O error occurs during the serialization
-
deserialize
@Nonnull T deserialize(@WillNotClose InputStream is) throws IOException
Reads and assembles an object of typeTfrom the givenis.If the
isalso implementsDataInput, prefer usingdeserialize(DataInput). This method will create a adapter onisbefore calling it.- Parameters:
is- the input stream- Returns:
- the deserialized object
- Throws:
IOException- if an I/O error occurs during the deserialization
-
deserialize
@Nonnull T deserialize(@WillNotClose DataInput in) throws IOException
Reads and assembles an object of typeTfrom the givenin.- Parameters:
in- the input stream- Returns:
- the deserialized object
- Throws:
IOException- if an I/O error occurs during the deserialization
-
-