edu.iris.Fissures.seed.builder
Class XdrOutput

java.lang.Object
  extended by edu.iris.Fissures.seed.builder.XdrOutput

public class XdrOutput
extends java.lang.Object

Concrete Builder class for writing data in the XDR format.


Constructor Summary
XdrOutput(int bufferSize)
          Constructs a new XdrOutput with a given buffer.
 
Method Summary
 byte[] getXdrData()
          Returns the buffer holding encoded data.
 int getXdrLength()
          Returns the amount of encoded data in the buffer.
 boolean xdr_array(float[] arr)
          Encode the array of floats.
 boolean xdr_bytes(java.lang.String s, int maxlength)
          Encode the string.
 boolean xdr_double(double n)
          Encode the double value.
 boolean xdr_float(float n)
          Encode the float value.
 boolean xdr_int(int n)
          Encode the int value.
 boolean xdr_long(long n)
          Encode the long value.
 boolean xdr_short(short n)
          Encode the short value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XdrOutput

public XdrOutput(int bufferSize)
Constructs a new XdrOutput with a given buffer.

Parameters:
bufferSize - Size of buffer to store encoded data in.
Throws:
java.lang.IllegalArgumentException - if bufferSize is not a multiple of four.
Method Detail

getXdrData

public byte[] getXdrData()
Returns the buffer holding encoded data.

Returns:
Buffer with encoded data.

getXdrLength

public int getXdrLength()
Returns the amount of encoded data in the buffer.

Returns:
length of data encoded in buffer.

xdr_array

public boolean xdr_array(float[] arr)
Encode the array of floats.

Parameters:
arr - the array of floats.
Returns:
true if successful.

xdr_bytes

public boolean xdr_bytes(java.lang.String s,
                         int maxlength)
Encode the string.

Parameters:
s - the string.
maxlength - the maximum length of the string.
Returns:
true if successful.

xdr_double

public boolean xdr_double(double n)
Encode the double value.

Parameters:
n - the double value.
Returns:
true if successful.

xdr_float

public boolean xdr_float(float n)
Encode the float value.

Parameters:
n - the float value.
Returns:
true if successful.

xdr_int

public boolean xdr_int(int n)
Encode the int value.

Parameters:
n - the int value.
Returns:
true if successful.

xdr_long

public boolean xdr_long(long n)
Encode the long value.

Parameters:
n - the long value.
Returns:
true if successful.

xdr_short

public boolean xdr_short(short n)
Encode the short value.

Parameters:
n - the short value.
Returns:
true if successful.