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.