Class GetReadableBuffer

java.lang.Object
org.apache.arrow.flight.grpc.GetReadableBuffer

public class GetReadableBuffer extends Object
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 Details

    • GetReadableBuffer

      public GetReadableBuffer()
  • Method Details

    • getReadableBuffer

      public static io.grpc.internal.ReadableBuffer getReadableBuffer(InputStream is)
      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 of BUFFER_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 a BUFFER_INPUT_STREAM).
      Throws:
      IOException - if there is an error reading form the stream