Package org.apache.cassandra.io.util
Class UnbufferedDataOutputStreamPlus
java.lang.Object
java.io.OutputStream
org.apache.cassandra.io.util.DataOutputStreamPlus
org.apache.cassandra.io.util.UnbufferedDataOutputStreamPlus
- All Implemented Interfaces:
Closeable,DataOutput,Flushable,AutoCloseable,DataOutputPlus
- Direct Known Subclasses:
WrappedDataOutputStreamPlus
Base class for DataOutput implementations that does not have an optimized implementations of Plus methods
and does no buffering.
Unlike BufferedDataOutputStreamPlus this is capable of operating as an unbuffered output stream. Currently necessary because SequentialWriter implements its own buffering along with mark/reset/truncate.
-
Field Summary
Fields inherited from class org.apache.cassandra.io.util.DataOutputStreamPlus
channel -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotected -
Method Summary
Modifier and TypeMethodDescriptionvoidwrite(byte[] buffer) Writes the entire contents of the byte arraybufferto this RandomAccessFile starting at the current file pointer.abstract voidwrite(byte[] buffer, int offset, int count) Writescountbytes from the byte arraybufferstarting atoffsetto this RandomAccessFile starting at the current file pointer..abstract voidwrite(int oneByte) Writes the specified byteoneByteto this RandomAccessFile starting at the current file pointer.voidwrite(ByteBuffer buf) final voidwriteBoolean(boolean val) Writes a boolean to this output stream.final voidwriteByte(int val) Writes a 8-bit byte to this output stream.final voidwriteBytes(String str) Writes the low order 8-bit bytes from a String to this output stream.final voidwriteChar(int val) Writes the specified 16-bit character to the OutputStream.final voidwriteChars(String str) Writes the specified 16-bit characters contained in str to the OutputStream.final voidwriteDouble(double val) Writes a 64-bit double to this output stream.final voidwriteFloat(float val) Writes a 32-bit float to this output stream.voidwriteInt(int val) Writes a 32-bit int to this output stream.voidwriteLong(long val) Writes a 64-bit long to this output stream.voidwriteShort(int val) Writes the specified 16-bit short to the OutputStream.final voidWrites the specified String out in UTF format.static voidwriteUTF(String str, DataOutput out) Writes the specified String out in UTF format to the provided DataOutputMethods inherited from class org.apache.cassandra.io.util.DataOutputStreamPlus
newDefaultChannel, retrieveTemporaryBufferMethods inherited from class java.io.OutputStream
close, flush, nullOutputStreamMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.cassandra.io.util.DataOutputPlus
bytesLeftInPage, hasPosition, maxBytesInPage, paddedPosition, padToPageBoundary, position, write, writeMostSignificantBytes, writeUnsignedVInt, writeUnsignedVInt, writeUnsignedVInt32, writeVInt, writeVInt, writeVInt32
-
Constructor Details
-
UnbufferedDataOutputStreamPlus
protected UnbufferedDataOutputStreamPlus() -
UnbufferedDataOutputStreamPlus
-
-
Method Details
-
write
Writes the entire contents of the byte arraybufferto this RandomAccessFile starting at the current file pointer.- Specified by:
writein interfaceDataOutput- Overrides:
writein classOutputStream- Parameters:
buffer- the buffer to be written.- Throws:
IOException- If an error occurs trying to write to this RandomAccessFile.
-
write
Writescountbytes from the byte arraybufferstarting atoffsetto this RandomAccessFile starting at the current file pointer..- Specified by:
writein interfaceDataOutput- Overrides:
writein classOutputStream- Parameters:
buffer- the bytes to be writtenoffset- offset in buffer to get bytescount- number of bytes in buffer to write- Throws:
IOException- If an error occurs attempting to write to this RandomAccessFile.IndexOutOfBoundsException- If offset or count are outside of bounds.
-
write
Writes the specified byteoneByteto this RandomAccessFile starting at the current file pointer. Only the low order byte ofoneByteis written.- Specified by:
writein interfaceDataOutput- Specified by:
writein classOutputStream- Parameters:
oneByte- the byte to be written- Throws:
IOException- If an error occurs attempting to write to this RandomAccessFile.
-
writeBoolean
Writes a boolean to this output stream.- Parameters:
val- the boolean value to write to the OutputStream- Throws:
IOException- If an error occurs attempting to write to this DataOutputStream.
-
writeByte
Writes a 8-bit byte to this output stream.- Parameters:
val- the byte value to write to the OutputStream- Throws:
IOException- If an error occurs attempting to write to this DataOutputStream.
-
writeBytes
Writes the low order 8-bit bytes from a String to this output stream.- Parameters:
str- the String containing the bytes to write to the OutputStream- Throws:
IOException- If an error occurs attempting to write to this DataOutputStream.
-
writeChar
Writes the specified 16-bit character to the OutputStream. Only the lower 2 bytes are written with the higher of the 2 bytes written first. This represents the Unicode value of val.- Parameters:
val- the character to be written- Throws:
IOException- If an error occurs attempting to write to this DataOutputStream.
-
writeChars
Writes the specified 16-bit characters contained in str to the OutputStream. Only the lower 2 bytes of each character are written with the higher of the 2 bytes written first. This represents the Unicode value of each character in str.- Parameters:
str- the String whose characters are to be written.- Throws:
IOException- If an error occurs attempting to write to this DataOutputStream.
-
writeDouble
Writes a 64-bit double to this output stream. The resulting output is the 8 bytes resulting from calling Double.doubleToLongBits().- Parameters:
val- the double to be written.- Throws:
IOException- If an error occurs attempting to write to this DataOutputStream.
-
writeFloat
Writes a 32-bit float to this output stream. The resulting output is the 4 bytes resulting from calling Float.floatToIntBits().- Parameters:
val- the float to be written.- Throws:
IOException- If an error occurs attempting to write to this DataOutputStream.
-
writeInt
Writes a 32-bit int to this output stream. The resulting output is the 4 bytes, highest order first, of val.- Parameters:
val- the int to be written.- Throws:
IOException- If an error occurs attempting to write to this DataOutputStream.
-
writeLong
Writes a 64-bit long to this output stream. The resulting output is the 8 bytes, highest order first, of val.- Parameters:
val- the long to be written.- Throws:
IOException- If an error occurs attempting to write to this DataOutputStream.
-
writeShort
Writes the specified 16-bit short to the OutputStream. Only the lower 2 bytes are written with the higher of the 2 bytes written first.- Parameters:
val- the short to be written- Throws:
IOException- If an error occurs attempting to write to this DataOutputStream.
-
writeUTF
Writes the specified String out in UTF format to the provided DataOutput- Parameters:
str- the String to be written in UTF format.out- the DataOutput to write the UTF encoded string to- Throws:
IOException- If an error occurs attempting to write to this DataOutputStream.
-
writeUTF
Writes the specified String out in UTF format.- Parameters:
str- the String to be written in UTF format.- Throws:
IOException- If an error occurs attempting to write to this DataOutputStream.
-
write
- Throws:
IOException
-