Package io.servicetalk.serialization.api
Interface Serializer
- All Known Implementing Classes:
DefaultSerializer
Deprecated.
A contract for serialization and deserialization.
-
Method Summary
Modifier and TypeMethodDescription<T> Publisher<T>
deserialize
(Publisher<Buffer> source, TypeHolder<T> typeHolder) Deprecated.<T> Publisher<T>
deserialize
(Publisher<Buffer> source, Class<T> type) Deprecated.<T> BlockingIterable<T>
deserialize
(BlockingIterable<Buffer> source, TypeHolder<T> typeHolder) Deprecated.<T> BlockingIterable<T>
deserialize
(BlockingIterable<Buffer> source, Class<T> type) Deprecated.<T> CloseableIterable<T>
deserialize
(Iterable<Buffer> source, TypeHolder<T> typeHolder) Deprecated.<T> CloseableIterable<T>
deserialize
(Iterable<Buffer> source, Class<T> type) Deprecated.<T> CloseableIterable<T>
deserializeAggregated
(Buffer serializedData, TypeHolder<T> typeHolder) Deprecated.UseStreamingDeserializer
that understands your protocol's framing.<T> CloseableIterable<T>
deserializeAggregated
(Buffer serializedData, Class<T> type) Deprecated.UseStreamingDeserializer
that understands your protocol's framing.<T> T
deserializeAggregatedSingle
(Buffer serializedData, TypeHolder<T> typeHolder) Deprecated.UseDeserializer
.<T> T
deserializeAggregatedSingle
(Buffer serializedData, Class<T> type) Deprecated.UseDeserializer
.serialize
(Publisher<T> source, BufferAllocator allocator, TypeHolder<T> typeHolder) Deprecated.serialize
(Publisher<T> source, BufferAllocator allocator, TypeHolder<T> typeHolder, IntUnaryOperator bytesEstimator) Deprecated.serialize
(Publisher<T> source, BufferAllocator allocator, Class<T> type) Deprecated.serialize
(Publisher<T> source, BufferAllocator allocator, Class<T> type, IntUnaryOperator bytesEstimator) Deprecated.<T> BlockingIterable<Buffer>
serialize
(BlockingIterable<T> source, BufferAllocator allocator, TypeHolder<T> typeHolder) Deprecated.<T> BlockingIterable<Buffer>
serialize
(BlockingIterable<T> source, BufferAllocator allocator, TypeHolder<T> typeHolder, IntUnaryOperator bytesEstimator) Deprecated.<T> BlockingIterable<Buffer>
serialize
(BlockingIterable<T> source, BufferAllocator allocator, Class<T> type) Deprecated.<T> BlockingIterable<Buffer>
serialize
(BlockingIterable<T> source, BufferAllocator allocator, Class<T> type, IntUnaryOperator bytesEstimator) Deprecated.serialize
(Iterable<T> source, BufferAllocator allocator, TypeHolder<T> typeHolder) Deprecated.serialize
(Iterable<T> source, BufferAllocator allocator, TypeHolder<T> typeHolder, IntUnaryOperator bytesEstimator) Deprecated.serialize
(Iterable<T> source, BufferAllocator allocator, Class<T> type) Deprecated.serialize
(Iterable<T> source, BufferAllocator allocator, Class<T> type, IntUnaryOperator bytesEstimator) Deprecated.<T> void
Deprecated.UseSerializer
<T> Buffer
serialize
(T toSerialize, BufferAllocator allocator) Deprecated.<T> Buffer
serialize
(T toSerialize, BufferAllocator allocator, int bytesEstimate) Deprecated.
-
Method Details
-
serialize
@Deprecated <T> Publisher<Buffer> serialize(Publisher<T> source, BufferAllocator allocator, Class<T> type) Deprecated.Transforms the passedPublisher
such that each contained element of typeSerializer
is serialized into aBuffer
.- Type Parameters:
T
- The data type to serialize.- Parameters:
source
-Publisher
containing objects to serialize.allocator
- TheBufferAllocator
used to allocateBuffer
s.type
- The class forSerializer
, the object to be serialized.- Returns:
- A transformed
Publisher
such that each contained element in the originalPublisher
is transformed from typeSerializer
to aBuffer
.
-
serialize
@Deprecated <T> Iterable<Buffer> serialize(Iterable<T> source, BufferAllocator allocator, Class<T> type) Deprecated.Transforms the passedIterable
such that each contained element of typeSerializer
is serialized into aBuffer
.- Type Parameters:
T
- The data type to serialize.- Parameters:
source
-Iterable
containing objects to serialize.allocator
- TheBufferAllocator
used to allocateBuffer
s.type
- The class forSerializer
, the object to be serialized.- Returns:
- A transformed
Iterable
such that each contained element in the originalIterable
is transformed from typeSerializer
to aBuffer
.
-
serialize
@Deprecated <T> BlockingIterable<Buffer> serialize(BlockingIterable<T> source, BufferAllocator allocator, Class<T> type) Deprecated.Transforms the passedBlockingIterable
such that each contained element of typeSerializer
is serialized into aBuffer
.- Type Parameters:
T
- The data type to serialize.- Parameters:
source
-BlockingIterable
containing objects to serialize.allocator
- TheBufferAllocator
used to allocateBuffer
s.type
- The class forSerializer
, the object to be serialized.- Returns:
- A transformed
BlockingIterable
such that each contained element in the originalBlockingIterable
is transformed from typeSerializer
to aBuffer
.
-
serialize
@Deprecated <T> Publisher<Buffer> serialize(Publisher<T> source, BufferAllocator allocator, Class<T> type, IntUnaryOperator bytesEstimator) Deprecated.Transforms the passedPublisher
such that each contained element of typeSerializer
is serialized into aBuffer
.- Type Parameters:
T
- The data type to serialize.- Parameters:
source
-Publisher
containing objects to serialize.allocator
- TheBufferAllocator
used to allocateBuffer
s.type
- The class forSerializer
, the object to be serialized.bytesEstimator
- AnIntUnaryOperator
that given the last serialized size in bytes, estimates the size of the next object to be serialized in bytes.- Returns:
- A transformed
Publisher
such that each contained element in the originalPublisher
is transformed from typeSerializer
to aBuffer
.
-
serialize
@Deprecated <T> Iterable<Buffer> serialize(Iterable<T> source, BufferAllocator allocator, Class<T> type, IntUnaryOperator bytesEstimator) Deprecated.Transforms the passedIterable
such that each contained element of typeSerializer
is serialized into aBuffer
.- Type Parameters:
T
- The data type to serialize.- Parameters:
source
-Iterable
containing objects to serialize.allocator
- TheBufferAllocator
used to allocateBuffer
s.type
- The class forSerializer
, the object to be serialized.bytesEstimator
- AnIntUnaryOperator
that given the last serialized size in bytes, estimates the size of the next object to be serialized in bytes.- Returns:
- A transformed
Iterable
such that each contained element in the originalIterable
is transformed from typeSerializer
to aBuffer
.
-
serialize
@Deprecated <T> BlockingIterable<Buffer> serialize(BlockingIterable<T> source, BufferAllocator allocator, Class<T> type, IntUnaryOperator bytesEstimator) Deprecated.Transforms the passedBlockingIterable
such that each contained element of typeSerializer
is serialized into aBuffer
.- Type Parameters:
T
- The data type to serialize.- Parameters:
source
-BlockingIterable
containing objects to serialize.allocator
- TheBufferAllocator
used to allocateBuffer
s.type
- The class forSerializer
, the object to be serialized.bytesEstimator
- AnIntUnaryOperator
that given the last serialized size in bytes, estimates the- Returns:
- A transformed
BlockingIterable
such that each contained element in the originalBlockingIterable
is transformed from typeSerializer
to aBuffer
.
-
serialize
@Deprecated <T> Publisher<Buffer> serialize(Publisher<T> source, BufferAllocator allocator, TypeHolder<T> typeHolder) Deprecated.Transforms the passedPublisher
such that each contained element of typeSerializer
is serialized into aBuffer
.- Type Parameters:
T
- The data type to serialize.- Parameters:
source
-Publisher
containing objects to serialize.allocator
- TheBufferAllocator
used to allocateBuffer
s.typeHolder
-TypeHolder
holding theParameterizedType
to be serialized.- Returns:
- A transformed
Publisher
such that each contained element in the originalPublisher
is transformed from typeSerializer
to aBuffer
.
-
serialize
@Deprecated <T> Iterable<Buffer> serialize(Iterable<T> source, BufferAllocator allocator, TypeHolder<T> typeHolder) Deprecated.Transforms the passedIterable
such that each contained element of typeSerializer
is serialized into aBuffer
.- Type Parameters:
T
- The data type to serialize.- Parameters:
source
-Iterable
containing objects to serialize.allocator
- TheBufferAllocator
used to allocateBuffer
s.typeHolder
-TypeHolder
holding theParameterizedType
to be serialized.- Returns:
- A transformed
Iterable
such that each contained element in the originalIterable
is transformed from typeSerializer
to aBuffer
.
-
serialize
@Deprecated <T> BlockingIterable<Buffer> serialize(BlockingIterable<T> source, BufferAllocator allocator, TypeHolder<T> typeHolder) Deprecated.Transforms the passedBlockingIterable
such that each contained element of typeSerializer
is serialized into aBuffer
.- Type Parameters:
T
- The data type to serialize.- Parameters:
source
-BlockingIterable
containing objects to serialize.allocator
- TheBufferAllocator
used to allocateBuffer
s.typeHolder
-TypeHolder
holding theParameterizedType
to be serialized.- Returns:
- A transformed
BlockingIterable
such that each contained element in the originalBlockingIterable
is transformed from typeSerializer
to aBuffer
.
-
serialize
@Deprecated <T> Publisher<Buffer> serialize(Publisher<T> source, BufferAllocator allocator, TypeHolder<T> typeHolder, IntUnaryOperator bytesEstimator) Deprecated.Transforms the passedPublisher
such that each contained element of typeSerializer
is serialized into aBuffer
.- Type Parameters:
T
- The data type to serialize.- Parameters:
source
-Publisher
containing objects to serialize.allocator
- TheBufferAllocator
used to allocateBuffer
s.typeHolder
-TypeHolder
holding theParameterizedType
to be serialized.bytesEstimator
- AnIntUnaryOperator
that given the last serialized size in bytes, estimates the size of the next object to be serialized in bytes.- Returns:
- A transformed
Publisher
such that each contained element in the originalPublisher
is transformed from typeSerializer
to aBuffer
.
-
serialize
@Deprecated <T> Iterable<Buffer> serialize(Iterable<T> source, BufferAllocator allocator, TypeHolder<T> typeHolder, IntUnaryOperator bytesEstimator) Deprecated.Transforms the passedIterable
such that each contained element of typeSerializer
is serialized into aBuffer
.- Type Parameters:
T
- The data type to serialize.- Parameters:
source
-Iterable
containing objects to serialize.allocator
- TheBufferAllocator
used to allocateBuffer
s.typeHolder
-TypeHolder
holding theParameterizedType
to be serialized.bytesEstimator
- AnIntUnaryOperator
that given the last serialized size in bytes, estimates the size of the next object to be serialized in bytes.- Returns:
- A transformed
Iterable
such that each contained element in the originalIterable
is transformed from typeSerializer
to aBuffer
.
-
serialize
@Deprecated <T> BlockingIterable<Buffer> serialize(BlockingIterable<T> source, BufferAllocator allocator, TypeHolder<T> typeHolder, IntUnaryOperator bytesEstimator) Deprecated.Transforms the passedBlockingIterable
such that each contained element of typeSerializer
is serialized into aBuffer
.- Type Parameters:
T
- The data type to serialize.- Parameters:
source
-BlockingIterable
containing objects to serialize.allocator
- TheBufferAllocator
used to allocateBuffer
s.typeHolder
-TypeHolder
holding theParameterizedType
to be serialized.bytesEstimator
- AnIntUnaryOperator
that given the last serialized size in bytes, estimates the size of the next object to be serialized in bytes.- Returns:
- A transformed
BlockingIterable
such that each contained element in the originalBlockingIterable
is transformed from typeSerializer
to aBuffer
.
-
serialize
Deprecated.Serializes the passed objecttoSerialize
to the returnedBuffer
.- Type Parameters:
T
- The data type to serialize.- Parameters:
toSerialize
- Object to serialize.allocator
-BufferAllocator
to allocate the returnedBuffer
.- Returns:
Buffer
containing the serialized representation oftoSerialize
.
-
serialize
Deprecated.Serializes the passed objecttoSerialize
to the returnedBuffer
.- Type Parameters:
T
- The data type to serialize.- Parameters:
toSerialize
- Object to serialize.allocator
-BufferAllocator
to allocate the returnedBuffer
.bytesEstimate
- An estimate for the size in bytes of the serialized representation oftoSerialize
.- Returns:
Buffer
containing the serialized representation oftoSerialize
.
-
serialize
Deprecated.UseSerializer
Serializes the passed objecttoSerialize
to the passedBuffer
.- Type Parameters:
T
- The data type to serialize.- Parameters:
toSerialize
- Object to serialize.destination
- TheBuffer
to which the serialized representation oftoSerialize
is written.
-
deserialize
Deprecated.Applies a deserializer on the passedPublisher
to convert into aPublisher
of deserialized instances ofSerializer
. If thesource
Publisher
terminates with some left over data in a previously emittedBuffer
but not deserialized in an object, then the returnedPublisher
will terminate with an error.If all content has been aggregated into a single
Buffer
,deserializeAggregated(Buffer, Class)
can be used.- Type Parameters:
T
- The data type to deserialize.- Parameters:
source
-Publisher
containingBuffer
s to deserialize.typeHolder
-TypeHolder
holding theParameterizedType
to be deserialized.- Returns:
- A transformed
Publisher
such that each contained element in the originalPublisher
is transformed from typeBuffer
to an instance ofSerializer
.
-
deserialize
Deprecated.Applies a deserializer on the passedIterable
to convert into aIterable
of deserialized instances ofSerializer
. If thesource
Iterable
completes with some left over data in a previously emittedBuffer
but not deserialized in an object, thenIterator
from the returnedIterable
will throw anSerializationException
fromIterator.hasNext()
after all deserialized instances are emitted.If all content has been aggregated into a single
Buffer
,deserializeAggregated(Buffer, TypeHolder)
can be used.- Type Parameters:
T
- The data type to deserialize.- Parameters:
source
-Iterable
containingBuffer
s to deserialize.typeHolder
-TypeHolder
holding theParameterizedType
to be deserialized.- Returns:
- A transformed
CloseableIterable
such that each contained element in the originalIterable
is transformed from typeBuffer
to an instance ofSerializer
.
-
deserialize
@Deprecated <T> BlockingIterable<T> deserialize(BlockingIterable<Buffer> source, TypeHolder<T> typeHolder) Deprecated.Applies a deserializer on the passedBlockingIterable
to convert into aBlockingIterable
of deserialized instances ofSerializer
. If thesource
BlockingIterable
completes with some left over data in a previously emittedBuffer
but not deserialized in an object, thenBlockingIterator
from the returnedBlockingIterable
will throw anSerializationException
fromIterator.hasNext()
after all deserialized instances are emitted.If all content has been aggregated into a single
Buffer
,deserializeAggregated(Buffer, Class)
can be used.- Type Parameters:
T
- The data type to deserialize.- Parameters:
source
-BlockingIterable
containingBuffer
s to deserialize.typeHolder
-TypeHolder
holding theParameterizedType
to be deserialized.- Returns:
- A transformed
BlockingIterable
such that each contained element in the originalBlockingIterable
is transformed from typeBuffer
to an instance ofSerializer
.
-
deserialize
Deprecated.Applies a deserializer on the passedPublisher
to convert into aPublisher
of deserialized instances ofSerializer
. If thesource
Publisher
terminates with some left over data in a previously emittedBuffer
but not deserialized in an object, then the returnedPublisher
will terminate with an error.If all content has been aggregated into a single
Buffer
,deserializeAggregated(Buffer, Class)
can be used.- Type Parameters:
T
- The data type to deserialize.- Parameters:
source
-Publisher
containingBuffer
s to deserialize.type
- The class forSerializer
, the object to be deserialized.- Returns:
- A transformed
Publisher
such that each contained element in the originalPublisher
is transformed from typeBuffer
to an instance ofSerializer
.
-
deserialize
Deprecated.Applies a deserializer on the passedIterable
to convert into aCloseableIterable
of deserialized instances ofSerializer
. If thesource
Iterable
completes with some left over data in a previously emittedBuffer
but not deserialized in an object, thenCloseableIterator
from the returnedCloseableIterable
will throw anSerializationException
fromIterator.hasNext()
after all deserialized instances are emitted.If all content has been aggregated into a single
Buffer
,deserializeAggregated(Buffer, Class)
can be used.- Type Parameters:
T
- The data type to deserialize.- Parameters:
source
-Iterable
containingBuffer
s to deserialize.type
- The class forSerializer
, the object to be deserialized.- Returns:
- A transformed
CloseableIterable
such that each contained element in the originalIterable
is transformed from typeBuffer
to an instance ofSerializer
.
-
deserialize
Deprecated.Applies a deserializer on the passedBlockingIterable
to convert into aIterable
of deserialized instances ofSerializer
. If thesource
BlockingIterable
completes with some left over data in a previously emittedBuffer
but not deserialized in an object, thenBlockingIterator
from the returnedBlockingIterable
will throw anSerializationException
fromIterator.hasNext()
after all deserialized instances are emitted.If all content has been aggregated into a single
Buffer
,deserializeAggregated(Buffer, Class)
can be used.- Type Parameters:
T
- The data type to deserialize.- Parameters:
source
-BlockingIterable
containingBuffer
s to deserialize.type
- The class forSerializer
, the object to be deserialized.- Returns:
- A transformed
BlockingIterable
such that each contained element in the originalBlockingIterable
is transformed from typeBuffer
to an instance ofSerializer
.
-
deserializeAggregated
Deprecated.UseStreamingDeserializer
that understands your protocol's framing.Deserializes the passed encodedBuffer
to one or more instances ofSerializer
.Incomplete data
This method assumes that the passedBuffer
contains exact amount of data required to deserialize into at least one complete instance ofSerializer
. If there is any left over data in theBuffer
after the deserialization is complete,Iterator.hasNext()
andIterator.next()
methods will eventually throw aSerializationException
from theCloseableIterator
returned byCloseableIterable.iterator()
. In such a case, all deserialized data will first be returned from theCloseableIterator
.- Type Parameters:
T
- The data type to deserialize.- Parameters:
serializedData
- ABuffer
containing serialized representation of one or more instances ofSerializer
.type
- The class forSerializer
, the object to be deserialized.- Returns:
- An
CloseableIterable
containing one or more deserialized instances ofSerializer
. If there is any left over data in theBuffer
after the deserialization is complete,Iterator.hasNext()
andIterator.next()
methods will eventually throw aSerializationException
from theCloseableIterator
returned byCloseableIterable.iterator()
. In such a case, all deserialized data will first be returned from theIterator
.
-
deserializeAggregated
@Deprecated <T> CloseableIterable<T> deserializeAggregated(Buffer serializedData, TypeHolder<T> typeHolder) Deprecated.UseStreamingDeserializer
that understands your protocol's framing.Deserializes the passed encodedBuffer
to zero or more instances ofSerializer
.Incomplete data
This method assumes that the passedBuffer
contains exact amount of data required to deserialize into at least one complete instance ofSerializer
. If there is any left over data in theBuffer
after deserialization is complete,Iterator.hasNext()
andIterator.next()
methods will eventually throw aSerializationException
from theCloseableIterator
returned byCloseableIterable.iterator()
. In such a case, all deserialized data will first be returned from theCloseableIterator
.- Type Parameters:
T
- The data type to deserialize.- Parameters:
serializedData
- ABuffer
containing serialized representation of one or more instances ofSerializer
.typeHolder
-TypeHolder
holding theParameterizedType
to be deserialized.- Returns:
- An
CloseableIterable
containing one or more deserialized instances ofSerializer
. If there is any left over data in theBuffer
after the deserialization is complete,Iterator.hasNext()
andIterator.next()
methods will eventually throw aSerializationException
from theCloseableIterator
returned byCloseableIterable.iterator()
. In such a case, all deserialized data will first be returned from theCloseableIterator
.
-
deserializeAggregatedSingle
Deprecated.UseDeserializer
.Deserializes the passed encodedBuffer
to a single instance ofSerializer
.- Type Parameters:
T
- The data type to deserialize.- Parameters:
serializedData
- ABuffer
containing serialized representation of a single instance ofSerializer
.type
- The class forSerializer
, the object to be deserialized.- Returns:
- The deserialized object.
- Throws:
SerializationException
- If the passedBuffer
contains an incomplete object or if there is any left over data in theBuffer
after the deserialization is complete.
-
deserializeAggregatedSingle
Deprecated.UseDeserializer
.Deserializes the passed encodedBuffer
to a single instance ofSerializer
.- Type Parameters:
T
- The data type to deserialize.- Parameters:
serializedData
- ABuffer
containing serialized representation of a single instance ofSerializer
.typeHolder
-TypeHolder
holding theParameterizedType
to be deserialized.- Returns:
- The deserialized object.
- Throws:
SerializationException
- If the passedBuffer
contains an incomplete object or if there is any left over data in theBuffer
after the deserialization is complete.
-
Serializer
StreamingSerializer
Deserializer
StreamingDeserializer