Package org.silverpeas.core.util.csv
Class CSVReader
- java.lang.Object
-
- org.silverpeas.core.util.csv.CSVReader
-
public class CSVReader extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected List<String>
colDefaultValues
protected List<String>
colMandatory
protected List<String>
colNames
protected List<String>
colTypes
protected int
nbCols
protected String
separator
protected List<String>
specificColMandatory
protected List<Integer>
specificColMaxLengths
protected List<String>
specificColNames
protected List<String>
specificColTypes
protected int
specificNbCols
protected org.silverpeas.kernel.bundle.LocalizationBundle
utilMessages
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSpecificCol(String name, int maxLength, String type, String mandatory)
int
getNbCols()
int
getSpecificColMaxLength(int i)
String
getSpecificColType(int i)
int
getSpecificNbCols()
String
getSpecificParameterName(int i)
void
initCSVFormat(String propertiesFile, String rootPropertyName, String separator)
void
initCSVFormat(String propertiesFile, String rootPropertyName, String separator, org.silverpeas.kernel.bundle.SettingBundle sP, String specificRootPropertyName, UnaryOperator<List<String>> specificFieldNameMapper)
boolean
isColumnNumberControlEnabled()
boolean
isExtraColumnsControlEnabled()
protected String[]
parseArrayValue(String arrayValue)
Variant[]
parseLine(String theLine, int lineNumber)
Variant[][]
parseStream(InputStream is)
Variant[][]
parseStream(InputStream is, boolean ignoreFirstLine)
void
setColumnNumberControlEnabled(boolean columnNumberControlEnabled)
void
setExtraColumnsControlEnabled(boolean extraColumnsControlEnabled)
void
setSpecificNbCols(int specificNbCols)
-
-
-
Field Detail
-
nbCols
protected int nbCols
-
separator
protected String separator
-
utilMessages
protected org.silverpeas.kernel.bundle.LocalizationBundle utilMessages
-
specificNbCols
protected int specificNbCols
-
-
Constructor Detail
-
CSVReader
public CSVReader(String language)
- Parameters:
language
- the language of the UI
-
-
Method Detail
-
isExtraColumnsControlEnabled
public boolean isExtraColumnsControlEnabled()
-
setExtraColumnsControlEnabled
public void setExtraColumnsControlEnabled(boolean extraColumnsControlEnabled)
-
isColumnNumberControlEnabled
public boolean isColumnNumberControlEnabled()
-
setColumnNumberControlEnabled
public void setColumnNumberControlEnabled(boolean columnNumberControlEnabled)
-
initCSVFormat
public void initCSVFormat(String propertiesFile, String rootPropertyName, String separator)
-
initCSVFormat
public void initCSVFormat(String propertiesFile, String rootPropertyName, String separator, org.silverpeas.kernel.bundle.SettingBundle sP, String specificRootPropertyName, UnaryOperator<List<String>> specificFieldNameMapper)
-
parseStream
public Variant[][] parseStream(InputStream is) throws UtilTrappedException
- Throws:
UtilTrappedException
-
parseStream
public Variant[][] parseStream(InputStream is, boolean ignoreFirstLine) throws UtilTrappedException
- Throws:
UtilTrappedException
-
parseLine
public Variant[] parseLine(String theLine, int lineNumber) throws UtilTrappedException
- Throws:
UtilTrappedException
-
getNbCols
public int getNbCols()
- Returns:
- the number of standard column.
-
getSpecificNbCols
public int getSpecificNbCols()
- Returns:
- the number of specific columns.
-
setSpecificNbCols
public void setSpecificNbCols(int specificNbCols)
- Parameters:
specificNbCols
- the number of specific columns to set.
-
getSpecificColType
public String getSpecificColType(int i)
- Returns:
- the type of specific column i.
-
getSpecificParameterName
public String getSpecificParameterName(int i)
- Returns:
- the parameter name of specific column i.
-
getSpecificColMaxLength
public int getSpecificColMaxLength(int i)
- Returns:
- the maximum length of specific column i.
-
-