Class CSVTableModelProducer
- java.lang.Object
-
- org.jfree.report.modules.misc.tablemodel.CSVTableModelProducer
-
public class CSVTableModelProducer extends java.lang.ObjectCreates aTableModelusing 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
Constructors Constructor Description CSVTableModelProducer(java.io.BufferedReader r)CSVTableModelProducer(java.io.InputStream in)CSVTableModelProducer(java.lang.String filename)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()java.lang.StringgetSeparator()Returns the current separator used to parse the input.javax.swing.table.TableModelgetTableModel()Creates the corrspondant TableModel of the input.booleanisColumnNameFirstLine()Tells if the first line of the input was column names.javax.swing.table.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(java.lang.String separator)Sets the separator for parsing the input.
-
-
-
Constructor Detail
-
CSVTableModelProducer
public CSVTableModelProducer(java.io.InputStream in)
-
CSVTableModelProducer
public CSVTableModelProducer(java.lang.String filename) throws java.io.FileNotFoundException- Throws:
java.io.FileNotFoundException
-
CSVTableModelProducer
public CSVTableModelProducer(java.io.BufferedReader r)
-
-
Method Detail
-
close
public void close() throws java.io.IOException- Throws:
java.io.IOException
-
parse
public javax.swing.table.TableModel parse() throws java.io.IOExceptionParses the input and stores data in a TableModel.- Throws:
java.io.IOException
-
getSeparator
public java.lang.String getSeparator()
Returns the current separator used to parse the input.- Returns:
- a regexp
-
setSeparator
public void setSeparator(java.lang.String separator)
Sets the separator for parsing the input. It can be a regexp as we use the functionString.split(). The default separator is a;.- Parameters:
separator- a regexp
-
getTableModel
public javax.swing.table.TableModel getTableModel() throws java.io.IOExceptionCreates the corrspondant TableModel of the input.- Returns:
- the new TableModel
- Throws:
java.io.IOException
-
isColumnNameFirstLine
public boolean isColumnNameFirstLine()
Tells if the first line of the input was column names.- Returns:
- boolean
-
setColumnNameFirstLine
public void setColumnNameFirstLine(boolean columnNameFirst)
Set if the first line of the input is column names or not.- Parameters:
columnNameFirst- boolean
-
-