Package io.helidon.common.reactive
Class OutputStreamPublisher
- java.lang.Object
-
- java.io.OutputStream
-
- io.helidon.common.reactive.OutputStreamPublisher
-
- All Implemented Interfaces:
Flow.Publisher<ByteBuffer>,Closeable,Flushable,AutoCloseable
public class OutputStreamPublisher extends OutputStream implements Flow.Publisher<ByteBuffer>
Output stream thatpublishesany data written to it asByteBufferevents.
-
-
Constructor Summary
Constructors Constructor Description OutputStreamPublisher()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidflush()Send empty buffer as an indication of a user-requested flush.voidsubscribe(Flow.Subscriber<? super ByteBuffer> subscriberParam)Adds the given Subscriber if possible.voidwrite(byte[] b)voidwrite(byte[] b, int off, int len)voidwrite(int b)-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Method Detail
-
subscribe
public void subscribe(Flow.Subscriber<? super ByteBuffer> subscriberParam)
Description copied from interface:Flow.PublisherAdds the given Subscriber if possible. If already subscribed, or the attempt to subscribe fails due to policy violations or errors, the Subscriber'sonErrormethod is invoked with anIllegalStateException. Otherwise, the Subscriber'sonSubscribemethod is invoked with a newFlow.Subscription. Subscribers may enable receiving items by invoking therequestmethod of this Subscription, and may unsubscribe by invoking itscancelmethod.- Specified by:
subscribein interfaceFlow.Publisher<ByteBuffer>- Parameters:
subscriberParam- the subscriber
-
write
public void write(byte[] b) throws IOException- Overrides:
writein classOutputStream- Throws:
IOException
-
write
public void write(byte[] b, int off, int len) throws IOException- Overrides:
writein classOutputStream- Throws:
IOException
-
write
public void write(int b) throws IOException- Specified by:
writein classOutputStream- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
flush
public void flush() throws IOExceptionSend empty buffer as an indication of a user-requested flush.- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException- If an I/O occurs.
-
-