Package org.apache.arrow.flight.grpc
Class AddWritableBuffer
java.lang.Object
org.apache.arrow.flight.grpc.AddWritableBuffer
Allow a user to add a ByteBuf based InputStream directly into GRPC WritableBuffer to avoid an
extra copy. This could be solved in GRPC by adding a ByteBufListable interface on InputStream and
letting BufferChainOutputStream take advantage of it.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
add
(io.netty.buffer.ByteBuf buf, OutputStream stream, boolean tryZeroCopy) Add the provided ByteBuf to the gRPC BufferChainOutputStream if possible, else copy the buffer to the stream.
-
Constructor Details
-
AddWritableBuffer
public AddWritableBuffer()
-
-
Method Details
-
add
public static boolean add(io.netty.buffer.ByteBuf buf, OutputStream stream, boolean tryZeroCopy) throws IOException Add the provided ByteBuf to the gRPC BufferChainOutputStream if possible, else copy the buffer to the stream.- Parameters:
buf
- The buffer to add.stream
- The Candidate OutputStream to add to.tryZeroCopy
- If true, try to zero-copy append the buffer to the stream. This may not succeed.- Returns:
- True if buffer was zero-copy added to the stream. False if the buffer was copied.
- Throws:
IOException
- if the fast path is not enabled and there was an error copying the buffer to the stream.
-