Copyright © 2005 Scientific Applications. All Rights Reserved.

com.sciapp.table.io
Class DelimitedExportManager

java.lang.Object
  extended by com.sciapp.table.io.DelimitedExportManager
All Implemented Interfaces:
ExportManager

public class DelimitedExportManager
extends Object
implements ExportManager

DelimitedExportManager writes a table model in a delimited format.


Field Summary
static String DEFAULT_NEWLINE
          the default new line as "\r\n"
protected  String delimiter
          the delimiter string
protected  String newline
          the newline string
protected  boolean writeHeader
          boolean variable for writing the header of the table model.
 
Constructor Summary
DelimitedExportManager()
          Constructs a DelimitedExportManager with a comma (,) as the delimiter.
DelimitedExportManager(String delimiter)
          Constructs a DelimitedExportManager.
 
Method Summary
protected  String format(TableModel model, int row, int column)
          Returns the value of a specified cell as a string.
protected  String formatHeader(String value)
          Returns a formatted string of a table's column name.
 String getDelimiter()
          Returns the current delimiter.
 String getHeader(TableModel model)
          Returns the table model header.
 boolean getWriteHeader()
          Determines whether we want the column values of the table model to be output as well.
 void setDelimiter(String delimiter)
          Assigns a new delimiter string.
 void setWriteHeader(boolean writeHeader)
          Assigns a variable that is true if the column values of the table model will be output as well.
 void write(TableModel model, OutputStream out)
          Writes model to the outputstream out.
 void write(TableModel model, Writer writer)
          Writes model to the writer writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

delimiter

protected String delimiter
the delimiter string


DEFAULT_NEWLINE

public static final String DEFAULT_NEWLINE
the default new line as "\r\n"

See Also:
Constant Field Values

newline

protected String newline
the newline string


writeHeader

protected boolean writeHeader
boolean variable for writing the header of the table model.

Constructor Detail

DelimitedExportManager

public DelimitedExportManager()
Constructs a DelimitedExportManager with a comma (,) as the delimiter.


DelimitedExportManager

public DelimitedExportManager(String delimiter)
Constructs a DelimitedExportManager.

Method Detail

format

protected String format(TableModel model,
                        int row,
                        int column)
Returns the value of a specified cell as a string.

Parameters:
model - the table model
row - the row index
column - the column index
Returns:
the formatted cell value

getDelimiter

public String getDelimiter()
Returns the current delimiter.

Returns:
the delimiter string

getHeader

public String getHeader(TableModel model)
Returns the table model header.

Returns:
the header

getWriteHeader

public boolean getWriteHeader()
Determines whether we want the column values of the table model to be output as well.

Returns:
true if the column header is to be written to the stream.

setDelimiter

public void setDelimiter(String delimiter)
Assigns a new delimiter string.

Parameters:
delimiter - the new delimiter string to assign

setWriteHeader

public void setWriteHeader(boolean writeHeader)
Assigns a variable that is true if the column values of the table model will be output as well.

Parameters:
writeHeader - true if the column header is to be written to the stream.

write

public void write(TableModel model,
                  OutputStream out)
Writes model to the outputstream out.

Specified by:
write in interface ExportManager
Parameters:
model - the table model to write
out - the output stream to write to

formatHeader

protected String formatHeader(String value)
Returns a formatted string of a table's column name.

Parameters:
value - the value of the colunmn
Returns:
the formatted column value
Since:
3.4

write

public void write(TableModel model,
                  Writer writer)
Writes model to the writer writer.

Specified by:
write in interface ExportManager
Parameters:
model - the table model to write
writer - the writer to write to

Copyright © 2005 Scientific Applications. All Rights Reserved.