|
SSJ
3.3.1
Stochastic Simulation in Java
|
Binary data writer. More...
Public Member Functions | |
| BinaryDataWriter (String filename, boolean append) throws IOException | |
| Data will be output to the file with the specified name. More... | |
| BinaryDataWriter (File file, boolean append) throws IOException | |
| Data will be output to the specified file. More... | |
| BinaryDataWriter (String filename) throws IOException | |
| Truncates any existing file with the specified name. More... | |
| BinaryDataWriter (File file) throws IOException | |
| Truncates any existing file with the specified name. More... | |
| BinaryDataWriter (OutputStream outputStream) throws IOException | |
| Constructor. More... | |
Writing atomic data | |
| void | write (String label, String s) throws IOException |
| Writes an atomic string field. More... | |
| void | write (String label, int a) throws IOException |
| Writes an atomic 32-bit integer (big endian). More... | |
| void | write (String label, float a) throws IOException |
| Writes an atomic 32-bit float (big endian). More... | |
| void | write (String label, double a) throws IOException |
| Writes an atomic 64-bit double (big endian). More... | |
Writing one-dimensional arrays | |
| void | write (String label, String[] a, int n) throws IOException |
Writes the first n elements of a one-dimensional array of strings. More... | |
| void | write (String label, int[] a, int n) throws IOException |
Writes the first n elements of a one-dimensional array of 32-bit integers (big endian). More... | |
| void | write (String label, float[] a, int n) throws IOException |
Writes the first n elements of a one-dimensional array of 32-bit floats (big endian). More... | |
| void | write (String label, double[] a, int n) throws IOException |
Writes the first n elements of a one-dimensional array of 64-bit doubles (big endian). More... | |
Writing two-dimensional arrays | |
| void | write (String label, String[][] a) throws IOException |
| Writes a two-dimensional array of strings. More... | |
| void | write (String label, int[][] a) throws IOException |
| Writes a two-dimensional array of 32-bit integers (big endian). More... | |
| void | write (String label, float[][] a) throws IOException |
| Writes a two-dimensional array of 32-bit floats (big endian). More... | |
| void | write (String label, double[][] a) throws IOException |
| Writes a two-dimensional array of 64-bit doubles (big endian). More... | |
Other methods | |
| void | close () throws IOException |
| Flushes any pending data and closes the file. | |
Public Member Functions inherited from AbstractDataWriter | |
| void | write (String label, String[] a) throws IOException |
| Writes a one-dimensional array of strings. More... | |
| void | write (String label, int[] a) throws IOException |
| Writes a one-dimensional array of 32-bit integers (big endian). More... | |
| void | write (String label, float[] a) throws IOException |
| Writes a one-dimensional array of 32-bit floats (big endian). More... | |
| void | write (String label, double[] a) throws IOException |
| Writes a one-dimensional array of 64-bit doubles (big endian). More... | |
Writing atomic data | |
Writing one-dimensional arrays | |
Writing two-dimensional arrays | |
Other methods | |
Static Public Attributes | |
Fields | |
| static final byte | TYPECHAR_LABEL = '|' |
| Field-type symbol indicating a label (it more accurately a field separator symbol). | |
| static final byte | TYPECHAR_STRING = 'S' |
Field-type symbol indicating String data. | |
| static final byte | TYPECHAR_INTEGER = 'i' |
Field-type symbol indicating int data. | |
| static final byte | TYPECHAR_FLOAT = 'f' |
Field-type symbol indicating float data. | |
| static final byte | TYPECHAR_DOUBLE = 'd' |
Field-type symbol indicating double data. | |
Protected Member Functions | |
| void | writeStringData (String s) throws IOException |
| Utility method to write string data. | |
| void | writeLabel (String label) throws IOException |
| Starts a new field by writing its label. More... | |
Protected Attributes | |
| DataOutputStream | out |
Binary data writer.
Stores a sequence of fields in binary file, which can be either atoms or arrays, each of which having the following format:
Field label:
|) Field type (byte):
i (32-bit integer) f (32-bit float) d (64-bit double) S (string) In the case of an atomic field, the number of dimensions is set to zero.
A string field is stored in the following format:
Also supports anonymous fields (fields with an empty label).
Arrays up to two dimensions are supported.
Modules for reading data exported with this class are available in Java ( BinaryDataReader ), Matlab and Python (numpy).
Provide links for the import modules.
| BinaryDataWriter | ( | String | filename, |
| boolean | append | ||
| ) | throws IOException |
Data will be output to the file with the specified name.
| filename | name of the file to be created or appended to |
| append | an existing file with the specified name will be appended to if true or truncated if false |
| BinaryDataWriter | ( | File | file, |
| boolean | append | ||
| ) | throws IOException |
Data will be output to the specified file.
| file | file to be created or appended to |
| append | an existing file with the specified name will be appended to if true or truncated if false |
| BinaryDataWriter | ( | String | filename | ) | throws IOException |
Truncates any existing file with the specified name.
| filename | name of the file to be created |
| BinaryDataWriter | ( | File | file | ) | throws IOException |
Truncates any existing file with the specified name.
| file | file to be created |
| BinaryDataWriter | ( | OutputStream | outputStream | ) | throws IOException |
Constructor.
| outputStream | output stream to write to |
| void write | ( | String | label, |
| String | s | ||
| ) | throws IOException |
| void write | ( | String | label, |
| int | a | ||
| ) | throws IOException |
Writes an atomic 32-bit integer (big endian).
Writes an anonymous field if label is null.
Implements DataWriter.
| void write | ( | String | label, |
| float | a | ||
| ) | throws IOException |
Writes an atomic 32-bit float (big endian).
Writes an anonymous field if label is null.
Implements DataWriter.
| void write | ( | String | label, |
| double | a | ||
| ) | throws IOException |
Writes an atomic 64-bit double (big endian).
Writes an anonymous field if label is null.
Implements DataWriter.
| void write | ( | String | label, |
| String [] | a, | ||
| int | n | ||
| ) | throws IOException |
Writes the first n elements of a one-dimensional array of strings.
Writes an anonymous field if label is null.
Implements DataWriter.
| void write | ( | String | label, |
| int [] | a, | ||
| int | n | ||
| ) | throws IOException |
Writes the first n elements of a one-dimensional array of 32-bit integers (big endian).
Writes an anonymous field if label is null.
Implements DataWriter.
| void write | ( | String | label, |
| float [] | a, | ||
| int | n | ||
| ) | throws IOException |
Writes the first n elements of a one-dimensional array of 32-bit floats (big endian).
Writes an anonymous field if label is null.
Implements DataWriter.
| void write | ( | String | label, |
| double [] | a, | ||
| int | n | ||
| ) | throws IOException |
Writes the first n elements of a one-dimensional array of 64-bit doubles (big endian).
Writes an anonymous field if label is null.
Implements DataWriter.
| void write | ( | String | label, |
| String | a[][] | ||
| ) | throws IOException |
Writes a two-dimensional array of strings.
Writes an anonymous field if label is null.
Implements DataWriter.
| void write | ( | String | label, |
| int | a[][] | ||
| ) | throws IOException |
Writes a two-dimensional array of 32-bit integers (big endian).
Writes an anonymous field if label is null.
Implements DataWriter.
| void write | ( | String | label, |
| float | a[][] | ||
| ) | throws IOException |
Writes a two-dimensional array of 32-bit floats (big endian).
Writes an anonymous field if label is null.
Implements DataWriter.
| void write | ( | String | label, |
| double | a[][] | ||
| ) | throws IOException |
Writes a two-dimensional array of 64-bit doubles (big endian).
Writes an anonymous field if label is null.
Implements DataWriter.
|
protected |
Starts a new field by writing its label.
| label | name of the field (can be null |
1.8.14