Interface StreamingDeserializer<T>
- Type Parameters:
T- Type of object to be deserialized.
- All Superinterfaces:
AutoCloseable,GracefulAutoCloseable
Buffers into a stream of StreamingDeserializers.
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 TypeMethodDescriptionvoidclose()Deprecated.Disposes thisStreamingDeserializer.deserialize(Buffer toDeserialize) Deprecated.UseStreamingDeserializerthat understands your protocol's framing.default BlockingIterable<T>deserialize(BlockingIterable<Buffer> toDeserialize) Deprecated.deserialize(Iterable<Buffer> toDeserialize) Deprecated.booleanhasData()Deprecated.Returnstrueif thisStreamingDeserializercontains 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.UseStreamingDeserializerthat understands your protocol's framing.Deserialize the passedBufferinto anIterableofStreamingDeserializers. If thisBufferand any previous left over data is insufficient to deserialize to a single instance ofStreamingDeserializerthen the returnedIterablewill be empty, i.e. the returnedIteratorfromIterable.iterator()will always returnfalsefromIterator.hasNext().It is assumed that a single instance of
StreamingDeserializermay 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-Bufferto deserialize.- Returns:
Iterablecontaining zero or more deserialized instances ofStreamingDeserializer, if any can be deserialized from the data received till now.
-
deserialize
Deprecated.Deserialize the passedIterableofBuffers into anIterableofStreamingDeserializers. If theseBuffers and any previous left over data is insufficient to deserialize to a single instance ofStreamingDeserializerthen the returnedIterablewill be empty, i.e. the returnedIteratorfromIterable.iterator()will always returnfalsefromIterator.hasNext().It is assumed that a single instance of
StreamingDeserializermay 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-IterableofBuffers to deserialize.- Returns:
Iterablecontaining zero or more deserialized instances ofStreamingDeserializer, if any can be deserialized from the data received till now.
-
deserialize
Deprecated.Deserialize the passedBlockingIterableofBuffers into aBlockingIterableofStreamingDeserializers. If theseBuffers and any previous left over data is insufficient to deserialize to a single instance ofStreamingDeserializerthen the returnedBlockingIterablewill be empty, i.e. the returnedBlockingIterablefromBlockingIterable.iterator()will always returnfalsefromIterator.hasNext().It is assumed that a single instance of
StreamingDeserializermay 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-BlockingIterableofBuffers to deserialize.- Returns:
BlockingIterablecontaining zero or more deserialized instances ofStreamingDeserializer, if any can be deserialized from the data received till now.
-
hasData
boolean hasData()Deprecated.Returnstrueif thisStreamingDeserializercontains any data from a previous invocation ofdeserialize(Buffer)that has not yet been deserialized.- Returns:
trueif thisStreamingDeserializercontains 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 thisStreamingDeserializerfrom a previous call todeserialize(Buffer)which has not been consumed, this method should throw anSerializationExceptionto indicate that there is more data that is going to be disposed.- Specified by:
closein interfaceAutoCloseable- Throws:
SerializationException- If there is some over data left but not consumed as returned byhasData().
-
StreamingDeserializer.