org.jfree.report.modules.misc.tablemodel

Class CSVTableModelProducer

public class CSVTableModelProducer extends Object

Creates a TableModel using a file formated in CSV for input. The separation can be what ever you want (as it is an understandable regexp). The default separator is a ,.

Author: Mimil

Constructor Summary
CSVTableModelProducer(InputStream in)
CSVTableModelProducer(String filename)
CSVTableModelProducer(BufferedReader r)
Method Summary
voidclose()
StringgetSeparator()
Returns the current separator used to parse the input.
TableModelgetTableModel()
Creates the corrspondant TableModel of the input.
booleanisColumnNameFirstLine()
Tells if the first line of the input was column names.
TableModelparse()
Parses the input and stores data in a TableModel.
voidsetColumnNameFirstLine(boolean columnNameFirst)
Set if the first line of the input is column names or not.
voidsetSeparator(String separator)
Sets the separator for parsing the input.

Constructor Detail

CSVTableModelProducer

public CSVTableModelProducer(InputStream in)

CSVTableModelProducer

public CSVTableModelProducer(String filename)

CSVTableModelProducer

public CSVTableModelProducer(BufferedReader r)

Method Detail

close

public void close()

getSeparator

public String getSeparator()
Returns the current separator used to parse the input.

Returns: a regexp

getTableModel

public TableModel getTableModel()
Creates the corrspondant TableModel of the input.

Returns: the new TableModel

isColumnNameFirstLine

public boolean isColumnNameFirstLine()
Tells if the first line of the input was column names.

Returns: boolean

parse

public TableModel parse()
Parses the input and stores data in a TableModel.

See Also: this.getTableModel()

setColumnNameFirstLine

public void setColumnNameFirstLine(boolean columnNameFirst)
Set if the first line of the input is column names or not.

Parameters: columnNameFirst boolean

setSeparator

public void setSeparator(String separator)
Sets the separator for parsing the input. It can be a regexp as we use the function String.split(). The default separator is a ;.

Parameters: separator a regexp