Class CSVTableModelProducer
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.modules.misc.tablemodel.CSVTableModelProducer
-
public class CSVTableModelProducer extends Object
Creates aTableModel
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
Constructors Constructor Description CSVTableModelProducer(BufferedReader r)
CSVTableModelProducer(InputStream in)
CSVTableModelProducer(InputStream in, String encoding)
CSVTableModelProducer(String filename)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
String
getSeparator()
Returns the current separator used to parse the input.TableModel
getTableModel()
Creates the corrspondant TableModel of the input.boolean
isColumnNameFirstLine()
Tells if the first line of the input was column names.TableModel
parse()
Parses the input and stores data in a TableModel.void
setColumnNameFirstLine(boolean columnNameFirst)
Set if the first line of the input is column names or not.void
setSeparator(String separator)
Sets the separator for parsing the input.
-
-
-
Constructor Detail
-
CSVTableModelProducer
public CSVTableModelProducer(InputStream in)
-
CSVTableModelProducer
public CSVTableModelProducer(InputStream in, String encoding) throws UnsupportedEncodingException
- Throws:
UnsupportedEncodingException
-
CSVTableModelProducer
public CSVTableModelProducer(String filename) throws FileNotFoundException
- Throws:
FileNotFoundException
-
CSVTableModelProducer
public CSVTableModelProducer(BufferedReader r)
-
-
Method Detail
-
close
public void close() throws IOException
- Throws:
IOException
-
parse
public TableModel parse() throws IOException
Parses the input and stores data in a TableModel.- Throws:
IOException
-
getSeparator
public String getSeparator()
Returns the current separator used to parse the input.- Returns:
- a regexp
-
setSeparator
public void setSeparator(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 TableModel getTableModel() throws IOException
Creates the corrspondant TableModel of the input.- Returns:
- the new TableModel
- Throws:
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
-
-