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 theFlatFileParser.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
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods 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.String
get(int index)
Deprecated.In 3.15, usegetString(int)
instead or one of the other getXxx() method to return a given data type directlyDate
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()
-
-
-
Method Detail
-
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
public String 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 public String get(int index)
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
public String[] data()
The data line as an array of strings.- Since:
- 2.15
-
getString
public String getString(int index)
Get the value in the specified column.- Parameters:
index
- The index for the column, starting at 0- Returns:
- The value in the column
-
getInt
public Integer getInt(int index)
Shortcut for getInt(index, null, true)
-
getInt
public Integer getInt(int index, NumberFormat parser, boolean nullIfException)
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
public Long getLong(int index, NumberFormat parser, boolean nullIfException)
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
public Float getFloat(int index)
Shortcut for getFloat(index, null, true)
-
getFloat
public Float getFloat(int index, NumberFormat parser, boolean nullIfException)
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
public Double getDouble(int index, NumberFormat parser, boolean nullIfException)
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
-
-