Class ByteChannelBodySubscriber
java.lang.Object
com.github.mizosoft.methanol.internal.extensions.ByteChannelBodySubscriber
- All Implemented Interfaces:
HttpResponse.BodySubscriber<ReadableByteChannel>, Flow.Subscriber<List<ByteBuffer>>
public final class ByteChannelBodySubscriber
extends Object
implements HttpResponse.BodySubscriber<ReadableByteChannel>
A subscriber that exposes the flow of bytes as a
ReadableByteChannel. The channel is
InterruptibleChannel and either closing it asynchronously or interrupting the reader
thread causes blocks on read() to throw the appropriate exception and the upstream to be
cancelled. Any errors received from upstream are immediately thrown when reading if detected,
even if some bytes were available.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetBody()voidvoidvoidonNext(List<ByteBuffer> item) voidonSubscribe(Flow.Subscription subscription)
-
Constructor Details
-
ByteChannelBodySubscriber
public ByteChannelBodySubscriber()
-
-
Method Details
-
getBody
- Specified by:
getBodyin interfaceHttpResponse.BodySubscriber<ReadableByteChannel>
-
onSubscribe
- Specified by:
onSubscribein interfaceFlow.Subscriber<List<ByteBuffer>>
-
onNext
- Specified by:
onNextin interfaceFlow.Subscriber<List<ByteBuffer>>
-
onError
- Specified by:
onErrorin interfaceFlow.Subscriber<List<ByteBuffer>>
-
onComplete
public void onComplete()- Specified by:
onCompletein interfaceFlow.Subscriber<List<ByteBuffer>>
-