Class MessageChannelReader

java.lang.Object
org.apache.arrow.vector.ipc.message.MessageChannelReader
All Implemented Interfaces:
AutoCloseable

public class MessageChannelReader extends Object implements AutoCloseable
Reads a sequence of messages using a ReadChannel.
  • Field Details

  • Constructor Details

    • MessageChannelReader

      public MessageChannelReader(ReadChannel in, BufferAllocator allocator)
      Construct a MessageReader to read streaming messages from an existing ReadChannel.
      Parameters:
      in - Channel to read messages from
      allocator - BufferAllocator used to read Message body into an ArrowBuf.
  • Method Details

    • readNext

      public MessageResult readNext() throws IOException
      Read a message from the ReadChannel and return a MessageResult containing the Message metadata and optional message body data. Once the end-of-stream has been reached, a null value will be returned. If the message has no body, then MessageResult.getBodyBuffer() returns null.
      Returns:
      MessageResult or null if reached end-of-stream
      Throws:
      IOException - on error
    • bytesRead

      public long bytesRead()
      Get the number of bytes read from the ReadChannel.
      Returns:
      number of bytes
    • close

      public void close() throws IOException
      Close the ReadChannel.
      Specified by:
      close in interface AutoCloseable
      Throws:
      IOException - on error