Interface Serializer<T,U>
-
- Type Parameters:
T- the type of (de)serialized objectsU- the type of the basic representation of the objects
- All Known Subinterfaces:
BinarySerializer<T>,StringSerializer<T>
- All Known Implementing Classes:
AbstractBinarySerializer,AbstractStringSerializer
@ParametersAreNonnullByDefault public interface Serializer<T,U> extends Converter<T,U>
An object that is responsible for encoding and decoding the basic representation ofObjects.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Uconvert(T t)Returns a representation oftas an instance of typeR.Tdeserialize(U data)Reads and assembles an object of typeTfrom the givendata.default Trevert(U data)Returns a representation ofras an instance of typeT.Userialize(T t)Write an object of typeTinto its basic representation.
-
-
-
Method Detail
-
convert
@Nonnull default U convert(T t)
Returns a representation oftas an instance of typeR.- Specified by:
convertin interfaceConverter<T,U>- Parameters:
t- the instance to convert- Returns:
- the converted instance
- See Also:
serialize(Object)
-
revert
@Nonnull default T revert(U data)
Returns a representation ofras an instance of typeT.- Specified by:
revertin interfaceConverter<T,U>- Parameters:
data- the instance to convert- Returns:
- the converted instance
- See Also:
deserialize(Object)
-
serialize
@Nonnull U serialize(T t) throws IOException
Write an object of typeTinto its basic representation.- Parameters:
t- the object to serialize- Returns:
- the serialized object
- Throws:
IOException- if an I/O error occurs during the serialization
-
deserialize
@Nonnull T deserialize(U data) throws IOException
Reads and assembles an object of typeTfrom the givendata.- Parameters:
data- the basic representation of the object- Returns:
- the deserialized object
- Throws:
IOException- if an I/O error occurs during the deserialization
-
-