Class PublisherAsStream

java.lang.Object
java.io.InputStream
io.micronaut.http.body.stream.PublisherAsStream
All Implemented Interfaces:
Closeable, AutoCloseable

@Internal public final class PublisherAsStream extends InputStream
Transform a PublisherAsBlocking of buffers into a InputStream.
Since:
4.10.0
Author:
Jonas Konrad
  • Constructor Details

  • Method Details

    • read

      public int read(byte[] b, int off, int len) throws IOException
      Throws:
      IOException
    • readSome

      public byte @Nullable [] readSome() throws IOException
      Read some data into a new byte array. The array may be of any size. This is usually the same as allocating a new array, calling InputStream.read(byte[]), and then truncating the array, but may be optimized in some implementations.
      Throws:
      IOException
    • allowDiscard

      public void allowDiscard()
      Allow discarding the input of this stream. See ByteBody.allowDiscard().
    • cancelInput

      public void cancelInput()
      Cancel any further upstream input. This also removes any backpressure that this stream may apply on its upstream.
    • read

      public int read() throws IOException
      Specified by:
      read in class InputStream
      Throws:
      IOException
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class InputStream