SSJ
3.3.1
Stochastic Simulation in Java
|
Binary data reader. More...
Public Member Functions | |
BinaryDataReader (String filename) throws IOException | |
Opens the file with the specified name for reading. More... | |
BinaryDataReader (URL url) throws IOException | |
Opens the file at the specified url for reading. More... | |
BinaryDataReader (File file) throws IOException | |
Opens the specified file for reading. More... | |
BinaryDataReader (InputStream inputStream) throws IOException | |
Opens the specified input stream for reading. More... | |
Reading fields of unknown type | |
DataField | readNextField () throws IOException |
Reads the next available field. More... | |
DataField | readField (String label) throws IOException |
Reads the first field labeled as label . More... | |
Other methods | |
void | reset () throws IOException |
Reopens the file (does not work with the constructor that takes an input stream). | |
boolean | dataPending () throws IOException |
Returns true if there remains data to be read. | |
void | close () throws IOException |
Closes the file. | |
Public Member Functions inherited from AbstractDataReader | |
String | readString (String label) throws IOException |
Reads first field labeled as label and returns its String value. | |
int | readInt (String label) throws IOException |
Reads first field labeled as label and returns its int value. | |
float | readFloat (String label) throws IOException |
Reads first field labeled as label and returns its float value. | |
double | readDouble (String label) throws IOException |
Reads first field labeled as label and returns its double value. | |
String [] | readStringArray (String label) throws IOException |
Reads first field labeled as label and returns its value as a one-dimensional array of String ’s. | |
int [] | readIntArray (String label) throws IOException |
Reads first field labeled as label and returns its value as a one-dimensional array of int ’s. | |
float [] | readFloatArray (String label) throws IOException |
Reads first field labeled as label and returns its value as a one-dimensional array of float ’s. | |
double [] | readDoubleArray (String label) throws IOException |
Reads first field labeled as label and returns its value as a one-dimensional array of double ’s. | |
String [][] | readStringArray2D (String label) throws IOException |
Reads first field labeled as label and returns its value as a two-dimensional array of String ’s. | |
int [][] | readIntArray2D (String label) throws IOException |
Reads first field labeled as label and returns its value as a two-dimensional array of int ’s. | |
float [][] | readFloatArray2D (String label) throws IOException |
Reads first field labeled as label and returns its value as a two-dimensional array of float ’s. | |
double [][] | readDoubleArray2D (String label) throws IOException |
Reads first field labeled as label and returns its value as a two-dimensional array of double ’s. | |
Map< String, DataField > | readAllNextFields () throws IOException |
Reads all remaining fields in the file and returns a hashmap indexed by field labels. More... | |
Map< String, DataField > | readAllFields () throws IOException |
Reads all fields in the file and returns a hashmap indexed by field labels. More... | |
Reading atomic data | |
Reading one-dimensional arrays | |
Reading two-dimensional arrays | |
Reading fields of unknown type | |
Other methods |
Protected Member Functions | |
String | readLabel () throws IOException |
Reads current field label. | |
String | readStringData () throws IOException |
Reads string data. | |
String [] | readStringArrayData (int dim) throws IOException |
Reads string-array data. | |
String [][] | readStringArray2DData (int dims[]) throws IOException |
Reads 2D string-array data. | |
int | readIntData () throws IOException |
Reads integer data. | |
int [] | readIntArrayData (int dim) throws IOException |
Reads integer-array data. | |
int [][] | readIntArray2DData (int dims[]) throws IOException |
Reads 2D integer-array data. | |
float | readFloatData () throws IOException |
Reads float data. | |
float [] | readFloatArrayData (int dim) throws IOException |
Reads float-array data. | |
float [][] | readFloatArray2DData (int dims[]) throws IOException |
Reads 2D float-array data. | |
double | readDoubleData () throws IOException |
Reads double data. | |
double [] | readDoubleArrayData (int dim) throws IOException |
Reads double-array data. | |
double [][] | readDoubleArray2DData (int dims[]) throws IOException |
Reads 2D double-array data. | |
Object | readFieldData (byte typechar, int nDims, int dims[]) throws IOException |
Reads field data of arbitrary type. More... | |
Protected Attributes | |
DataInputStream | in |
String | filename = null |
URL | url = null |
File | file = null |
boolean | canReset = false |
Binary data reader.
This class implements a module for importing data written with BinaryDataWriter.
BinaryDataReader | ( | String | filename | ) | throws IOException |
Opens the file with the specified name for reading.
filename | name of the file to read the data from |
BinaryDataReader | ( | URL | url | ) | throws IOException |
Opens the file at the specified url for reading.
url | url of the file to read the data from |
BinaryDataReader | ( | File | file | ) | throws IOException |
Opens the specified file for reading.
file | file to read the data from |
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.
inputStream | input stream to read the data from |
DataField readField | ( | String | label | ) | throws IOException |
Reads the first field labeled as label
.
null
if not found Implements DataReader.
|
protected |
Reads field data of arbitrary type.
typechar | type code character (see BinaryDataWriter constants) |
nDims | number of dimensions (0 for atomic data) |
dims | length of each dimension |
DataField readNextField | ( | ) | throws IOException |
Reads the next available field.
null
if not found Implements DataReader.