Class Utils

java.lang.Object
io.activej.csp.binary.Utils

public class Utils extends Object
  • Constructor Details

    • Utils

      public Utils()
  • Method Details

    • channelConsumerAsOutputStream

      public static OutputStream channelConsumerAsOutputStream(io.activej.reactor.Reactor reactor, ChannelConsumer<io.activej.bytebuf.ByteBuf> channelConsumer)
      Creates an OutputStream out of a .

      Asynchronous operations are executed in a context of a specified Reactor

      Passed will be closed once a resulting OutputStream is 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 operations
      channelConsumer - a ChannelSupplier<io.activej.bytebuf.ByteBuf> that is transformed to an OutputStream
      Returns:
      an OutputStream out ouf a ChannelSupplier<io.activej.bytebuf.ByteBuf>
    • channelSupplierAsInputStream

      public static InputStream channelSupplierAsInputStream(io.activej.reactor.Reactor reactor, ChannelSupplier<io.activej.bytebuf.ByteBuf> channelSupplier)
      Creates an InputStream out of a ChannelSupplier<io.activej.bytebuf.ByteBuf>.

      Asynchronous operations are executed in a context of a specified Reactor

      Passed ChannelSupplier<io.activej.bytebuf.ByteBuf> will be closed once a resulting InputStream is 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 operations
      channelSupplier - a ChannelSupplier<io.activej.bytebuf.ByteBuf> that is transformed to an InputStream
      Returns:
      an InputStream out ouf a ChannelSupplier<io.activej.bytebuf.ByteBuf>