Package io.activej.csp.binary
Class Utils
java.lang.Object
io.activej.csp.binary.Utils
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic OutputStreamchannelConsumerAsOutputStream(io.activej.reactor.Reactor reactor, ChannelConsumer<io.activej.bytebuf.ByteBuf> channelConsumer) Creates anOutputStreamout of a.static InputStreamchannelSupplierAsInputStream(io.activej.reactor.Reactor reactor, ChannelSupplier<io.activej.bytebuf.ByteBuf> channelSupplier) Creates anInputStreamout of aChannelSupplier<io.activej.bytebuf.ByteBuf>.
-
Constructor Details
-
Utils
public Utils()
-
-
Method Details
-
channelConsumerAsOutputStream
public static OutputStream channelConsumerAsOutputStream(io.activej.reactor.Reactor reactor, ChannelConsumer<io.activej.bytebuf.ByteBuf> channelConsumer) Creates anOutputStreamout of a.Asynchronous operations are executed in a context of a specified
ReactorPassed
will be closed once a resultingOutputStreamis closed or in case an error occurs while reading data.OutputStream's methods are blocking, so they should not be called from a reactor- Parameters:
reactor- a reactor that will execute asynchronous operationschannelConsumer- aChannelSupplier<io.activej.bytebuf.ByteBuf>that is transformed to anOutputStream- Returns:
- an
OutputStreamout ouf aChannelSupplier<io.activej.bytebuf.ByteBuf>
-
channelSupplierAsInputStream
public static InputStream channelSupplierAsInputStream(io.activej.reactor.Reactor reactor, ChannelSupplier<io.activej.bytebuf.ByteBuf> channelSupplier) Creates anInputStreamout of aChannelSupplier<io.activej.bytebuf.ByteBuf>.Asynchronous operations are executed in a context of a specified
ReactorPassed
ChannelSupplier<io.activej.bytebuf.ByteBuf>will be closed once a resultingInputStreamis closed or in case an error occurs while reading data.InputStream's methods are blocking, so they should not be called from reactor- Parameters:
reactor- a reactor that will execute asynchronous operationschannelSupplier- aChannelSupplier<io.activej.bytebuf.ByteBuf>that is transformed to anInputStream- Returns:
- an
InputStreamout ouf aChannelSupplier<io.activej.bytebuf.ByteBuf>
-