Text data writer. More...
Classes | |
| enum | Format |
| Output format: organize fields as columns or as rows. More... | |
Public Member Functions | |
| TextDataWriter (String filename, Format format, boolean withHeaders) throws IOException | |
| Class constructor. | |
| TextDataWriter (File file, Format format, boolean withHeaders) throws IOException | |
| Class constructor. | |
| TextDataWriter (OutputStream outputStream, Format format, boolean withHeaders) throws IOException | |
| Class constructor. | |
| void | setFormat (Format format) |
| Changes the output format. | |
| void | setFloatFormatString (String formatString) |
| Sets the format string used to output floating point numbers. | |
| void | setColumnSeparator (String columnSeparator) |
| Changes the column separator. | |
| void | setHeaderPrefix (String headerPrefix) |
| Changes the header prefix (a string that indicates the beginning of the header line for the COLUMNS format). | |
| void | close () throws IOException |
| Flushes any pending data and closes the file or stream. | |
| Public Member Functions inherited from umontreal.ssj.util.io.CachedDataWriter | |
| CachedDataWriter () | |
| Class constructor. | |
| void | write (String label, String s) throws IOException |
| Writes an atomic string field. | |
| void | write (String label, int a) throws IOException |
| Writes an atomic 32-bit integer (big endian). | |
| void | write (String label, float a) throws IOException |
| Writes an atomic 32-bit float (big endian). | |
| void | write (String label, double a) throws IOException |
| Writes an atomic 64-bit double (big endian). | |
| void | write (String label, String[] a, int n) throws IOException |
| Writes the first n elements of a one-dimensional array of strings. | |
| 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). | |
| 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). | |
| 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). | |
| void | write (String label, String[][] a) throws IOException |
| Writes a two-dimensional array of strings. | |
| void | write (String label, int[][] a) throws IOException |
| Writes a two-dimensional array of 32-bit integers (big endian). | |
| void | write (String label, float[][] a) throws IOException |
| Writes a two-dimensional array of 32-bit floats (big endian). | |
| void | write (String label, double[][] a) throws IOException |
| Writes a two-dimensional array of 64-bit doubles (big endian). | |
| Public Member Functions inherited from umontreal.ssj.util.io.AbstractDataWriter | |
| void | write (String label, String[] a) throws IOException |
| Writes a one-dimensional array of strings. | |
| void | write (String label, int[] a) throws IOException |
| Writes a one-dimensional array of 32-bit integers (big endian). | |
| void | write (String label, float[] a) throws IOException |
| Writes a one-dimensional array of 32-bit floats (big endian). | |
| void | write (String label, double[] a) throws IOException |
| Writes a one-dimensional array of 64-bit doubles (big endian). | |
| Public Member Functions inherited from umontreal.ssj.util.io.DataWriter | |
Fields @{ | |
| final String | DEFAULT_COLUMN_SEPARATOR = "\t" |
| Default value for the column separator. | |
| final String | DEFAULT_HEADER_PREFIX = "" |
| Default value for the header prefix. | |
| int | getMaxFieldLength () |
| Returns the maximum field length. | |
| void | outputAsColumns () throws IOException |
| Outputs fields as columns. | |
| void | outputAsRows () throws IOException |
| Outputs fields as rows. | |
| void | writeFormat (Object o) throws IOException |
| Formats the object in accordance with the current format strings settings. | |
Text data writer.
Writes fields as columns or as rows in a text file.
Definition at line 35 of file TextDataWriter.java.
| umontreal.ssj.util.io.TextDataWriter.TextDataWriter | ( | String | filename, |
| Format | format, | ||
| boolean | withHeaders ) throws IOException |
Class constructor.
Truncates any existing file with the specified name.
| filename | name of the file to write to |
| format | organize fields as columns if set to COLUMNS or as rows if set to ROWS |
| withHeaders | output headers or not |
Definition at line 206 of file TextDataWriter.java.
| umontreal.ssj.util.io.TextDataWriter.TextDataWriter | ( | File | file, |
| Format | format, | ||
| boolean | withHeaders ) throws IOException |
Class constructor.
Truncates any conflicting file.
| file | file to write to |
| format | organize fields as columns if set to COLUMNS or as rows if set to ROWS |
| withHeaders | output headers or not |
Definition at line 220 of file TextDataWriter.java.
| umontreal.ssj.util.io.TextDataWriter.TextDataWriter | ( | OutputStream | outputStream, |
| Format | format, | ||
| boolean | withHeaders ) throws IOException |
Class constructor.
| outputStream | output stream to write to |
| format | organize fields as columns if set to COLUMNS or as rows if set to ROWS |
| withHeaders | output headers or not |
Definition at line 234 of file TextDataWriter.java.
| void umontreal.ssj.util.io.TextDataWriter.close | ( | ) | throws IOException |
Flushes any pending data and closes the file or stream.
Implements umontreal.ssj.util.io.DataWriter.
Definition at line 277 of file TextDataWriter.java.
|
protected |
Returns the maximum field length.
Definition at line 65 of file TextDataWriter.java.
|
protected |
Outputs fields as columns.
Definition at line 78 of file TextDataWriter.java.
|
protected |
Outputs fields as rows.
Definition at line 133 of file TextDataWriter.java.
| void umontreal.ssj.util.io.TextDataWriter.setColumnSeparator | ( | String | columnSeparator | ) |
Changes the column separator.
Definition at line 262 of file TextDataWriter.java.
| void umontreal.ssj.util.io.TextDataWriter.setFloatFormatString | ( | String | formatString | ) |
Sets the format string used to output floating point numbers.
| formatString | format string (e.g., %.4g) |
Definition at line 255 of file TextDataWriter.java.
| void umontreal.ssj.util.io.TextDataWriter.setFormat | ( | Format | format | ) |
Changes the output format.
| format | organize fields as columns if set to COLUMNS or as rows if set to ROWS |
Definition at line 246 of file TextDataWriter.java.
| void umontreal.ssj.util.io.TextDataWriter.setHeaderPrefix | ( | String | headerPrefix | ) |
Changes the header prefix (a string that indicates the beginning of the header line for the COLUMNS format).
Definition at line 270 of file TextDataWriter.java.
|
protected |
Formats the object in accordance with the current format strings settings.
Definition at line 178 of file TextDataWriter.java.
| final String umontreal.ssj.util.io.TextDataWriter.DEFAULT_COLUMN_SEPARATOR = "\t" |
Default value for the column separator.
Definition at line 44 of file TextDataWriter.java.
| final String umontreal.ssj.util.io.TextDataWriter.DEFAULT_HEADER_PREFIX = "" |
Default value for the header prefix.
Definition at line 49 of file TextDataWriter.java.