Binary data reader. More...
Public Member Functions | |
| BinaryDataReader (String filename) throws IOException | |
| Opens the file with the specified name for reading. | |
| BinaryDataReader (URL url) throws IOException | |
| Opens the file at the specified url for reading. | |
| BinaryDataReader (File file) throws IOException | |
| Opens the specified file for reading. | |
| BinaryDataReader (InputStream inputStream) throws IOException | |
| Opens the specified input stream for reading. | |
Reading fields of unknown type @{ | |
| DataField | readNextField () throws IOException |
| Reads the next available field. | |
| DataField | readField (String label) throws IOException |
| Reads the first field labeled as label. | |
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 umontreal.ssj.util.io.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. | |
| Map< String, DataField > | readAllFields () throws IOException |
| Reads all fields in the file and returns a hashmap indexed by field labels. | |
| Public Member Functions inherited from umontreal.ssj.util.io.DataReader | |
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. | |
Binary data reader.
This class implements a module for importing data written with BinaryDataWriter.
Definition at line 36 of file BinaryDataReader.java.
| umontreal.ssj.util.io.BinaryDataReader.BinaryDataReader | ( | String | filename | ) | throws IOException |
Opens the file with the specified name for reading.
| filename | name of the file to read the data from |
Definition at line 251 of file BinaryDataReader.java.
| umontreal.ssj.util.io.BinaryDataReader.BinaryDataReader | ( | URL | url | ) | throws IOException |
Opens the file at the specified url for reading.
| url | url of the file to read the data from |
Definition at line 262 of file BinaryDataReader.java.
| umontreal.ssj.util.io.BinaryDataReader.BinaryDataReader | ( | File | file | ) | throws IOException |
Opens the specified file for reading.
| file | file to read the data from |
Definition at line 273 of file BinaryDataReader.java.
| umontreal.ssj.util.io.BinaryDataReader.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 |
Definition at line 286 of file BinaryDataReader.java.
| void umontreal.ssj.util.io.BinaryDataReader.close | ( | ) | throws IOException |
Closes the file.
Implements umontreal.ssj.util.io.DataReader.
Definition at line 408 of file BinaryDataReader.java.
| boolean umontreal.ssj.util.io.BinaryDataReader.dataPending | ( | ) | throws IOException |
Returns true if there remains data to be read.
Implements umontreal.ssj.util.io.DataReader.
Definition at line 401 of file BinaryDataReader.java.
|
protected |
Reads 2D double-array data.
Definition at line 180 of file BinaryDataReader.java.
|
protected |
Reads double-array data.
Definition at line 169 of file BinaryDataReader.java.
|
protected |
Reads double data.
Definition at line 161 of file BinaryDataReader.java.
| DataField umontreal.ssj.util.io.BinaryDataReader.readField | ( | String | label | ) | throws IOException |
Reads the first field labeled as label.
Implements umontreal.ssj.util.io.DataReader.
Definition at line 319 of file BinaryDataReader.java.
|
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 |
null if data type is unknown Definition at line 197 of file BinaryDataReader.java.
|
protected |
Reads 2D float-array data.
Definition at line 149 of file BinaryDataReader.java.
|
protected |
Reads float-array data.
Definition at line 138 of file BinaryDataReader.java.
|
protected |
Reads float data.
Definition at line 130 of file BinaryDataReader.java.
|
protected |
Reads 2D integer-array data.
Definition at line 118 of file BinaryDataReader.java.
|
protected |
Reads integer-array data.
Definition at line 107 of file BinaryDataReader.java.
|
protected |
Reads integer data.
Definition at line 99 of file BinaryDataReader.java.
|
protected |
Reads current field label.
Definition at line 49 of file BinaryDataReader.java.
| DataField umontreal.ssj.util.io.BinaryDataReader.readNextField | ( | ) | throws IOException |
Reads the next available field.
Implements umontreal.ssj.util.io.DataReader.
Definition at line 299 of file BinaryDataReader.java.
|
protected |
Reads 2D string-array data.
Definition at line 87 of file BinaryDataReader.java.
|
protected |
Reads string-array data.
Definition at line 76 of file BinaryDataReader.java.
|
protected |
Reads string data.
Definition at line 62 of file BinaryDataReader.java.
| void umontreal.ssj.util.io.BinaryDataReader.reset | ( | ) | throws IOException |
Reopens the file (does not work with the constructor that takes an input stream).
Implements umontreal.ssj.util.io.DataReader.
Definition at line 386 of file BinaryDataReader.java.