Package net.sf.basedb.util.parser
Class FlatFileParser.Data
java.lang.Object
net.sf.basedb.util.parser.FlatFileParser.Data
- Direct Known Subclasses:
FlatFileParser.ExcelData
- Enclosing class:
- FlatFileParser
This class holds data about a line parsed by the
FlatFileParser.hasMoreData()
method.- Version:
- 2.0
- Author:
- Nicklas
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
columns()
The number of columns as determined by theFlatFileParser.setDataSplitterRegexp(Pattern)
regular expression.String[]
data()
The data line as an array of strings.int
The line number of the data in the current section.protected String
Fix the value string according to options for 'emptyIsNull', 'nullIsNull', etc.get
(int index) Deprecated.Get the value as a date.getDouble
(int index, NumberFormat parser, boolean nullIfException) Get the value as a double.getFloat
(int index) Shortcut for getFloat(index, null, true)getFloat
(int index, NumberFormat parser, boolean nullIfException) Get the value as a float.getInt
(int index) Shortcut for getInt(index, null, true)getInt
(int index, NumberFormat parser, boolean nullIfException) Get the value as an integer.getLong
(int index, NumberFormat parser, boolean nullIfException) Get the value as a long.getString
(int index) Get the value in the specified column.line()
The entire line as it was read from the input stream.int
lineNo()
The line number of the data in the input stream.toString()
-
Field Details
-
lineNo
private final int lineNo -
dataLineNo
private final int dataLineNo -
result
-
line
-
emptyIsNull
private final boolean emptyIsNull -
nullIsNull
private final boolean nullIsNull -
trimWhiteSpace
private final boolean trimWhiteSpace
-
-
Constructor Details
-
Method Details
-
toString
-
lineNo
public int lineNo()The line number of the data in the input stream.- Returns:
- The line number
-
dataLineNo
public int dataLineNo()The line number of the data in the current section.- Returns:
- The line number
-
line
The entire line as it was read from the input stream.- Returns:
- A string
-
columns
public int columns()The number of columns as determined by theFlatFileParser.setDataSplitterRegexp(Pattern)
regular expression.- Returns:
- The number of columns in the data line
-
get
Deprecated.In 3.15, usegetString(int)
instead or one of the other getXxx() method to return a given data type directlyGet the value in the specified column.- Parameters:
index
- The index for the column, starting at 0- Returns:
- The value in the column
-
data
The data line as an array of strings.- Since:
- 2.15
-
getString
Get the value in the specified column.- Parameters:
index
- The index for the column, starting at 0- Returns:
- The value in the column
-
fixString
Fix the value string according to options for 'emptyIsNull', 'nullIsNull', etc.- Since:
- 3.15.1
-
getInt
Shortcut for getInt(index, null, true) -
getInt
Get the value as an integer. The default implementation parses the string value with the given parser. If the source file is an Excel file, the numeric value may be retrieved directly.- Since:
- 3.15
-
getLong
Get the value as a long. The default implementation parses the string value with the given parser. If the source file is an Excel file, the numeric value may be retrieved directly.- Since:
- 3.15
-
getFloat
Shortcut for getFloat(index, null, true) -
getFloat
Get the value as a float. The default implementation parses the string value with the given parser. If the source file is an Excel file, the numeric value may be retrieved directly.- Since:
- 3.15
-
getDouble
Get the value as a double. The default implementation parses the string value with the given parser. If the source file is an Excel file, the numeric value may be retrieved directly.- Since:
- 3.15
-
getDate
Get the value as a date. The default implementation parses the string value with the given parser. If the source file is an Excel file, the date value may be retrieved directly.- Since:
- 3.15
-
getString(int)
instead or one of the other getXxx() method to return a given data type directly