public final class DefaultSerializer extends java.lang.Object implements Serializer
Serializer.| Constructor and Description |
|---|
DefaultSerializer(SerializationProvider serializationProvider)
New instance.
|
| Modifier and Type | Method and Description |
|---|---|
<T> BlockingIterable<T> |
deserialize(BlockingIterable<Buffer> source,
java.lang.Class<T> type)
Applies a deserializer on the passed
BlockingIterable to convert into a Iterable of deserialized
instances of T. |
<T> BlockingIterable<T> |
deserialize(BlockingIterable<Buffer> source,
TypeHolder<T> typeHolder)
Applies a deserializer on the passed
BlockingIterable to convert into a BlockingIterable of
deserialized instances of T. |
<T> CloseableIterable<T> |
deserialize(java.lang.Iterable<Buffer> source,
java.lang.Class<T> type)
Applies a deserializer on the passed
Iterable to convert into a CloseableIterable of deserialized
instances of T. |
<T> CloseableIterable<T> |
deserialize(java.lang.Iterable<Buffer> source,
TypeHolder<T> typeHolder)
Applies a deserializer on the passed
Iterable to convert into a Iterable of deserialized
instances of T. |
<T> Publisher<T> |
deserialize(Publisher<Buffer> source,
java.lang.Class<T> type)
|
<T> Publisher<T> |
deserialize(Publisher<Buffer> source,
TypeHolder<T> typeHolder)
|
<T> CloseableIterable<T> |
deserializeAggregated(Buffer serializedData,
java.lang.Class<T> type)
Deserializes the passed encoded
Buffer to one or more instances of T. |
<T> CloseableIterable<T> |
deserializeAggregated(Buffer serializedData,
TypeHolder<T> typeHolder)
Deserializes the passed encoded
Buffer to zero or more instances of T. |
<T> T |
deserializeAggregatedSingle(Buffer serializedData,
java.lang.Class<T> type)
Deserializes the passed encoded
Buffer to a single instance of T. |
<T> T |
deserializeAggregatedSingle(Buffer serializedData,
TypeHolder<T> typeHolder)
Deserializes the passed encoded
Buffer to a single instance of T. |
<T> BlockingIterable<Buffer> |
serialize(BlockingIterable<T> source,
BufferAllocator allocator,
java.lang.Class<T> type)
Transforms the passed
BlockingIterable such that each contained element of type T is serialized
into a Buffer. |
<T> BlockingIterable<Buffer> |
serialize(BlockingIterable<T> source,
BufferAllocator allocator,
java.lang.Class<T> type,
java.util.function.IntUnaryOperator bytesEstimator)
Transforms the passed
BlockingIterable such that each contained element of type T is serialized
into a Buffer. |
<T> BlockingIterable<Buffer> |
serialize(BlockingIterable<T> source,
BufferAllocator allocator,
TypeHolder<T> typeHolder)
Transforms the passed
BlockingIterable such that each contained element of type T is serialized
into a Buffer. |
<T> BlockingIterable<Buffer> |
serialize(BlockingIterable<T> source,
BufferAllocator allocator,
TypeHolder<T> typeHolder,
java.util.function.IntUnaryOperator bytesEstimator)
Transforms the passed
BlockingIterable such that each contained element of type T is serialized
into a Buffer. |
<T> java.lang.Iterable<Buffer> |
serialize(java.lang.Iterable<T> source,
BufferAllocator allocator,
java.lang.Class<T> type)
Transforms the passed
Iterable such that each contained element of type T is serialized into
a Buffer. |
<T> java.lang.Iterable<Buffer> |
serialize(java.lang.Iterable<T> source,
BufferAllocator allocator,
java.lang.Class<T> type,
java.util.function.IntUnaryOperator bytesEstimator)
Transforms the passed
Iterable such that each contained element of type T is serialized into
a Buffer. |
<T> java.lang.Iterable<Buffer> |
serialize(java.lang.Iterable<T> source,
BufferAllocator allocator,
TypeHolder<T> typeHolder)
Transforms the passed
Iterable such that each contained element of type T is serialized into
a Buffer. |
<T> java.lang.Iterable<Buffer> |
serialize(java.lang.Iterable<T> source,
BufferAllocator allocator,
TypeHolder<T> typeHolder,
java.util.function.IntUnaryOperator bytesEstimator)
Transforms the passed
Iterable such that each contained element of type T is serialized into
a Buffer. |
<T> Publisher<Buffer> |
serialize(Publisher<T> source,
BufferAllocator allocator,
java.lang.Class<T> type)
|
<T> Publisher<Buffer> |
serialize(Publisher<T> source,
BufferAllocator allocator,
java.lang.Class<T> type,
java.util.function.IntUnaryOperator bytesEstimator)
|
<T> Publisher<Buffer> |
serialize(Publisher<T> source,
BufferAllocator allocator,
TypeHolder<T> typeHolder)
|
<T> Publisher<Buffer> |
serialize(Publisher<T> source,
BufferAllocator allocator,
TypeHolder<T> typeHolder,
java.util.function.IntUnaryOperator bytesEstimator)
|
<T> void |
serialize(T toSerialize,
Buffer destination)
Serializes the passed object
toSerialize to the passed Buffer. |
<T> Buffer |
serialize(T toSerialize,
BufferAllocator allocator)
Serializes the passed object
toSerialize to the returned Buffer. |
<T> Buffer |
serialize(T toSerialize,
BufferAllocator allocator,
int bytesEstimate)
Serializes the passed object
toSerialize to the returned Buffer. |
public DefaultSerializer(SerializationProvider serializationProvider)
serializationProvider - SerializationProvider to use.public <T> Publisher<Buffer> serialize(Publisher<T> source, BufferAllocator allocator, java.lang.Class<T> type)
SerializerPublisher such that each contained element of type T is serialized into
a Buffer.serialize in interface SerializerT - The data type to serialize.source - Publisher containing objects to serialize.allocator - The BufferAllocator used to allocate Buffers.type - The class for T, the object to be serialized.Publisher such that each contained element in the original Publisher is
transformed from type T to a Buffer.public <T> java.lang.Iterable<Buffer> serialize(java.lang.Iterable<T> source, BufferAllocator allocator, java.lang.Class<T> type)
SerializerIterable such that each contained element of type T is serialized into
a Buffer.serialize in interface SerializerT - The data type to serialize.source - Iterable containing objects to serialize.allocator - The BufferAllocator used to allocate Buffers.type - The class for T, the object to be serialized.Iterable such that each contained element in the original Iterable is
transformed from type T to a Buffer.public <T> BlockingIterable<Buffer> serialize(BlockingIterable<T> source, BufferAllocator allocator, java.lang.Class<T> type)
SerializerBlockingIterable such that each contained element of type T is serialized
into a Buffer.serialize in interface SerializerT - The data type to serialize.source - BlockingIterable containing objects to serialize.allocator - The BufferAllocator used to allocate Buffers.type - The class for T, the object to be serialized.BlockingIterable such that each contained element in the original
BlockingIterable is transformed from type T to a Buffer.public <T> Publisher<Buffer> serialize(Publisher<T> source, BufferAllocator allocator, java.lang.Class<T> type, java.util.function.IntUnaryOperator bytesEstimator)
SerializerPublisher such that each contained element of type T is serialized into
a Buffer.serialize in interface SerializerT - The data type to serialize.source - Publisher containing objects to serialize.allocator - The BufferAllocator used to allocate Buffers.type - The class for T, the object to be serialized.bytesEstimator - An IntUnaryOperator that given the last serialized size in bytes, estimates the
size of the next object to be serialized in bytes.Publisher such that each contained element in the original Publisher is
transformed from type T to a Buffer.public <T> java.lang.Iterable<Buffer> serialize(java.lang.Iterable<T> source, BufferAllocator allocator, java.lang.Class<T> type, java.util.function.IntUnaryOperator bytesEstimator)
SerializerIterable such that each contained element of type T is serialized into
a Buffer.serialize in interface SerializerT - The data type to serialize.source - Iterable containing objects to serialize.allocator - The BufferAllocator used to allocate Buffers.type - The class for T, the object to be serialized.bytesEstimator - An IntUnaryOperator that given the last serialized size in bytes, estimates the
size of the next object to be serialized in bytes.Iterable such that each contained element in the original Iterable is
transformed from type T to a Buffer.public <T> BlockingIterable<Buffer> serialize(BlockingIterable<T> source, BufferAllocator allocator, java.lang.Class<T> type, java.util.function.IntUnaryOperator bytesEstimator)
SerializerBlockingIterable such that each contained element of type T is serialized
into a Buffer.serialize in interface SerializerT - The data type to serialize.
size of the next object to be serialized in bytes.source - BlockingIterable containing objects to serialize.allocator - The BufferAllocator used to allocate Buffers.type - The class for T, the object to be serialized.bytesEstimator - An IntUnaryOperator that given the last serialized size in bytes, estimates theBlockingIterable such that each contained element in the original
BlockingIterable is transformed from type T to a Buffer.public <T> Publisher<Buffer> serialize(Publisher<T> source, BufferAllocator allocator, TypeHolder<T> typeHolder)
SerializerPublisher such that each contained element of type T is serialized into
a Buffer.serialize in interface SerializerT - The data type to serialize.source - Publisher containing objects to serialize.allocator - The BufferAllocator used to allocate Buffers.typeHolder - TypeHolder holding the ParameterizedType to be serialized.Publisher such that each contained element in the original Publisher is
transformed from type T to a Buffer.public <T> java.lang.Iterable<Buffer> serialize(java.lang.Iterable<T> source, BufferAllocator allocator, TypeHolder<T> typeHolder)
SerializerIterable such that each contained element of type T is serialized into
a Buffer.serialize in interface SerializerT - The data type to serialize.source - Iterable containing objects to serialize.allocator - The BufferAllocator used to allocate Buffers.typeHolder - TypeHolder holding the ParameterizedType to be serialized.Iterable such that each contained element in the original Iterable is
transformed from type T to a Buffer.public <T> BlockingIterable<Buffer> serialize(BlockingIterable<T> source, BufferAllocator allocator, TypeHolder<T> typeHolder)
SerializerBlockingIterable such that each contained element of type T is serialized
into a Buffer.serialize in interface SerializerT - The data type to serialize.source - BlockingIterable containing objects to serialize.allocator - The BufferAllocator used to allocate Buffers.typeHolder - TypeHolder holding the ParameterizedType to be serialized.BlockingIterable such that each contained element in the original
BlockingIterable is transformed from type T to a Buffer.public <T> Publisher<Buffer> serialize(Publisher<T> source, BufferAllocator allocator, TypeHolder<T> typeHolder, java.util.function.IntUnaryOperator bytesEstimator)
SerializerPublisher such that each contained element of type T is serialized into
a Buffer.serialize in interface SerializerT - The data type to serialize.source - Publisher containing objects to serialize.allocator - The BufferAllocator used to allocate Buffers.typeHolder - TypeHolder holding the ParameterizedType to be serialized.bytesEstimator - An IntUnaryOperator that given the last serialized size in bytes, estimates the
size of the next object to be serialized in bytes.Publisher such that each contained element in the original Publisher is
transformed from type T to a Buffer.public <T> java.lang.Iterable<Buffer> serialize(java.lang.Iterable<T> source, BufferAllocator allocator, TypeHolder<T> typeHolder, java.util.function.IntUnaryOperator bytesEstimator)
SerializerIterable such that each contained element of type T is serialized into
a Buffer.serialize in interface SerializerT - The data type to serialize.source - Iterable containing objects to serialize.allocator - The BufferAllocator used to allocate Buffers.typeHolder - TypeHolder holding the ParameterizedType to be serialized.bytesEstimator - An IntUnaryOperator that given the last serialized size in bytes, estimates the
size of the next object to be serialized in bytes.Iterable such that each contained element in the original Iterable is
transformed from type T to a Buffer.public <T> BlockingIterable<Buffer> serialize(BlockingIterable<T> source, BufferAllocator allocator, TypeHolder<T> typeHolder, java.util.function.IntUnaryOperator bytesEstimator)
SerializerBlockingIterable such that each contained element of type T is serialized
into a Buffer.serialize in interface SerializerT - The data type to serialize.source - BlockingIterable containing objects to serialize.allocator - The BufferAllocator used to allocate Buffers.typeHolder - TypeHolder holding the ParameterizedType to be serialized.bytesEstimator - An IntUnaryOperator that given the last serialized size in bytes, estimates the
size of the next object to be serialized in bytes.BlockingIterable such that each contained element in the original
BlockingIterable is transformed from type T to a Buffer.public <T> Buffer serialize(T toSerialize, BufferAllocator allocator)
SerializertoSerialize to the returned Buffer.serialize in interface SerializerT - The data type to serialize.toSerialize - Object to serialize.allocator - BufferAllocator to allocate the returned Buffer.Buffer containing the serialized representation of toSerialize.public <T> Buffer serialize(T toSerialize, BufferAllocator allocator, int bytesEstimate)
SerializertoSerialize to the returned Buffer.serialize in interface SerializerT - The data type to serialize.toSerialize - Object to serialize.allocator - BufferAllocator to allocate the returned Buffer.bytesEstimate - An estimate for the size in bytes of the serialized representation of toSerialize.Buffer containing the serialized representation of toSerialize.public <T> void serialize(T toSerialize,
Buffer destination)
SerializertoSerialize to the passed Buffer.serialize in interface SerializerT - The data type to serialize.toSerialize - Object to serialize.destination - The Buffer to which the serialized representation of toSerialize is written.public <T> Publisher<T> deserialize(Publisher<Buffer> source, TypeHolder<T> typeHolder)
SerializerPublisher to convert into a Publisher of deserialized
instances of T. If the source Publisher terminates with some left over data in a
previously emitted Buffer but not deserialized in an object, then the returned Publisher will
terminate with an error.
If all content has been aggregated into a single Buffer, Serializer.deserializeAggregated(Buffer, Class)
can be used.
deserialize in interface SerializerT - The data type to deserialize.source - Publisher containing Buffers to deserialize.typeHolder - TypeHolder holding the ParameterizedType to be deserialized.Publisher such that each contained element in the original Publisher is
transformed from type Buffer to an instance of T.public <T> CloseableIterable<T> deserialize(java.lang.Iterable<Buffer> source, TypeHolder<T> typeHolder)
SerializerIterable to convert into a Iterable of deserialized
instances of T. If the source Iterable completes with some left over data in a
previously emitted Buffer but not deserialized in an object, then Iterator from the returned
Iterable will throw an SerializationException from Iterator.hasNext() after all
deserialized instances are emitted.
If all content has been aggregated into a single Buffer,
Serializer.deserializeAggregated(Buffer, TypeHolder) can be used.
deserialize in interface SerializerT - The data type to deserialize.source - Iterable containing Buffers to deserialize.typeHolder - TypeHolder holding the ParameterizedType to be deserialized.CloseableIterable such that each contained element in the original Iterable
is transformed from type Buffer to an instance of T.public <T> BlockingIterable<T> deserialize(BlockingIterable<Buffer> source, TypeHolder<T> typeHolder)
SerializerBlockingIterable to convert into a BlockingIterable of
deserialized instances of T. If the source BlockingIterable completes with some left
over data in a previously emitted Buffer but not deserialized in an object, then BlockingIterator
from the returned BlockingIterable will throw an SerializationException from
Iterator.hasNext() after all deserialized instances are emitted.
If all content has been aggregated into a single Buffer, Serializer.deserializeAggregated(Buffer, Class)
can be used.
deserialize in interface SerializerT - The data type to deserialize.source - BlockingIterable containing Buffers to deserialize.typeHolder - TypeHolder holding the ParameterizedType to be deserialized.BlockingIterable such that each contained element in the original
BlockingIterable is transformed from type Buffer to an instance of T.public <T> Publisher<T> deserialize(Publisher<Buffer> source, java.lang.Class<T> type)
SerializerPublisher to convert into a Publisher of deserialized
instances of T. If the source Publisher terminates with some left over data in a
previously emitted Buffer but not deserialized in an object, then the returned Publisher will
terminate with an error.
If all content has been aggregated into a single Buffer, Serializer.deserializeAggregated(Buffer, Class)
can be used.
deserialize in interface SerializerT - The data type to deserialize.source - Publisher containing Buffers to deserialize.type - The class for T, the object to be deserialized.Publisher such that each contained element in the original Publisher is
transformed from type Buffer to an instance of T.public <T> CloseableIterable<T> deserialize(java.lang.Iterable<Buffer> source, java.lang.Class<T> type)
SerializerIterable to convert into a CloseableIterable of deserialized
instances of T. If the source Iterable completes with some left over data in a
previously emitted Buffer but not deserialized in an object, then CloseableIterator from the
returned CloseableIterable will throw an SerializationException from
Iterator.hasNext() after all deserialized instances are emitted.
If all content has been aggregated into a single Buffer, Serializer.deserializeAggregated(Buffer, Class)
can be used.
deserialize in interface SerializerT - The data type to deserialize.source - Iterable containing Buffers to deserialize.type - The class for T, the object to be deserialized.CloseableIterable such that each contained element in the original Iterable
is transformed from type Buffer to an instance of T.public <T> BlockingIterable<T> deserialize(BlockingIterable<Buffer> source, java.lang.Class<T> type)
SerializerBlockingIterable to convert into a Iterable of deserialized
instances of T. If the source BlockingIterable completes with some left over data in a
previously emitted Buffer but not deserialized in an object, then BlockingIterator from the
returned BlockingIterable will throw an SerializationException from
Iterator.hasNext() after all deserialized instances are emitted.
If all content has been aggregated into a single Buffer, Serializer.deserializeAggregated(Buffer, Class)
can be used.
deserialize in interface SerializerT - The data type to deserialize.source - BlockingIterable containing Buffers to deserialize.type - The class for T, the object to be deserialized.BlockingIterable such that each contained element in the original
BlockingIterable is transformed from type Buffer to an instance of T.public <T> CloseableIterable<T> deserializeAggregated(Buffer serializedData, java.lang.Class<T> type)
SerializerBuffer to one or more instances of T.
Buffer contains exact amount of data required to deserialize into
at least one complete instance of T. If there is any left over data in the Buffer after the
deserialization is complete, Iterator.hasNext() and Iterator.next() methods
will eventually throw a SerializationException from the CloseableIterator returned by
CloseableIterable.iterator(). In such a case, all deserialized data will first be returned from the
CloseableIterator.deserializeAggregated in interface SerializerT - The data type to deserialize.serializedData - A Buffer containing serialized representation of one or more instances of
T.type - The class for T, the object to be deserialized.CloseableIterable containing one or more deserialized instances of T. If there is any
left over data in the Buffer after the deserialization is complete, Iterator.hasNext()
and Iterator.next() methods will eventually throw a SerializationException from the
CloseableIterator returned by CloseableIterable.iterator(). In such a case, all deserialized
data will first be returned from the Iterator.public <T> CloseableIterable<T> deserializeAggregated(Buffer serializedData, TypeHolder<T> typeHolder)
SerializerBuffer to zero or more instances of T.
Buffer contains exact amount of data required to deserialize into
at least one complete instance of T. If there is any left over data in the Buffer after
deserialization is complete, Iterator.hasNext() and Iterator.next() methods
will eventually throw a SerializationException from the CloseableIterator returned by
CloseableIterable.iterator(). In such a case, all deserialized data will first be returned from the
CloseableIterator.deserializeAggregated in interface SerializerT - The data type to deserialize.serializedData - A Buffer containing serialized representation of one or more instances of
T.typeHolder - TypeHolder holding the ParameterizedType to be deserialized.CloseableIterable containing one or more deserialized instances of T. If there is any
left over data in the Buffer after the deserialization is complete, Iterator.hasNext()
and Iterator.next() methods will eventually throw a SerializationException from the
CloseableIterator returned by CloseableIterable.iterator(). In such a case, all deserialized
data will first be returned from the CloseableIterator.public <T> T deserializeAggregatedSingle(Buffer serializedData, java.lang.Class<T> type)
SerializerBuffer to a single instance of T.deserializeAggregatedSingle in interface SerializerT - The data type to deserialize.serializedData - A Buffer containing serialized representation of a single instance of T.type - The class for T, the object to be deserialized.public <T> T deserializeAggregatedSingle(Buffer serializedData, TypeHolder<T> typeHolder)
SerializerBuffer to a single instance of T.deserializeAggregatedSingle in interface SerializerT - The data type to deserialize.serializedData - A Buffer containing serialized representation of a single instance of T.typeHolder - TypeHolder holding the ParameterizedType to be deserialized.