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
public static class FlatFileParser.Data extends Object
This class holds data about a line parsed by the
FlatFileParser.hasMoreData()
method.- Version:
- 2.0
- Author:
- Nicklas
- See Also:
FlatFileParser.nextData()
-
Field Summary
Fields Modifier and Type Field Description private int
dataLineNo
private boolean
emptyIsNull
private String
line
private int
lineNo
private boolean
nullIsNull
private String[]
result
private boolean
trimWhiteSpace
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description int
columns()
The number of columns as determined by theFlatFileParser.setDataSplitterRegexp(Pattern)
regular expression.String[]
data()
The data line as an array of strings.int
dataLineNo()
The line number of the data in the current section.protected String
fixString(String value)
Fix the value string according to options for 'emptyIsNull', 'nullIsNull', etc.String
get(int index)
Deprecated.Date
getDate(int index, Formatter<Date> parser, boolean nullIfException)
Get the value as a date.Double
getDouble(int index, NumberFormat parser, boolean nullIfException)
Get the value as a double.Float
getFloat(int index)
Shortcut for getFloat(index, null, true)Float
getFloat(int index, NumberFormat parser, boolean nullIfException)
Get the value as a float.Integer
getInt(int index)
Shortcut for getInt(index, null, true)Integer
getInt(int index, NumberFormat parser, boolean nullIfException)
Get the value as an integer.Long
getLong(int index, NumberFormat parser, boolean nullIfException)
Get the value as a long.String
getString(int index)
Get the value in the specified column.String
line()
The entire line as it was read from the input stream.int
lineNo()
The line number of the data in the input stream.String
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