org.apache.cassandra.io.util
Class AbstractDataOutput

java.lang.Object
  extended by java.io.OutputStream
      extended by org.apache.cassandra.io.util.AbstractDataOutput
All Implemented Interfaces:
java.io.Closeable, java.io.DataOutput, java.io.Flushable
Direct Known Subclasses:
EncodedDataOutputStream

public abstract class AbstractDataOutput
extends java.io.OutputStream
implements java.io.DataOutput


Constructor Summary
AbstractDataOutput()
           
 
Method Summary
 void write(byte[] buffer)
          Writes the entire contents of the byte array buffer to this RandomAccessFile starting at the current file pointer.
abstract  void write(byte[] buffer, int offset, int count)
          Writes count bytes from the byte array buffer starting at offset to this RandomAccessFile starting at the current file pointer..
abstract  void write(int oneByte)
          Writes the specified byte oneByte to this RandomAccessFile starting at the current file pointer.
 void writeBoolean(boolean val)
          Writes a boolean to this output stream.
 void writeByte(int val)
          Writes a 8-bit byte to this output stream.
 void writeBytes(java.lang.String str)
          Writes the low order 8-bit bytes from a String to this output stream.
 void writeChar(int val)
          Writes the specified 16-bit character to the OutputStream.
 void writeChars(java.lang.String str)
          Writes the specified 16-bit characters contained in str to the OutputStream.
 void writeDouble(double val)
          Writes a 64-bit double to this output stream.
 void writeFloat(float val)
          Writes a 32-bit float to this output stream.
 void writeInt(int val)
          Writes a 32-bit int to this output stream.
 void writeLong(long val)
          Writes a 64-bit long to this output stream.
 void writeShort(int val)
          Writes the specified 16-bit short to the OutputStream.
 void writeUTF(java.lang.String str)
          Writes the specified String out in UTF format.
 
Methods inherited from class java.io.OutputStream
close, flush
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDataOutput

public AbstractDataOutput()
Method Detail

write

public void write(byte[] buffer)
           throws java.io.IOException
Writes the entire contents of the byte array buffer to this RandomAccessFile starting at the current file pointer.

Specified by:
write in interface java.io.DataOutput
Overrides:
write in class java.io.OutputStream
Parameters:
buffer - the buffer to be written.
Throws:
java.io.IOException - If an error occurs trying to write to this RandomAccessFile.

write

public abstract void write(byte[] buffer,
                           int offset,
                           int count)
                    throws java.io.IOException
Writes count bytes from the byte array buffer starting at offset to this RandomAccessFile starting at the current file pointer..

Specified by:
write in interface java.io.DataOutput
Overrides:
write in class java.io.OutputStream
Parameters:
buffer - the bytes to be written
offset - offset in buffer to get bytes
count - number of bytes in buffer to write
Throws:
java.io.IOException - If an error occurs attempting to write to this RandomAccessFile.
java.lang.IndexOutOfBoundsException - If offset or count are outside of bounds.

write

public abstract void write(int oneByte)
                    throws java.io.IOException
Writes the specified byte oneByte to this RandomAccessFile starting at the current file pointer. Only the low order byte of oneByte is written.

Specified by:
write in interface java.io.DataOutput
Specified by:
write in class java.io.OutputStream
Parameters:
oneByte - the byte to be written
Throws:
java.io.IOException - If an error occurs attempting to write to this RandomAccessFile.

writeBoolean

public final void writeBoolean(boolean val)
                        throws java.io.IOException
Writes a boolean to this output stream.

Specified by:
writeBoolean in interface java.io.DataOutput
Parameters:
val - the boolean value to write to the OutputStream
Throws:
java.io.IOException - If an error occurs attempting to write to this DataOutputStream.

writeByte

public final void writeByte(int val)
                     throws java.io.IOException
Writes a 8-bit byte to this output stream.

Specified by:
writeByte in interface java.io.DataOutput
Parameters:
val - the byte value to write to the OutputStream
Throws:
java.io.IOException - If an error occurs attempting to write to this DataOutputStream.

writeBytes

public final void writeBytes(java.lang.String str)
                      throws java.io.IOException
Writes the low order 8-bit bytes from a String to this output stream.

Specified by:
writeBytes in interface java.io.DataOutput
Parameters:
str - the String containing the bytes to write to the OutputStream
Throws:
java.io.IOException - If an error occurs attempting to write to this DataOutputStream.

writeChar

public final void writeChar(int val)
                     throws java.io.IOException
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.

Specified by:
writeChar in interface java.io.DataOutput
Parameters:
val - the character to be written
Throws:
java.io.IOException - If an error occurs attempting to write to this DataOutputStream.

writeChars

public final void writeChars(java.lang.String str)
                      throws java.io.IOException
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.

Specified by:
writeChars in interface java.io.DataOutput
Parameters:
str - the String whose characters are to be written.
Throws:
java.io.IOException - If an error occurs attempting to write to this DataOutputStream.

writeDouble

public final void writeDouble(double val)
                       throws java.io.IOException
Writes a 64-bit double to this output stream. The resulting output is the 8 bytes resulting from calling Double.doubleToLongBits().

Specified by:
writeDouble in interface java.io.DataOutput
Parameters:
val - the double to be written.
Throws:
java.io.IOException - If an error occurs attempting to write to this DataOutputStream.

writeFloat

public final void writeFloat(float val)
                      throws java.io.IOException
Writes a 32-bit float to this output stream. The resulting output is the 4 bytes resulting from calling Float.floatToIntBits().

Specified by:
writeFloat in interface java.io.DataOutput
Parameters:
val - the float to be written.
Throws:
java.io.IOException - If an error occurs attempting to write to this DataOutputStream.

writeInt

public void writeInt(int val)
              throws java.io.IOException
Writes a 32-bit int to this output stream. The resulting output is the 4 bytes, highest order first, of val.

Specified by:
writeInt in interface java.io.DataOutput
Parameters:
val - the int to be written.
Throws:
java.io.IOException - If an error occurs attempting to write to this DataOutputStream.

writeLong

public void writeLong(long val)
               throws java.io.IOException
Writes a 64-bit long to this output stream. The resulting output is the 8 bytes, highest order first, of val.

Specified by:
writeLong in interface java.io.DataOutput
Parameters:
val - the long to be written.
Throws:
java.io.IOException - If an error occurs attempting to write to this DataOutputStream.

writeShort

public void writeShort(int val)
                throws java.io.IOException
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.

Specified by:
writeShort in interface java.io.DataOutput
Parameters:
val - the short to be written
Throws:
java.io.IOException - If an error occurs attempting to write to this DataOutputStream.

writeUTF

public final void writeUTF(java.lang.String str)
                    throws java.io.IOException
Writes the specified String out in UTF format.

Specified by:
writeUTF in interface java.io.DataOutput
Parameters:
str - the String to be written in UTF format.
Throws:
java.io.IOException - If an error occurs attempting to write to this DataOutputStream.


Copyright © 2012 The Apache Software Foundation