Module methanol
Class ByteChannelSubscriber
java.lang.Object
com.github.mizosoft.methanol.internal.extensions.ByteChannelSubscriber
- All Implemented Interfaces:
HttpResponse.BodySubscriber<ReadableByteChannel>
,Flow.Subscriber<List<ByteBuffer>>
public final class ByteChannelSubscriber
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
ConstructorDescriptionCreates a new completedByteChannelSubscriber
instance. -
Method Summary
Modifier and TypeMethodDescriptiongetBody()
void
void
void
onNext
(List<ByteBuffer> item) void
onSubscribe
(Flow.Subscription subscription)
-
Constructor Details
-
ByteChannelSubscriber
public ByteChannelSubscriber()Creates a new completedByteChannelSubscriber
instance.
-
-
Method Details
-
getBody
- Specified by:
getBody
in interfaceHttpResponse.BodySubscriber<ReadableByteChannel>
-
onSubscribe
- Specified by:
onSubscribe
in interfaceFlow.Subscriber<List<ByteBuffer>>
-
onNext
- Specified by:
onNext
in interfaceFlow.Subscriber<List<ByteBuffer>>
-
onError
- Specified by:
onError
in interfaceFlow.Subscriber<List<ByteBuffer>>
-
onComplete
public void onComplete()- Specified by:
onComplete
in interfaceFlow.Subscriber<List<ByteBuffer>>
-