SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
umontreal.ssj.util.io.BinaryDataReader Class Reference

Binary data reader. More...

Inheritance diagram for umontreal.ssj.util.io.BinaryDataReader:
umontreal.ssj.util.io.AbstractDataReader umontreal.ssj.util.io.DataReader

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, DataFieldreadAllNextFields () throws IOException
 Reads all remaining fields in the file and returns a hashmap indexed by field labels.
Map< String, DataFieldreadAllFields () 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.

Detailed Description

Binary data reader.

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

Definition at line 36 of file BinaryDataReader.java.

Constructor & Destructor Documentation

◆ BinaryDataReader() [1/4]

umontreal.ssj.util.io.BinaryDataReader.BinaryDataReader ( String filename) throws IOException

Opens the file with the specified name for reading.

Parameters
filenamename of the file to read the data from

Definition at line 251 of file BinaryDataReader.java.

◆ BinaryDataReader() [2/4]

umontreal.ssj.util.io.BinaryDataReader.BinaryDataReader ( URL url) throws IOException

Opens the file at the specified url for reading.

Parameters
urlurl of the file to read the data from

Definition at line 262 of file BinaryDataReader.java.

◆ BinaryDataReader() [3/4]

umontreal.ssj.util.io.BinaryDataReader.BinaryDataReader ( File file) throws IOException

Opens the specified file for reading.

Parameters
filefile to read the data from

Definition at line 273 of file BinaryDataReader.java.

◆ BinaryDataReader() [4/4]

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.

Parameters
inputStreaminput stream to read the data from

Definition at line 286 of file BinaryDataReader.java.

Member Function Documentation

◆ close()

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.

◆ dataPending()

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.

◆ readDoubleArray2DData()

double[][] umontreal.ssj.util.io.BinaryDataReader.readDoubleArray2DData ( int dims[]) throws IOException
protected

Reads 2D double-array data.

Definition at line 180 of file BinaryDataReader.java.

◆ readDoubleArrayData()

double[] umontreal.ssj.util.io.BinaryDataReader.readDoubleArrayData ( int dim) throws IOException
protected

Reads double-array data.

Definition at line 169 of file BinaryDataReader.java.

◆ readDoubleData()

double umontreal.ssj.util.io.BinaryDataReader.readDoubleData ( ) throws IOException
protected

Reads double data.

Definition at line 161 of file BinaryDataReader.java.

◆ readField()

DataField umontreal.ssj.util.io.BinaryDataReader.readField ( String label) throws IOException

Reads the first field labeled as label.

Returns
a newly created DataField instance or null if not found

Implements umontreal.ssj.util.io.DataReader.

Definition at line 319 of file BinaryDataReader.java.

◆ readFieldData()

Object umontreal.ssj.util.io.BinaryDataReader.readFieldData ( byte typechar,
int nDims,
int dims[] ) throws IOException
protected

Reads field data of arbitrary type.

Parameters
typechartype code character (see BinaryDataWriter constants)
nDimsnumber of dimensions (0 for atomic data)
dimslength of each dimension
Returns
an instance of the data or null if data type is unknown

Definition at line 197 of file BinaryDataReader.java.

◆ readFloatArray2DData()

float[][] umontreal.ssj.util.io.BinaryDataReader.readFloatArray2DData ( int dims[]) throws IOException
protected

Reads 2D float-array data.

Definition at line 149 of file BinaryDataReader.java.

◆ readFloatArrayData()

float[] umontreal.ssj.util.io.BinaryDataReader.readFloatArrayData ( int dim) throws IOException
protected

Reads float-array data.

Definition at line 138 of file BinaryDataReader.java.

◆ readFloatData()

float umontreal.ssj.util.io.BinaryDataReader.readFloatData ( ) throws IOException
protected

Reads float data.

Definition at line 130 of file BinaryDataReader.java.

◆ readIntArray2DData()

int[][] umontreal.ssj.util.io.BinaryDataReader.readIntArray2DData ( int dims[]) throws IOException
protected

Reads 2D integer-array data.

Definition at line 118 of file BinaryDataReader.java.

◆ readIntArrayData()

int[] umontreal.ssj.util.io.BinaryDataReader.readIntArrayData ( int dim) throws IOException
protected

Reads integer-array data.

Definition at line 107 of file BinaryDataReader.java.

◆ readIntData()

int umontreal.ssj.util.io.BinaryDataReader.readIntData ( ) throws IOException
protected

Reads integer data.

Definition at line 99 of file BinaryDataReader.java.

◆ readLabel()

String umontreal.ssj.util.io.BinaryDataReader.readLabel ( ) throws IOException
protected

Reads current field label.

Definition at line 49 of file BinaryDataReader.java.

◆ readNextField()

DataField umontreal.ssj.util.io.BinaryDataReader.readNextField ( ) throws IOException

Reads the next available field.

Returns
a newly created DataField instance or null if not found

Implements umontreal.ssj.util.io.DataReader.

Definition at line 299 of file BinaryDataReader.java.

◆ readStringArray2DData()

String[][] umontreal.ssj.util.io.BinaryDataReader.readStringArray2DData ( int dims[]) throws IOException
protected

Reads 2D string-array data.

Definition at line 87 of file BinaryDataReader.java.

◆ readStringArrayData()

String[] umontreal.ssj.util.io.BinaryDataReader.readStringArrayData ( int dim) throws IOException
protected

Reads string-array data.

Definition at line 76 of file BinaryDataReader.java.

◆ readStringData()

String umontreal.ssj.util.io.BinaryDataReader.readStringData ( ) throws IOException
protected

Reads string data.

Definition at line 62 of file BinaryDataReader.java.

◆ reset()

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.


The documentation for this class was generated from the following file: