Package org.apache.cassandra.streaming
Interface StreamingDataOutputPlus
-
- All Superinterfaces:
java.lang.AutoCloseable
,java.io.Closeable
,java.io.DataOutput
,DataOutputPlus
- All Known Implementing Classes:
AsyncStreamingOutputPlus
,StreamingDataOutputPlusFixed
public interface StreamingDataOutputPlus extends DataOutputPlus, java.io.Closeable
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
StreamingDataOutputPlus.BufferSupplier
static interface
StreamingDataOutputPlus.RateLimiter
static interface
StreamingDataOutputPlus.Write
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
flush()
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.-
Methods inherited from interface java.io.DataOutput
write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
-
Methods inherited from interface org.apache.cassandra.io.util.DataOutputPlus
bytesLeftInPage, hasPosition, maxBytesInPage, paddedPosition, padToPageBoundary, position, write, write, writeMostSignificantBytes, writeUnsignedVInt, writeUnsignedVInt, writeUnsignedVInt32, writeVInt, writeVInt, writeVInt32
-
-
-
-
Method Detail
-
writeToChannel
int writeToChannel(StreamingDataOutputPlus.Write write, StreamingDataOutputPlus.RateLimiter limiter) throws java.io.IOException
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.Any exception thrown by the Write will be propagated to the caller, after any buffer is cleaned up.
- Throws:
java.io.IOException
-
writeFileToChannel
long writeFileToChannel(java.nio.channels.FileChannel file, StreamingDataOutputPlus.RateLimiter limiter) throws java.io.IOException
Writes all data in file channel to stream:
* For zero-copy-streaming, 1MiB at a time, with at most 2MiB in flight at once.
* For streaming with SSL, 64KiB at a time, with at most 32+64KiB (default low water mark + batch size) in flight.
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) orByteBuffer
(ssl) is flushed to the network.- Throws:
java.io.IOException
-
flush
default void flush() throws java.io.IOException
- Throws:
java.io.IOException
-
-