SSJ
V. 2.6.

umontreal.iro.lecuyer.util.io
Class BinaryDataReader

java.lang.Object
  extended by umontreal.iro.lecuyer.util.io.AbstractDataReader
      extended by umontreal.iro.lecuyer.util.io.BinaryDataReader
All Implemented Interfaces:
DataReader

public class BinaryDataReader
extends AbstractDataReader

Binary data reader. This class implements a module for importing data written with BinaryDataWriter.


Constructor Summary
BinaryDataReader(File file)
          Opens the specified file for reading.
BinaryDataReader(InputStream inputStream)
          Opens the specified input stream for reading.
BinaryDataReader(String filename)
          Opens the file with the specified name for reading.
BinaryDataReader(URL url)
          Opens the file at the specified url for reading.
 
Method Summary
 void close()
          Closes the file.
 boolean dataPending()
          Returns true if there remains data to be read.
 DataField readField(String label)
          Reads the first field labeled as label.
 DataField readNextField()
          Reads the next available field.
 void reset()
          Reopens the file (does not work with the constructor that takes an input stream).
 
Methods inherited from class umontreal.iro.lecuyer.util.io.AbstractDataReader
readAllFields, readAllNextFields, readDouble, readDoubleArray, readDoubleArray2D, readFloat, readFloatArray, readFloatArray2D, readInt, readIntArray, readIntArray2D, readString, readStringArray, readStringArray2D
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinaryDataReader

public BinaryDataReader(String filename)
                 throws IOException
Opens the file with the specified name for reading.

Parameters:
filename - name of the file to read the data from
Throws:
IOException

BinaryDataReader

public BinaryDataReader(URL url)
                 throws IOException
Opens the file at the specified url for reading.

Parameters:
url - url of the file to read the data from
Throws:
IOException

BinaryDataReader

public BinaryDataReader(File file)
                 throws IOException
Opens the specified file for reading.

Parameters:
file - file to read the data from
Throws:
IOException

BinaryDataReader

public BinaryDataReader(InputStream inputStream)
                 throws IOException
Opens the specified input stream for reading. When using this constructor, the method readField might will not be able to read a field that is before the current reading position.

Parameters:
inputStream - input stream to read the data from
Throws:
IOException
Method Detail

readNextField

public DataField readNextField()
                        throws IOException
Reads the next available field.

Returns:
a newly created DataField instance or null if not found
Throws:
IOException

readField

public DataField readField(String label)
                    throws IOException
Reads the first field labeled as label.

Returns:
a newly created DataField instance or null if not found
Throws:
IOException

reset

public void reset()
           throws IOException
Reopens the file (does not work with the constructor that takes an input stream).

Throws:
IOException

dataPending

public boolean dataPending()
                    throws IOException
Returns true if there remains data to be read.

Throws:
IOException

close

public void close()
           throws IOException
Closes the file.

Throws:
IOException

SSJ
V. 2.6.

To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.