Class BufferInputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, IBufferHandler
    Direct Known Subclasses:
    ChannelInputStream

    public class BufferInputStream
    extends java.io.InputStream
    implements IBufferHandler
    A buffer handler that defragments the passed buffers into a continuous byte sequence which is exposed as an input stream.
    Author:
    Eike Stepper
    • Constructor Detail

      • BufferInputStream

        public BufferInputStream()
    • Method Detail

      • isCCAM

        public boolean isCCAM()
        Since:
        4.4
      • getMillisBeforeTimeout

        public long getMillisBeforeTimeout()
      • getMillisInterruptCheck

        public long getMillisInterruptCheck()
      • restartTimeout

        public void restartTimeout()
        Since:
        2.0
      • getException

        public java.lang.RuntimeException getException()
        Since:
        2.0
      • setException

        public void setException​(RemoteException exception)
        Since:
        4.0
      • handleBuffer

        public void handleBuffer​(IBuffer buffer)
        Description copied from interface: IBufferHandler
        Handles an IBuffer and possibly releases it.

        The implementor of this method takes over the ownership of the buffer. Care must be taken to properly release the buffer if the ownership is not explicitly passed on to some further party.

        Specified by:
        handleBuffer in interface IBufferHandler
        Parameters:
        buffer - The buffer to be handled.
      • read

        public int read()
                 throws java.io.IOException
        Specified by:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • read

        public int read​(byte[] b,
                        int off,
                        int len)
                 throws java.io.IOException
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.InputStream
        Throws:
        java.io.IOException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • ensureBuffer

        protected boolean ensureBuffer()
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • closeChannel

        protected void closeChannel()
        Subclasses may override.
        Since:
        4.5