FreeHEP API
Version current

hep.io.xdr
Interface XDRDataInput

All Superinterfaces:
DataInput
All Known Implementing Classes:
XDRInputStream, XDRRandomAccessFile

public interface XDRDataInput
extends DataInput

An interface implemented by input streams that support XDR. The XDR format is almost identical to the normal Java DataInput format, except that items are padded to 4 byte boundaries, and strings are normally stored in ASCII format.

Version:
$Id: XDRDataInput.java,v 1.3 2003/09/16 23:11:55 tonyj Exp $
Author:
Tony Johnson (tonyj@slac.stanford.edu)
Source Code:
XDRDataInput.java

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.
 String readString()
          Read a String.
 String readString(int l)
          Reads a String of length l bytes, and skips appropriate amount to bring stream to 4-byte boundary.
 
Methods inherited from interface java.io.DataInput
readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, skipBytes
 

Method Detail

pad

public void pad()
         throws IOException
Skips appropriate amount to bring stream to 4-byte boundary.

Throws:
IOException

readDoubleArray

public double[] readDoubleArray(double[] buffer)
                         throws IOException
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.

Throws:
IOException

readFloatArray

public float[] readFloatArray(float[] buffer)
                       throws IOException
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.

Throws:
IOException

readIntArray

public int[] readIntArray(int[] buffer)
                   throws IOException
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.

Throws:
IOException

readString

public String readString()
                  throws IOException
Read a String. Assumes int length proceeds String. Throws an exception if string length > 32767 to protect against bad data exhausting memory.

Throws:
IOException

readString

public String readString(int l)
                  throws IOException
Reads a String of length l bytes, and skips appropriate amount to bring stream to 4-byte boundary.

Throws:
IOException

FreeHEP API
Version current

Copyright © 2000-2004 FreeHEP, All Rights Reserved.