Package org.apache.arrow.flight.grpc
Class GetReadableBuffer
java.lang.Object
org.apache.arrow.flight.grpc.GetReadableBuffer
Enable access to ReadableBuffer directly to copy data from a BufferInputStream into a target
ByteBuffer/ByteBuf.
This could be solved by BufferInputStream exposing Drainable.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic io.grpc.internal.ReadableBuffer
Extracts the ReadableBuffer for the given input stream.static void
readIntoBuffer
(InputStream stream, ArrowBuf buf, int size, boolean fastPath) Helper method to read a gRPC-provided InputStream into an ArrowBuf.
-
Constructor Details
-
GetReadableBuffer
public GetReadableBuffer()
-
-
Method Details
-
getReadableBuffer
Extracts the ReadableBuffer for the given input stream.- Parameters:
is
- Must be an instance of io.grpc.internal.ReadableBuffers$BufferInputStream or null will be returned.
-
readIntoBuffer
public static void readIntoBuffer(InputStream stream, ArrowBuf buf, int size, boolean fastPath) throws IOException Helper method to read a gRPC-provided InputStream into an ArrowBuf.- Parameters:
stream
- The stream to read from. Should be an instance ofBUFFER_INPUT_STREAM
.buf
- The buffer to read into.size
- The number of bytes to read.fastPath
- Whether to enable the fast path (i.e. detect whether the stream is aBUFFER_INPUT_STREAM
).- Throws:
IOException
- if there is an error reading form the stream
-