25package umontreal.ssj.util.io;
27import java.io.IOException;
29import java.util.HashMap;
45 public String
readString(String label)
throws IOException {
52 public int readInt(String label)
throws IOException {
59 public float readFloat(String label)
throws IOException {
66 public double readDouble(String label)
throws IOException {
165 HashMap<String, DataField> fields =
new HashMap<String, DataField>();
175 key = String.format(
"_data%02d_", ++iAnonymous);
176 fields.put(key, data);
This abstract class implements shared functionality for data readers.
float[] readFloatArray(String label)
Reads first field labeled as label and returns its value as a one-dimensional array of float’s.
double[][] readDoubleArray2D(String label)
Reads first field labeled as label and returns its value as a two-dimensional array of double’s.
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.
float[][] readFloatArray2D(String label)
Reads first field labeled as label and returns its value as a two-dimensional array of float’s.
float readFloat(String label)
Reads first field labeled as label and returns its float value.
double[] readDoubleArray(String label)
Reads first field labeled as label and returns its value as a one-dimensional array of double’s.
String[][] readStringArray2D(String label)
Reads first field labeled as label and returns its value as a two-dimensional array of String’s.
String[] readStringArray(String label)
Reads first field labeled as label and returns its value as a one-dimensional array of String’s.
int[] readIntArray(String label)
Reads first field labeled as label and returns its value as a one-dimensional array of int’s.
String readString(String label)
Reads first field labeled as label and returns its String value.
int readInt(String label)
Reads first field labeled as label and returns its int value.
int[][] readIntArray2D(String label)
Reads first field labeled as label and returns its value as a two-dimensional array of int’s.
Map< String, DataField > readAllFields()
Reads all fields in the file and returns a hashmap indexed by field labels.
This class represents a data field from a file read by an instance of a class implementing DataReader...
String getLabel()
Returns the field label (or name).
double[][] asDoubleArray2D()
Returns the value as two-dimensional double array or null if it is not of type double[][].
int[] asIntArray()
Returns the value as one-dimensional int array or null if it is not of type int[].
double asDouble()
Returns the value as double or 0 if it is not of type double See isDouble.
String asString()
Returns the value as String, or null if it is not of type String.
double[] asDoubleArray()
Returns the value as one-dimensional double array or null if it is not of type double[].
float asFloat()
Returns the value as float or 0 if it is not of type float See isFloat.
String[] asStringArray()
Returns the value as one-dimensional String array or null if it is not of type String[].
float[][] asFloatArray2D()
Returns the value as two-dimensional float array or null if it is not of type float[][].
int[][] asIntArray2D()
Returns the value as two-dimensional int array or null if it is not of type int[][].
int asInt()
Returns the value as int or 0 if it is not of type int See isInt.
String[][] asStringArray2D()
Returns the value as two-dimensional String array or null if it is not of type String[][].
float[] asFloatArray()
Returns the value as one-dimensional float array or null if it is not of type float[].
DataField readNextField()
Reads the next available field.
boolean dataPending()
Returns true if there remains data to be read.
void reset()
Resets the reader to its initial state, i.e.
DataField readField(String label)
Reads the first field labeled as label.