Class AsyncBodyDecoder<T>
java.lang.Object
com.github.mizosoft.methanol.decoder.AsyncBodyDecoder<T>
- All Implemented Interfaces:
BodyDecoder<T>, HttpResponse.BodySubscriber<T>, Flow.Subscriber<List<ByteBuffer>>
An implementation of
BodyDecoder that uses an AsyncDecoder for decompression. The
implementation disallows left-over bytes after the final source is acknowledged, completing the
downstream with an IOException on such case. The decoder is closed on either normal or
exceptional completion or on cancellation from downstream.-
Nested Class Summary
Nested classes/interfaces inherited from interface BodyDecoder
BodyDecoder.Factory -
Constructor Summary
ConstructorsConstructorDescriptionAsyncBodyDecoder(AsyncDecoder decoder, HttpResponse.BodySubscriber<T> downstream) Creates anAsyncBodyDecoderin sync mode.AsyncBodyDecoder(AsyncDecoder decoder, HttpResponse.BodySubscriber<T> downstream, Executor executor) Creates anAsyncBodyDecoderthat supplies downstream items in the given executor.AsyncBodyDecoder(AsyncDecoder decoder, HttpResponse.BodySubscriber<T> downstream, Executor executor, int bufferSize) Creates anAsyncBodyDecoderthat supplies downstream items in the given executor. -
Method Summary
Modifier and TypeMethodDescriptionReturns the underlyingAsyncDecoder.Returns this decoder's downstream.encoding()Returns the encoding used by this decoder.executor()Returns this decoder's executor if one is specified.voidvoidvoidonNext(List<ByteBuffer> buffers) voidonSubscribe(Flow.Subscription upstreamSubscription) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BodyDecoder
getBody
-
Constructor Details
-
AsyncBodyDecoder
Creates anAsyncBodyDecoderin sync mode. -
AsyncBodyDecoder
public AsyncBodyDecoder(AsyncDecoder decoder, HttpResponse.BodySubscriber<T> downstream, Executor executor) Creates anAsyncBodyDecoderthat supplies downstream items in the given executor. -
AsyncBodyDecoder
public AsyncBodyDecoder(AsyncDecoder decoder, HttpResponse.BodySubscriber<T> downstream, Executor executor, int bufferSize) Creates anAsyncBodyDecoderthat supplies downstream items in the given executor.
-
-
Method Details
-
asyncDecoder
Returns the underlyingAsyncDecoder. -
encoding
Description copied from interface:BodyDecoderReturns the encoding used by this decoder. This corresponds to the value of theContent-Typeheader.- Specified by:
encodingin interfaceBodyDecoder<T>
-
executor
Description copied from interface:BodyDecoderReturns this decoder's executor if one is specified.- Specified by:
executorin interfaceBodyDecoder<T>
-
downstream
Description copied from interface:BodyDecoderReturns this decoder's downstream.- Specified by:
downstreamin interfaceBodyDecoder<T>
-
onSubscribe
- Specified by:
onSubscribein interfaceFlow.Subscriber<T>
-
onNext
- Specified by:
onNextin interfaceFlow.Subscriber<T>
-
onError
- Specified by:
onErrorin interfaceFlow.Subscriber<T>
-
onComplete
public void onComplete()- Specified by:
onCompletein interfaceFlow.Subscriber<T>
-