Package org.apache.cassandra.io.util
Class BufferedDataOutputStreamPlus
- java.lang.Object
-
- java.io.OutputStream
-
- org.apache.cassandra.io.util.DataOutputStreamPlus
-
- org.apache.cassandra.io.util.BufferedDataOutputStreamPlus
-
- All Implemented Interfaces:
java.io.Closeable,java.io.DataOutput,java.io.Flushable,java.lang.AutoCloseable,DataOutputPlus
- Direct Known Subclasses:
AsyncChannelOutputPlus,DataOutputBuffer,FileOutputStreamPlus,SequentialWriter
public class BufferedDataOutputStreamPlus extends DataOutputStreamPlus
An implementation of the DataOutputStreamPlus interface using a ByteBuffer to stage writes before flushing them to an underlying channel. This class is completely thread unsafe.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.nio.ByteBufferbuffer-
Fields inherited from class org.apache.cassandra.io.util.DataOutputStreamPlus
channel
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedBufferedDataOutputStreamPlus(java.nio.ByteBuffer buffer)BufferedDataOutputStreamPlus(java.nio.channels.WritableByteChannel wbc)BufferedDataOutputStreamPlus(java.nio.channels.WritableByteChannel wbc, int bufferSize)BufferedDataOutputStreamPlus(java.nio.channels.WritableByteChannel channel, java.nio.ByteBuffer buffer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()protected voiddoFlush(int count)voidflush()BufferedDataOutputStreamPlusorder(java.nio.ByteOrder order)voidwrite(byte[] b)voidwrite(byte[] b, int off, int len)voidwrite(int b)voidwrite(java.nio.ByteBuffer src)voidwriteBoolean(boolean v)voidwriteByte(int v)voidwriteBytes(long register, int bytes)An efficient way to write the typebytesof a longvoidwriteBytes(java.lang.String s)voidwriteChar(int v)voidwriteChars(java.lang.String s)voidwriteDouble(double v)voidwriteFloat(float v)voidwriteInt(int v)voidwriteLong(long v)voidwriteShort(int v)voidwriteUTF(java.lang.String s)-
Methods inherited from class org.apache.cassandra.io.util.DataOutputStreamPlus
newDefaultChannel, retrieveTemporaryBuffer
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.cassandra.io.util.DataOutputPlus
hasPosition, position, write, writeUnsignedVInt, writeVInt
-
-
-
-
Constructor Detail
-
BufferedDataOutputStreamPlus
public BufferedDataOutputStreamPlus(java.nio.channels.WritableByteChannel wbc)
-
BufferedDataOutputStreamPlus
public BufferedDataOutputStreamPlus(java.nio.channels.WritableByteChannel wbc, int bufferSize)
-
BufferedDataOutputStreamPlus
public BufferedDataOutputStreamPlus(java.nio.channels.WritableByteChannel channel, java.nio.ByteBuffer buffer)
-
BufferedDataOutputStreamPlus
protected BufferedDataOutputStreamPlus(java.nio.ByteBuffer buffer)
-
-
Method Detail
-
write
public void write(byte[] b) throws java.io.IOException- Specified by:
writein interfacejava.io.DataOutput- Overrides:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
write
public void write(byte[] b, int off, int len) throws java.io.IOException- Specified by:
writein interfacejava.io.DataOutput- Overrides:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
write
public void write(java.nio.ByteBuffer src) throws java.io.IOException- Throws:
java.io.IOException
-
write
public void write(int b) throws java.io.IOException- Specified by:
writein interfacejava.io.DataOutput- Specified by:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
writeBoolean
public void writeBoolean(boolean v) throws java.io.IOException- Throws:
java.io.IOException
-
writeByte
public void writeByte(int v) throws java.io.IOException- Throws:
java.io.IOException
-
writeBytes
public void writeBytes(long register, int bytes) throws java.io.IOExceptionDescription copied from interface:DataOutputPlusAn 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:
java.io.IOException
-
writeShort
public void writeShort(int v) throws java.io.IOException- Throws:
java.io.IOException
-
writeChar
public void writeChar(int v) throws java.io.IOException- Throws:
java.io.IOException
-
writeInt
public void writeInt(int v) throws java.io.IOException- Throws:
java.io.IOException
-
writeLong
public void writeLong(long v) throws java.io.IOException- Throws:
java.io.IOException
-
writeFloat
public void writeFloat(float v) throws java.io.IOException- Throws:
java.io.IOException
-
writeDouble
public void writeDouble(double v) throws java.io.IOException- Throws:
java.io.IOException
-
writeBytes
public void writeBytes(java.lang.String s) throws java.io.IOException- Throws:
java.io.IOException
-
writeChars
public void writeChars(java.lang.String s) throws java.io.IOException- Throws:
java.io.IOException
-
writeUTF
public void writeUTF(java.lang.String s) throws java.io.IOException- Throws:
java.io.IOException
-
doFlush
@DontInline protected void doFlush(int count) throws java.io.IOException- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException- Specified by:
flushin interfacejava.io.Flushable- Overrides:
flushin classjava.io.OutputStream- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.OutputStream- Throws:
java.io.IOException
-
order
public BufferedDataOutputStreamPlus order(java.nio.ByteOrder order)
-
-