SSJ  3.3.1
Stochastic Simulation in Java
Classes | Public Member Functions | List of all members
TextDataWriter Class Reference

Text data writer. More...

Inheritance diagram for TextDataWriter:
[legend]
Collaboration diagram for TextDataWriter:
[legend]

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. More...
 
 TextDataWriter (File file, Format format, boolean withHeaders) throws IOException
 Class constructor. More...
 
 TextDataWriter (OutputStream outputStream, Format format, boolean withHeaders) throws IOException
 Class constructor. More...
 
void setFormat (Format format)
 Changes the output format. More...
 
void setFloatFormatString (String formatString)
 Sets the format string used to output floating point numbers. More...
 
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 CachedDataWriter
 CachedDataWriter ()
 Class constructor.
 
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...
 
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...
 
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...
 
- 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

Fields

final String DEFAULT_COLUMN_SEPARATOR = "\t"
 Default value for the column separator.
 
final String DEFAULT_HEADER_PREFIX = ""
 Default value for the header prefix.
 
BufferedWriter out
 
Format format
 
boolean withHeaders
 
String columnSeparator = DEFAULT_COLUMN_SEPARATOR
 
String headerPrefix = DEFAULT_HEADER_PREFIX
 
String floatFormatString = null
 
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.
 

Additional Inherited Members

- Protected Member Functions inherited from CachedDataWriter
LinkedList< DataFieldgetFields ()
 
- Protected Attributes inherited from CachedDataWriter
LinkedList< DataFieldfields
 

Detailed Description

Text data writer.

Writes fields as columns or as rows in a text file.

Constructor & Destructor Documentation

◆ TextDataWriter() [1/3]

TextDataWriter ( String  filename,
Format  format,
boolean  withHeaders 
) throws IOException

Class constructor.

Truncates any existing file with the specified name.

Parameters
filenamename of the file to write to
formatorganize fields as columns if set to COLUMNS or as rows if set to ROWS
withHeadersoutput headers or not

◆ TextDataWriter() [2/3]

TextDataWriter ( File  file,
Format  format,
boolean  withHeaders 
) throws IOException

Class constructor.

Truncates any conflicting file.

Parameters
filefile to write to
formatorganize fields as columns if set to COLUMNS or as rows if set to ROWS
withHeadersoutput headers or not

◆ TextDataWriter() [3/3]

TextDataWriter ( OutputStream  outputStream,
Format  format,
boolean  withHeaders 
) throws IOException

Class constructor.

Parameters
outputStreamoutput stream to write to
formatorganize fields as columns if set to COLUMNS or as rows if set to ROWS
withHeadersoutput headers or not

Member Function Documentation

◆ setFloatFormatString()

void setFloatFormatString ( String  formatString)

Sets the format string used to output floating point numbers.

Parameters
formatStringformat string (e.g., %.4g)

◆ setFormat()

void setFormat ( Format  format)

Changes the output format.

Parameters
formatorganize fields as columns if set to COLUMNS or as rows if set to ROWS

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