Package org.apache.cassandra.io.util
Interface DataOutputPlus
- All Superinterfaces:
DataOutput
- All Known Subinterfaces:
StreamingDataOutputPlus
- All Known Implementing Classes:
AsyncChannelOutputPlus,AsyncMessageOutputPlus,AsyncStreamingOutputPlus,BufferedDataOutputStreamPlus,ChecksummedSequentialWriter,CompressedSequentialWriter,DataOutputBuffer,DataOutputBufferFixed,DataOutputStreamPlus,FileOutputStreamPlus,SafeMemoryWriter,SequentialWriter,StreamingDataOutputPlusFixed,UnbufferedDataOutputStreamPlus,WrappedDataOutputStreamPlus
Extension to DataOutput that provides for writing ByteBuffer and Memory, potentially with an efficient
implementation that is zero copy or at least has reduced bounds checking overhead.
-
Method Summary
Modifier and TypeMethodDescriptiondefault intReturns how many bytes are left in the page.default booleanIf the implementation supports providing a position, this method returnstrue, otherwisefalse.default intReturns the number of bytes that a page can take at maximum.default longReturns the next padded position.default voidPad this with zeroes until the next page boundary.default longposition()Returns the current position of the underlying target like a file-pointer or the position withing a buffer.voidwrite(ByteBuffer buffer) default voidwrite(ReadableMemory memory, long offset, long length) default voidwriteMostSignificantBytes(long register, int bytes) An efficient way to write the typebytesof a longdefault voidwriteUnsignedVInt(int i) Deprecated.See CASSANDRA-18099default voidwriteUnsignedVInt(long i) This is more efficient for storing unsigned values, both in storage and CPU burden.default voidwriteUnsignedVInt32(int i) default voidwriteVInt(int i) Deprecated.See CASSANDRA-18099default voidwriteVInt(long i) default voidwriteVInt32(int i) Methods inherited from interface java.io.DataOutput
write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
-
Method Details
-
write
- Throws:
IOException
-
write
- Throws:
IOException
-
writeVInt
- Throws:
IOException
-
writeVInt
Deprecated.See CASSANDRA-18099 -
writeVInt32
- Throws:
IOException
-
writeUnsignedVInt
This is more efficient for storing unsigned values, both in storage and CPU burden. Note that it is still possible to store negative values, they just take up more space. So this method doesn't forbid e.g. negative sentinel values in future, if they need to be snuck in. A protocol version bump can then be introduced to improve efficiency.- Throws:
IOException
-
writeUnsignedVInt
Deprecated.See CASSANDRA-18099 -
writeUnsignedVInt32
- Throws:
IOException
-
writeMostSignificantBytes
An efficient way to write the typebytesof a long- Parameters:
register- - the long value to be writtenbytes- - the number of bytes the register occupies. Valid values are between 1 and 8 inclusive.- Throws:
IOException
-
position
default long position()Returns the current position of the underlying target like a file-pointer or the position withing a buffer. Not every implementation may support this functionality. Whether or not this functionality is supported can be checked via thehasPosition().- Throws:
UnsupportedOperationException- if the implementation does not support position
-
hasPosition
default boolean hasPosition()If the implementation supports providing a position, this method returnstrue, otherwisefalse. -
maxBytesInPage
default int maxBytesInPage()Returns the number of bytes that a page can take at maximum. -
padToPageBoundary
Pad this with zeroes until the next page boundary. If the destination position is already at a page boundary, do not do anything.- Throws:
IOException
-
bytesLeftInPage
default int bytesLeftInPage()Returns how many bytes are left in the page. -
paddedPosition
default long paddedPosition()Returns the next padded position. This is either the current position (if already padded), or the start of next page.
-