Class VertxInputStream

java.lang.Object
java.io.InputStream
io.mishmash.opentelemetry.server.collector.VertxInputStream
All Implemented Interfaces:
Closeable, AutoCloseable

public class VertxInputStream extends InputStream
An InputStream that takes a Vert.x ReadStream and reads it up to a given number of bytes. Used to limit the number of bytes a client can upload allowing for the upload to not be stored temporarily, but rather to be processed on the fly.
  • Field Details

    • END_BUF

      protected static final io.vertx.core.buffer.Buffer END_BUF
      Special constant to mark this input stream as having reached the last input.
    • EXCEPTION_BUF

      protected static final io.vertx.core.buffer.Buffer EXCEPTION_BUF
      Special constant to mark this input stream as having reached an error.
  • Constructor Details

    • VertxInputStream

      public VertxInputStream(io.vertx.core.streams.ReadStream<io.vertx.core.buffer.Buffer> readStream, long maxBytesToRead)
      Create a new stream.
      Parameters:
      readStream - the input to read from
      maxBytesToRead - the maximum number of input bytes allowed
  • Method Details

    • read

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

      public int available() throws IOException
      Overrides:
      available in class InputStream
      Throws:
      IOException
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class InputStream
      Throws:
      IOException
    • addBuffer

      protected void addBuffer(io.vertx.core.buffer.Buffer b)
      Queues the next input Buffer.
      Parameters:
      b - the input buffer
    • handleStreamEnd

      protected void handleStreamEnd(Void v)
      Called when there will be no more input buffers.
      Parameters:
      v - - a void
    • handleStreamException

      protected void handleStreamException(Throwable t)
      Called upon errors.
      Parameters:
      t - the error encountered