T - public interface Serializer<T> extends SerializerOrResolver<T>
SerializerCollection.| Modifier and Type | Method and Description |
|---|---|
default java.util.function.Function<byte[],T> |
fromBytes()
Create a new function that turns byte arrays into objects.
|
default T |
fromBytes(byte[] data)
Read an instance from the given byte data.
|
default SerializerFormatDefinition |
getFormatDefinition()
Get the definition that describes what this serializer can
read and write.
|
T |
read(StreamingInput in)
Read an object from the specified stream.
|
default java.util.function.Function<T,byte[]> |
toBytes()
Create a new function that turns objects into byte arrays.
|
default byte[] |
toBytes(T instance)
Turn an object into a byte array.
|
void |
write(T object,
String name,
StreamingOutput stream)
Write and object to the specified stream.
|
T read(StreamingInput in) throws IOException
in - IOExceptionvoid write(T object, String name, StreamingOutput stream) throws IOException
object - object to writename - the name it should have in the streamstream - the stream to useIOExceptiondefault SerializerFormatDefinition getFormatDefinition()
default byte[] toBytes(T instance)
instance - default java.util.function.Function<T,byte[]> toBytes()
default T fromBytes(byte[] data)
data - default java.util.function.Function<byte[],T> fromBytes()
Copyright © 2016. All rights reserved.