- java.lang.Object
-
- java.io.InputStream
-
- io.helidon.media.common.PublisherInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Flow.Publisher<DataChunk>
public class PublisherInputStream extends InputStream implements Flow.Publisher<DataChunk>
Ansubscriberthat can subscribe to a source ofByteBufferdata chunks and then make them available for consumption via standard blockingInputStreamAPI.
-
-
Constructor Summary
Constructors Constructor Description PublisherInputStream(Flow.Publisher<DataChunk> originalPublisher)Wraps the supplied publisher and adds a blockingInputStreambased nature.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intread()voidsubscribe(Flow.Subscriber<? super DataChunk> subscriber)-
Methods inherited from class java.io.InputStream
available, close, mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
-
-
-
-
Constructor Detail
-
PublisherInputStream
public PublisherInputStream(Flow.Publisher<DataChunk> originalPublisher)
Wraps the supplied publisher and adds a blockingInputStreambased nature. It is illegal to subscribe to the returned publisher.- Parameters:
originalPublisher- the original publisher to wrap
-
-
Method Detail
-
read
public int read() throws IOException- Specified by:
readin classInputStream- Throws:
IOException
-
subscribe
public void subscribe(Flow.Subscriber<? super DataChunk> subscriber)
- Specified by:
subscribein interfaceFlow.Publisher<DataChunk>
-
-