Class MessageChannelReader
java.lang.Object
org.apache.arrow.vector.ipc.message.MessageChannelReader
- All Implemented Interfaces:
AutoCloseable
Reads a sequence of messages using a ReadChannel.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionMessageChannelReader
(ReadChannel in, BufferAllocator allocator) Construct a MessageReader to read streaming messages from an existing ReadChannel. -
Method Summary
-
Field Details
-
in
-
allocator
-
-
Constructor Details
-
MessageChannelReader
Construct a MessageReader to read streaming messages from an existing ReadChannel.- Parameters:
in
- Channel to read messages fromallocator
- BufferAllocator used to read Message body into an ArrowBuf.
-
-
Method Details
-
readNext
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
Close the ReadChannel.- Specified by:
close
in interfaceAutoCloseable
- Throws:
IOException
- on error
-