Class MonitorInputStream

All Implemented Interfaces:
Closeable, AutoCloseable

An InputStream that provides buffering and end-of-stream monitoring.
  • Constructor Details

  • Method Details

    • available

      public int available() throws IOException
      Returns 0 if the stream is at EOF, else the underlying inputStream will be queried.
      Overrides:
      available in class BufferedInputStream
      Returns:
      The number of bytes that are available.
      Throws:
      IOException - if an error occurs.
      Since:
      2.0
    • read

      public int read() throws IOException
      Reads a character.
      Overrides:
      read in class BufferedInputStream
      Returns:
      The character that was read as an integer.
      Throws:
      IOException - if an error occurs.
    • read

      public int read(byte[] buffer, int offset, int length) throws IOException
      Reads bytes from this input stream.
      Overrides:
      read in class BufferedInputStream
      Parameters:
      buffer - A byte array in which to place the characters read.
      offset - The offset at which to start reading.
      length - The maximum number of bytes to read.
      Returns:
      The number of bytes read.
      Throws:
      IOException - if an error occurs.
    • close

      public void close() throws IOException
      Closes this input stream and releases any system resources associated with the stream.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class BufferedInputStream
      Throws:
      IOException - if an error occurs.
    • onClose

      protected void onClose() throws IOException
      Called after the stream has been closed. This implementation does nothing.
      Throws:
      IOException - if an error occurs.
    • getCount

      public long getCount()
      Get the number of bytes read by this input stream.
      Returns:
      The number of bytes read by this input stream.