Class ObservableInputStream.Observer

    • Constructor Summary

      Constructors 
      Constructor Description
      Observer()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void closed()
      Called to indicate that the ObservableInputStream has been closed.
      void data​(byte[] buffer, int offset, int length)
      Called to indicate that InputStream.read(byte[]), or InputStream.read(byte[], int, int) have been called, and are about to invoke data.
      void data​(int value)
      Called to indicate, that InputStream.read() has been invoked on the ObservableInputStream, and will return a value.
      void error​(java.io.IOException exception)
      Called to indicate that an error occurred on the underlying stream.
      void finished()
      Called to indicate that EOF has been seen on the underlying stream.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Observer

        public Observer()
    • Method Detail

      • closed

        public void closed()
                    throws java.io.IOException
        Called to indicate that the ObservableInputStream has been closed.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • data

        public void data​(byte[] buffer,
                         int offset,
                         int length)
                  throws java.io.IOException
        Called to indicate that InputStream.read(byte[]), or InputStream.read(byte[], int, int) have been called, and are about to invoke data.
        Parameters:
        buffer - The byte array, which has been passed to the read call, and where data has been stored.
        offset - The offset within the byte array, where data has been stored.
        length - The number of bytes, which have been stored in the byte array.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • data

        public void data​(int value)
                  throws java.io.IOException
        Called to indicate, that InputStream.read() has been invoked on the ObservableInputStream, and will return a value.
        Parameters:
        value - The value, which is being returned. This will never be -1 (EOF), because, in that case, finished() will be invoked instead.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • error

        public void error​(java.io.IOException exception)
                   throws java.io.IOException
        Called to indicate that an error occurred on the underlying stream.
        Parameters:
        exception - the exception to throw
        Throws:
        java.io.IOException - if an I/O error occurs.
      • finished

        public void finished()
                      throws java.io.IOException
        Called to indicate that EOF has been seen on the underlying stream. This method may be called multiple times, if the reader keeps invoking either of the read methods, and they will consequently keep returning EOF.
        Throws:
        java.io.IOException - if an I/O error occurs.