hep.io.xdr
Class XDRRandomAccessFile

java.lang.Object
  |
  +--java.io.RandomAccessFile
        |
        +--hep.io.xdr.XDRRandomAccessFile
All Implemented Interfaces:
java.io.DataInput, java.io.DataOutput, XDRDataInput, XDRDataOutput

public class XDRRandomAccessFile
extends java.io.RandomAccessFile
implements XDRDataInput, XDRDataOutput

A random access file for use with XDR.


Constructor Summary
XDRRandomAccessFile(java.lang.String name, java.lang.String mode)
           
 
Method Summary
 void pad()
          Skips appropriate amount to bring stream to 4-byte boundary.
 double[] readDoubleArray(double[] buffer)
          Reads a double array.
 float[] readFloatArray(float[] buffer)
          Reads a float array.
 int[] readIntArray(int[] buffer)
          Reads an integer array.
 java.lang.String readString()
          Read a String.
 java.lang.String readString(int l)
          Reads a String of length l bytes, and skips appropriate amount to bring stream to 4-byte boundary.
 void writeDoubleArray(double[] array)
           
 void writeDoubleArray(double[] array, int start, int n)
           
 void writeFloatArray(float[] array)
           
 void writeFloatArray(float[] array, int start, int n)
           
 void writeIntArray(int[] array)
           
 void writeIntArray(int[] array, int start, int n)
           
 void writeString(java.lang.String s)
          Write a string preceeded by its (int) length
 void writeStringChars(java.lang.String s)
          Write a string (no length is written)
 
Methods inherited from class java.io.RandomAccessFile
close, getFD, getFilePointer, length, read, read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, seek, setLength, skipBytes, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.io.DataInput
readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, skipBytes
 
Methods inherited from interface java.io.DataOutput
write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
 

Constructor Detail

XDRRandomAccessFile

public XDRRandomAccessFile(java.lang.String name,
                           java.lang.String mode)
                    throws java.io.IOException
Method Detail

writeString

public void writeString(java.lang.String s)
                 throws java.io.IOException
Description copied from interface: XDRDataOutput
Write a string preceeded by its (int) length
Specified by:
writeString in interface XDRDataOutput

writeStringChars

public void writeStringChars(java.lang.String s)
                      throws java.io.IOException
Description copied from interface: XDRDataOutput
Write a string (no length is written)
Specified by:
writeStringChars in interface XDRDataOutput

pad

public void pad()
         throws java.io.IOException
Description copied from interface: XDRDataInput
Skips appropriate amount to bring stream to 4-byte boundary.
Specified by:
pad in interface XDRDataInput

writeIntArray

public void writeIntArray(int[] array)
                   throws java.io.IOException
Specified by:
writeIntArray in interface XDRDataOutput

writeIntArray

public void writeIntArray(int[] array,
                          int start,
                          int n)
                   throws java.io.IOException
Specified by:
writeIntArray in interface XDRDataOutput

writeDoubleArray

public void writeDoubleArray(double[] array)
                      throws java.io.IOException
Specified by:
writeDoubleArray in interface XDRDataOutput

writeDoubleArray

public void writeDoubleArray(double[] array,
                             int start,
                             int n)
                      throws java.io.IOException
Specified by:
writeDoubleArray in interface XDRDataOutput

writeFloatArray

public void writeFloatArray(float[] array)
                     throws java.io.IOException
Specified by:
writeFloatArray in interface XDRDataOutput

writeFloatArray

public void writeFloatArray(float[] array,
                            int start,
                            int n)
                     throws java.io.IOException
Specified by:
writeFloatArray in interface XDRDataOutput

readString

public java.lang.String readString(int l)
                            throws java.io.IOException
Description copied from interface: XDRDataInput
Reads a String of length l bytes, and skips appropriate amount to bring stream to 4-byte boundary.
Specified by:
readString in interface XDRDataInput

readString

public java.lang.String readString()
                            throws java.io.IOException
Description copied from interface: XDRDataInput
Read a String. Assumes int length proceeds String. Throws an exception if string length > 32767 to protect against bad data exhausting memory.
Specified by:
readString in interface XDRDataInput

readIntArray

public int[] readIntArray(int[] buffer)
                   throws java.io.IOException
Description copied from interface: XDRDataInput
Reads an integer array. Assumes int length proceeds array. Throws an exception if array length > 32767 to protect against bad data exhausting memory. If buffer is not null, and is large enough to hold array, it is filled and returned, otherwise a new array is allocated and returned.
Specified by:
readIntArray in interface XDRDataInput

readDoubleArray

public double[] readDoubleArray(double[] buffer)
                         throws java.io.IOException
Description copied from interface: XDRDataInput
Reads a double array. Assumes int length proceeds array. Throws an exception if array length > 32767 to protect against bad data exhausting memory. If buffer is not null, and is large enough to hold array, it is filled and returned, otherwise a new array is allocated and returned.
Specified by:
readDoubleArray in interface XDRDataInput

readFloatArray

public float[] readFloatArray(float[] buffer)
                       throws java.io.IOException
Description copied from interface: XDRDataInput
Reads a float array. Assumes int length proceeds array. Throws an exception if array length > 32767 to protect against bad data exhausting memory. If buffer is not null, and is large enough to hold array, it is filled and returned, otherwise a new array is allocated and returned.
Specified by:
readFloatArray in interface XDRDataInput