Interface MessageBufferInput

  • All Superinterfaces:
    java.lang.AutoCloseable, java.io.Closeable
    All Known Implementing Classes:
    ArrayBufferInput, ByteBufferInput, ChannelBufferInput, InputStreamBufferInput

    public interface MessageBufferInput
    extends java.io.Closeable
    Provides a sequence of MessageBuffer instances.

    A MessageBufferInput implementation has control of lifecycle of the memory so that it can reuse previously allocated memory, use memory pools, or use memory-mapped files.

    • Method Detail

      • next

        MessageBuffer next()
                    throws java.io.IOException
        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.

        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

        void close()
            throws java.io.IOException
        Closes the input.

        When this method is called, the buffer previously returned from 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
        Throws:
        java.io.IOException - when IO error occurred when closing the data source