Interface StreamingDeserializer<T>
- Type Parameters:
T
- Type of object to be deserialized.
- All Superinterfaces:
AutoCloseable
,GracefulAutoCloseable
Buffer
s into a stream of StreamingDeserializer
s.
This interface is designed to be used as a function that can convert a Buffer
into a StreamingDeserializer
.
deserialize(Buffer)
maybe called multiple times.
Implementations are assumed to be stateful since a single Buffer
may not hold
enough data to deserialize an entire object. It is expected that deserialize(Buffer)
or
deserialize(Iterable)
may be called multiple times to deserialize a single instance of StreamingDeserializer
as more
data is available.
Implementations are assumed to be synchronous.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Deprecated.Disposes thisStreamingDeserializer
.deserialize
(Buffer toDeserialize) Deprecated.UseStreamingDeserializer
that understands your protocol's framing.default BlockingIterable<T>
deserialize
(BlockingIterable<Buffer> toDeserialize) Deprecated.deserialize
(Iterable<Buffer> toDeserialize) Deprecated.boolean
hasData()
Deprecated.Returnstrue
if thisStreamingDeserializer
contains any data from a previous invocation ofdeserialize(Buffer)
that has not yet been deserialized.Methods inherited from interface io.servicetalk.concurrent.GracefulAutoCloseable
closeGracefully
-
Method Details
-
deserialize
Deprecated.UseStreamingDeserializer
that understands your protocol's framing.Deserialize the passedBuffer
into anIterable
ofStreamingDeserializer
s. If thisBuffer
and any previous left over data is insufficient to deserialize to a single instance ofStreamingDeserializer
then the returnedIterable
will be empty, i.e. the returnedIterator
fromIterable.iterator()
will always returnfalse
fromIterator.hasNext()
.It is assumed that a single instance of
StreamingDeserializer
may receive calls to both this method anddeserialize(Iterable)
. Any left over data from one call is used by a subsequent call to the same or different method.- Parameters:
toDeserialize
-Buffer
to deserialize.- Returns:
Iterable
containing zero or more deserialized instances ofStreamingDeserializer
, if any can be deserialized from the data received till now.
-
deserialize
Deprecated.Deserialize the passedIterable
ofBuffer
s into anIterable
ofStreamingDeserializer
s. If theseBuffer
s and any previous left over data is insufficient to deserialize to a single instance ofStreamingDeserializer
then the returnedIterable
will be empty, i.e. the returnedIterator
fromIterable.iterator()
will always returnfalse
fromIterator.hasNext()
.It is assumed that a single instance of
StreamingDeserializer
may receive calls to both this method anddeserialize(Buffer)
. Any left over data from one call is used by a subsequent call to the same or different method.- Parameters:
toDeserialize
-Iterable
ofBuffer
s to deserialize.- Returns:
Iterable
containing zero or more deserialized instances ofStreamingDeserializer
, if any can be deserialized from the data received till now.
-
deserialize
Deprecated.Deserialize the passedBlockingIterable
ofBuffer
s into aBlockingIterable
ofStreamingDeserializer
s. If theseBuffer
s and any previous left over data is insufficient to deserialize to a single instance ofStreamingDeserializer
then the returnedBlockingIterable
will be empty, i.e. the returnedBlockingIterable
fromBlockingIterable.iterator()
will always returnfalse
fromIterator.hasNext()
.It is assumed that a single instance of
StreamingDeserializer
may receive calls to both this method anddeserialize(Buffer)
. Any left over data from one call is used by a subsequent call to the same or different method.- Parameters:
toDeserialize
-BlockingIterable
ofBuffer
s to deserialize.- Returns:
BlockingIterable
containing zero or more deserialized instances ofStreamingDeserializer
, if any can be deserialized from the data received till now.
-
hasData
boolean hasData()Deprecated.Returnstrue
if thisStreamingDeserializer
contains any data from a previous invocation ofdeserialize(Buffer)
that has not yet been deserialized.- Returns:
true
if thisStreamingDeserializer
contains any data from a previous invocation ofdeserialize(Buffer)
that has not yet been deserialized.
-
close
void close()Deprecated.Disposes thisStreamingDeserializer
. If there is any left-over data left in thisStreamingDeserializer
from a previous call todeserialize(Buffer)
which has not been consumed, this method should throw anSerializationException
to indicate that there is more data that is going to be disposed.- Specified by:
close
in interfaceAutoCloseable
- Throws:
SerializationException
- If there is some over data left but not consumed as returned byhasData()
.
-
StreamingDeserializer
.