Class ChannelBufferInput

    • Constructor Summary

      Constructors 
      Constructor Description
      ChannelBufferInput​(java.nio.channels.ReadableByteChannel channel)  
      ChannelBufferInput​(java.nio.channels.ReadableByteChannel channel, int bufferSize)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Closes the input.
      MessageBuffer next()
      Returns a next buffer to read.
      java.nio.channels.ReadableByteChannel reset​(java.nio.channels.ReadableByteChannel channel)
      Reset channel.
      • Methods inherited from class java.lang.Object

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

      • ChannelBufferInput

        public ChannelBufferInput​(java.nio.channels.ReadableByteChannel channel)
      • ChannelBufferInput

        public ChannelBufferInput​(java.nio.channels.ReadableByteChannel channel,
                                  int bufferSize)
    • Method Detail

      • reset

        public java.nio.channels.ReadableByteChannel reset​(java.nio.channels.ReadableByteChannel channel)
                                                    throws java.io.IOException
        Reset channel. This method doesn't close the old resource.
        Parameters:
        channel - new channel
        Returns:
        the old resource
        Throws:
        java.io.IOException
      • next

        public MessageBuffer next()
                           throws java.io.IOException
        Description copied from interface: MessageBufferInput
        Returns a next buffer to read.

        This method should return a MessageBuffer instance that has data filled in. When this method is called twice, the previously returned buffer is no longer used. Thus implementation of this method can safely discard it. This is useful when it uses a memory pool.

        Specified by:
        next in interface MessageBufferInput
        Returns:
        the next MessageBuffer, or return null if no more buffer is available.
        Throws:
        java.io.IOException - when IO error occurred when reading the data
      • close

        public void close()
                   throws java.io.IOException
        Description copied from interface: MessageBufferInput
        Closes the input.

        When this method is called, the buffer previously returned from MessageBufferInput.next() method is no longer used. Thus implementation of this method can safely discard it.

        If the input is already closed then invoking this method has no effect.

        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface MessageBufferInput
        Throws:
        java.io.IOException - when IO error occurred when closing the data source