- java.lang.Object
-
- java.io.InputStream
-
- io.helidon.media.common.DataChunkInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class DataChunkInputStream extends InputStream
Provides a bridge between a reactiveFlow.Publisherin Helidon and anInputStreamin Jersey. It subscribes to a Helidon publisher of data chunks and makes the data available to Jersey using the blockingInputStreamAPI. This implementation is documented here/docs-internal/datachunkinputstream.md.
-
-
Constructor Summary
Constructors Constructor Description DataChunkInputStream(Flow.Publisher<DataChunk> originalPublisher)Stores publisher for later subscription.DataChunkInputStream(Flow.Publisher<DataChunk> originalPublisher, boolean validate)Stores publisher for later subscription and sets if executing thread should be validated.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()intread()intread(byte[] buf, int off, int len)-
Methods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
-
-
-
-
Constructor Detail
-
DataChunkInputStream
public DataChunkInputStream(Flow.Publisher<DataChunk> originalPublisher)
Stores publisher for later subscription. Disables executing thread validation.- Parameters:
originalPublisher- The original publisher.
-
DataChunkInputStream
public DataChunkInputStream(Flow.Publisher<DataChunk> originalPublisher, boolean validate)
Stores publisher for later subscription and sets if executing thread should be validated. If validation is enabled, it asserts if the execution thread is the same as the thread which created this instance and throws anIllegalStateExceptionif it does.- Parameters:
originalPublisher- The original publisher.validate- executing thread validation
-
-
Method Detail
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream
-
read
public int read() throws IOException- Specified by:
readin classInputStream- Throws:
IOException
-
read
public int read(byte[] buf, int off, int len) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
-