public class StreamingDataOutputPlusFixed extends DataOutputBufferFixed implements StreamingDataOutputPlus
StreamingDataOutputPlus.BufferSupplier, StreamingDataOutputPlus.RateLimiter, StreamingDataOutputPlus.Write
scratchBuffer
buffer
channel
Constructor and Description |
---|
StreamingDataOutputPlusFixed(java.nio.ByteBuffer buffer) |
Modifier and Type | Method and Description |
---|---|
long |
writeFileToChannel(java.nio.channels.FileChannel file,
StreamingDataOutputPlus.RateLimiter limiter)
Writes all data in file channel to stream:
* For zero-copy-streaming, 1MiB at a time, with at most 2MiB in flight at once. |
int |
writeToChannel(StreamingDataOutputPlus.Write write,
StreamingDataOutputPlus.RateLimiter limiter)
Provide a lambda that can request a buffer of suitable size, then fill the buffer and have
that buffer written and flushed to the underlying channel, without having to handle buffer
allocation, lifetime or cleanup, including in case of exceptions.
|
clear, doFlush, expandToFit
asNewBuffer, buffer, buffer, close, flush, getData, getLength, hasPosition, newDefaultChannel, position, toByteArray
order, write, write, write, write, writeBoolean, writeByte, writeBytes, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
retrieveTemporaryBuffer
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
flush
hasPosition, position, write, write, writeBytes, writeUnsignedVInt, writeVInt
public StreamingDataOutputPlusFixed(java.nio.ByteBuffer buffer)
public int writeToChannel(StreamingDataOutputPlus.Write write, StreamingDataOutputPlus.RateLimiter limiter) throws java.io.IOException
StreamingDataOutputPlus
Any exception thrown by the Write will be propagated to the caller, after any buffer is cleaned up.
writeToChannel
in interface StreamingDataOutputPlus
java.io.IOException
public long writeFileToChannel(java.nio.channels.FileChannel file, StreamingDataOutputPlus.RateLimiter limiter) throws java.io.IOException
StreamingDataOutputPlus
This method takes ownership of the provided FileChannel
.
WARNING: this method blocks only for permission to write to the netty channel; it exits before
the FileRegion
(zero-copy) or ByteBuffer
(ssl) is flushed to the network.
writeFileToChannel
in interface StreamingDataOutputPlus
java.io.IOException
Copyright © 2009- The Apache Software Foundation