Package org.apache.cassandra.streaming
Class StreamingDataOutputPlusFixed
- java.lang.Object
-
- java.io.OutputStream
-
- org.apache.cassandra.io.util.DataOutputStreamPlus
-
- org.apache.cassandra.io.util.BufferedDataOutputStreamPlus
-
- org.apache.cassandra.io.util.DataOutputBuffer
-
- org.apache.cassandra.io.util.DataOutputBufferFixed
-
- org.apache.cassandra.streaming.StreamingDataOutputPlusFixed
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.DataOutput
,java.io.Flushable
,java.lang.AutoCloseable
,DataOutputPlus
,StreamingDataOutputPlus
public class StreamingDataOutputPlusFixed extends DataOutputBufferFixed implements StreamingDataOutputPlus
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.cassandra.streaming.StreamingDataOutputPlus
StreamingDataOutputPlus.BufferSupplier, StreamingDataOutputPlus.RateLimiter, StreamingDataOutputPlus.Write
-
-
Field Summary
-
Fields inherited from class org.apache.cassandra.io.util.DataOutputBuffer
scratchBuffer
-
Fields inherited from class org.apache.cassandra.io.util.BufferedDataOutputStreamPlus
buffer
-
Fields inherited from class org.apache.cassandra.io.util.DataOutputStreamPlus
channel
-
-
Constructor Summary
Constructors Constructor Description StreamingDataOutputPlusFixed(java.nio.ByteBuffer buffer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.-
Methods inherited from class org.apache.cassandra.io.util.DataOutputBufferFixed
clear, doFlush, expandToFit
-
Methods inherited from class org.apache.cassandra.io.util.DataOutputBuffer
asNewBuffer, asString, buffer, buffer, close, flush, getData, getLength, hasPosition, newDefaultChannel, position, setBuffer, toByteArray, unsafeGetBufferAndFlip
-
Methods inherited from class org.apache.cassandra.io.util.BufferedDataOutputStreamPlus
allocate, order, write, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeMostSignificantBytes, writeShort, writeUTF
-
Methods inherited from class org.apache.cassandra.io.util.DataOutputStreamPlus
retrieveTemporaryBuffer
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
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
-
Methods inherited from interface org.apache.cassandra.streaming.StreamingDataOutputPlus
flush
-
-
-
-
Method Detail
-
writeToChannel
public int writeToChannel(StreamingDataOutputPlus.Write write, StreamingDataOutputPlus.RateLimiter limiter) throws java.io.IOException
Description copied from interface:StreamingDataOutputPlus
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.
- Specified by:
writeToChannel
in interfaceStreamingDataOutputPlus
- Throws:
java.io.IOException
-
writeFileToChannel
public long writeFileToChannel(java.nio.channels.FileChannel file, StreamingDataOutputPlus.RateLimiter limiter) throws java.io.IOException
Description copied from interface:StreamingDataOutputPlus
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.- Specified by:
writeFileToChannel
in interfaceStreamingDataOutputPlus
- Throws:
java.io.IOException
-
-