galaxy.io
Class XdrOutBuffer

java.lang.Object
  |
  +--galaxy.io.XdrOutBuffer

public class XdrOutBuffer
extends java.lang.Object

This class writes data to a XDR-encoded byte array.


Field Summary
static int FALSE
          Integer value of "false".
static int TRUE
          Integer value of "true".
 
Constructor Summary
XdrOutBuffer()
          Constructor.
 
Method Summary
 byte[] getOutBuffer()
          Returns the contents of this buffer as a byte array.
 void writeBoolean(boolean booleanValue)
          Writes a Java boolean value to the output buffer.
 boolean writeBoolean(int booleanValue)
          Writes an integer boolean value to the output buffer.
 void writeDouble(double doubleValue)
          Writes a 64-bit floating point value to the output buffer.
 void writeDoubleArray(double[] doubleArray)
          Writes an array of 64-bit floating point numbers to the buffer.
 void writeEnumeration(int enumeratedValue)
          Writes an enumerated type value to the output buffer.
 void writeFixedLengthOpaqueData(byte[] bytes)
          Writes an opaque (i.e., uninterpreted) array of bytes to the output buffer.
 void writeFloat(float floatValue)
          Writes a 32-bit floating point value to the output buffer.
 void writeFloatArray(float[] floatArray)
          Writes an array of 32-bit floating point numbers to the buffer.
 void writeInteger(int intValue)
          Writes a 32-bit signed integer value to the output buffer.
 void writeIntegerArray(int[] intArray)
          Writes an array of 32-bit integers to the buffer.
 void writeLong(long longValue)
          Writes a 64-bit signed integer value to the output buffer.
 void writeLongArray(long[] longArray)
          Writes an array of 64-bit integers to the buffer.
 void writeShortArray(short[] shortArray)
          Writes an array of 16-bit integers to the buffer.
 void writeString(java.lang.String stringValue)
          Writes a string to the output buffer.
 void writeVariableLengthOpaqueData(byte[] bytes)
          Writes an opaque (i.e., uninterpreted) array of bytes to the output buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FALSE

public static final int FALSE
Integer value of "false".

TRUE

public static final int TRUE
Integer value of "true".
Constructor Detail

XdrOutBuffer

public XdrOutBuffer()
Constructor.
Method Detail

getOutBuffer

public byte[] getOutBuffer()
Returns the contents of this buffer as a byte array.
Returns:
the byte array

writeInteger

public void writeInteger(int intValue)
                  throws java.io.IOException
Writes a 32-bit signed integer value to the output buffer.
Parameters:
intValue - the integer value
Throws:
java.io.IOException - if an I/O error occurs

writeEnumeration

public void writeEnumeration(int enumeratedValue)
                      throws java.io.IOException
Writes an enumerated type value to the output buffer.
Parameters:
enumeratedValue - the enumerated type value
Throws:
java.io.IOException - if an I/O error occurs

writeBoolean

public void writeBoolean(boolean booleanValue)
                  throws java.io.IOException
Writes a Java boolean value to the output buffer.
Parameters:
booleanValue - the boolean value
Throws:
java.io.IOException - if an I/O error occurs

writeBoolean

public boolean writeBoolean(int booleanValue)
                     throws java.io.IOException
Writes an integer boolean value to the output buffer.
Parameters:
booleanValue - the boolean value
Returns:
false if the boolean value is not 0 or 1, true otherwise
Throws:
java.io.IOException - if an I/O error occurs

writeLong

public void writeLong(long longValue)
               throws java.io.IOException
Writes a 64-bit signed integer value to the output buffer.
Parameters:
longValue - the integer value
Throws:
java.io.IOException - if an I/O error occurs

writeFloat

public void writeFloat(float floatValue)
                throws java.io.IOException
Writes a 32-bit floating point value to the output buffer.
Parameters:
floatValue - the floating point value
Throws:
java.io.IOException - if an I/O error occurs

writeDouble

public void writeDouble(double doubleValue)
                 throws java.io.IOException
Writes a 64-bit floating point value to the output buffer.
Parameters:
doubleValue - the floating point value
Throws:
java.io.IOException - if an I/O error occurs

writeFixedLengthOpaqueData

public void writeFixedLengthOpaqueData(byte[] bytes)
                                throws java.io.IOException
Writes an opaque (i.e., uninterpreted) array of bytes to the output buffer. Pad bytes (i.e., value of 0) are appended to the output to ensure that the total number of bytes written to the output buffer is a multiple of four.
Parameters:
bytes - the byte array
Throws:
java.io.IOException - if an I/O error occurs

writeVariableLengthOpaqueData

public void writeVariableLengthOpaqueData(byte[] bytes)
                                   throws java.io.IOException
Writes an opaque (i.e., uninterpreted) array of bytes to the output buffer. Four bytes, with the 32-bit unsigned integer value of the length of the byte array, are first written to the output buffer. Pad bytes (i.e., value of 0) are appended to the output to ensure that the total number of bytes written to the output buffer is a multiple of four.
Parameters:
bytes - the byte array
Throws:
java.io.IOException - if an I/O error occurs

writeString

public void writeString(java.lang.String stringValue)
                 throws java.io.UnsupportedEncodingException,
                        java.io.IOException
Writes a string to the output buffer. Four bytes, with the 32-bit unsigned integer value of the length of the byte array, are first written to the output buffer. Pad bytes (i.e., value of 0) are appended to the output to ensure that the total number of bytes written to the output buffer is a multiple of four.
Parameters:
stringValue - the string
Throws:
java.io.UnsupportedEncodingException - if the string encoding format (ISO-8859-1) is not available on the local platform
java.io.IOException - if an I/O error occurs

writeShortArray

public void writeShortArray(short[] shortArray)
                     throws java.io.IOException
Writes an array of 16-bit integers to the buffer. The length of the array is written first as a 32-bit integer.
Parameters:
shortArray - the array

writeIntegerArray

public void writeIntegerArray(int[] intArray)
                       throws java.io.IOException
Writes an array of 32-bit integers to the buffer. The length of the array is written first as a 32-bit integer.
Parameters:
intArray - the array

writeLongArray

public void writeLongArray(long[] longArray)
                    throws java.io.IOException
Writes an array of 64-bit integers to the buffer. The length of the array is written first as a 32-bit integer.
Parameters:
longArray - the array

writeFloatArray

public void writeFloatArray(float[] floatArray)
                     throws java.io.IOException
Writes an array of 32-bit floating point numbers to the buffer. The length of the array is written first as a 32-bit integer.
Parameters:
floatArray - the array

writeDoubleArray

public void writeDoubleArray(double[] doubleArray)
                      throws java.io.IOException
Writes an array of 64-bit floating point numbers to the buffer. The length of the array is written first as a 32-bit integer.
Parameters:
doubleArray - the array