Package io.fusionauth.http.io
Class ReaderBlockingByteBufferInputStream
java.lang.Object
java.io.InputStream
io.fusionauth.http.io.ReaderBlockingByteBufferInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable,Consumer<ByteBuffer>
public class ReaderBlockingByteBufferInputStream
extends InputStream
implements Consumer<ByteBuffer>
This InputStream uses ByteBuffers read by the Server processor and piped into this class. Those ByteBuffers are then fed to the reader of
the InputStream. The pushing of ByteBuffers never blocks but the reading will block if there are no more bytes to read.
In order to handle chunking and other considerations, this class can be sub-classed to preprocess bytes.
- Author:
- Brian Pontarelli
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(ByteBuffer buffer) intread()intread(byte[] b, int off, int len) voidMethods inherited from class java.io.InputStream
available, close, mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Constructor Details
-
ReaderBlockingByteBufferInputStream
public ReaderBlockingByteBufferInputStream()
-
-
Method Details
-
accept
- Specified by:
acceptin interfaceConsumer<ByteBuffer>
-
read
public int read()- Specified by:
readin classInputStream
-
read
public int read(byte[] b, int off, int len) - Overrides:
readin classInputStream
-
signalDone
public void signalDone()
-