SSJ
V. 2.6.2.

umontreal.iro.lecuyer.util.io
Class AbstractDataReader

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

public abstract class AbstractDataReader
extends Object
implements DataReader

This abstract class implements shared functionality for data readers.


Constructor Summary
AbstractDataReader()
           
 
Method Summary
 Map<String,DataField> readAllFields()
          Reads all fields in the file and returns a hashmap indexed by field labels.
 Map<String,DataField> readAllNextFields()
          Reads all remaining fields in the file and returns a hashmap indexed by field labels.
 double readDouble(String label)
          Reads first field labeled as label and returns its double value.
 double[] readDoubleArray(String label)
          Reads first field labeled as label and returns its value as a one-dimensional array of double's.
 double[][] readDoubleArray2D(String label)
          Reads first field labeled as label and returns its value as a two-dimensional array of double's.
 float readFloat(String label)
          Reads first field labeled as label and returns its float value.
 float[] readFloatArray(String label)
          Reads first field labeled as label and returns its value as a one-dimensional array of float's.
 float[][] readFloatArray2D(String label)
          Reads first field labeled as label and returns its value as a two-dimensional array of float's.
 int readInt(String label)
          Reads first field labeled as label and returns its int value.
 int[] readIntArray(String label)
          Reads first field labeled as label and returns its value as a one-dimensional array of int's.
 int[][] readIntArray2D(String label)
          Reads first field labeled as label and returns its value as a two-dimensional array of int's.
 String readString(String label)
          Reads first field labeled as label and returns its String value.
 String[] readStringArray(String label)
          Reads first field labeled as label and returns its value as a one-dimensional array of String's.
 String[][] readStringArray2D(String label)
          Reads first field labeled as label and returns its value as a two-dimensional array of String's.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface umontreal.iro.lecuyer.util.io.DataReader
close, dataPending, readField, readNextField, reset
 

Constructor Detail

AbstractDataReader

public AbstractDataReader()
Method Detail

readString

public String readString(String label)
                  throws IOException
Reads first field labeled as label and returns its String value.

Specified by:
readString in interface DataReader
Throws:
IOException

readInt

public int readInt(String label)
            throws IOException
Reads first field labeled as label and returns its int value.

Specified by:
readInt in interface DataReader
Throws:
IOException

readFloat

public float readFloat(String label)
                throws IOException
Reads first field labeled as label and returns its float value.

Specified by:
readFloat in interface DataReader
Throws:
IOException

readDouble

public double readDouble(String label)
                  throws IOException
Reads first field labeled as label and returns its double value.

Specified by:
readDouble in interface DataReader
Throws:
IOException

readStringArray

public String[] readStringArray(String label)
                         throws IOException
Reads first field labeled as label and returns its value as a one-dimensional array of String's.

Specified by:
readStringArray in interface DataReader
Throws:
IOException

readIntArray

public int[] readIntArray(String label)
                   throws IOException
Reads first field labeled as label and returns its value as a one-dimensional array of int's.

Specified by:
readIntArray in interface DataReader
Throws:
IOException

readFloatArray

public float[] readFloatArray(String label)
                       throws IOException
Reads first field labeled as label and returns its value as a one-dimensional array of float's.

Specified by:
readFloatArray in interface DataReader
Throws:
IOException

readDoubleArray

public double[] readDoubleArray(String label)
                         throws IOException
Reads first field labeled as label and returns its value as a one-dimensional array of double's.

Specified by:
readDoubleArray in interface DataReader
Throws:
IOException

readStringArray2D

public String[][] readStringArray2D(String label)
                             throws IOException
Reads first field labeled as label and returns its value as a two-dimensional array of String's.

Specified by:
readStringArray2D in interface DataReader
Throws:
IOException

readIntArray2D

public int[][] readIntArray2D(String label)
                       throws IOException
Reads first field labeled as label and returns its value as a two-dimensional array of int's.

Specified by:
readIntArray2D in interface DataReader
Throws:
IOException

readFloatArray2D

public float[][] readFloatArray2D(String label)
                           throws IOException
Reads first field labeled as label and returns its value as a two-dimensional array of float's.

Specified by:
readFloatArray2D in interface DataReader
Throws:
IOException

readDoubleArray2D

public double[][] readDoubleArray2D(String label)
                             throws IOException
Reads first field labeled as label and returns its value as a two-dimensional array of double's.

Specified by:
readDoubleArray2D in interface DataReader
Throws:
IOException

readAllNextFields

public Map<String,DataField> readAllNextFields()
                                        throws IOException
Reads all remaining fields in the file and returns a hashmap indexed by field labels. Anonymous fields are mapped to "_data01_", "_data02_", ...

Specified by:
readAllNextFields in interface DataReader
Throws:
IOException

readAllFields

public Map<String,DataField> readAllFields()
                                    throws IOException
Reads all fields in the file and returns a hashmap indexed by field labels. Anonymous fields are mapped to "_data01_", "_data02_", ...

Specified by:
readAllFields in interface DataReader
Throws:
IOException

SSJ
V. 2.6.2.

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