Class CSVLineParser
- java.lang.Object
-
- fr.ens.biologie.genomique.aozan.util.CSVLineParser
-
public class CSVLineParser extends Object
This class define a line entry of a CSV file.- Since:
- 3.0
- Author:
- Laurent Jourdren
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(String fieldName)
Test if the line contains a field.String
get(String fieldName)
Get the value of a field.String
get(String fieldName, String defaultValue)
Get the value of a field.double
getDouble(String fieldName)
Get the value of a field as a double.double
getDouble(String fieldName, double defaultValue)
Get the value of a field as a double.float
getFloat(String fieldName)
Get the value of a field as a float.float
getFloat(String fieldName, float defaultValue)
Get the value of a field as a float.int
getInt(String fieldName)
Get the value of a field as an int.int
getInt(String fieldName, int defaultValue)
Get the value of a field as an integer.long
getLong(String fieldName)
Get the value of a field as a long.long
getLong(String fieldName, int defaultValue)
Get the value of a field as a long.
-
-
-
Method Detail
-
contains
public boolean contains(String fieldName)
Test if the line contains a field.- Parameters:
fieldName
- the name of the field to test- Returns:
- true if the line contains a field
-
get
public String get(String fieldName)
Get the value of a field.- Parameters:
fieldName
- the field name- Returns:
- the value of the field. Can be null
-
get
public String get(String fieldName, String defaultValue)
Get the value of a field.- Parameters:
fieldName
- the field namedefaultValue
- the default value if the field does not exists- Returns:
- the value of the field. Can be null
-
getInt
public int getInt(String fieldName)
Get the value of a field as an int.- Parameters:
fieldName
- the field name- Returns:
- the value of the field. Can be null
- Throws:
NullPointerException
- if value does not exists
-
getInt
public int getInt(String fieldName, int defaultValue)
Get the value of a field as an integer.- Parameters:
fieldName
- the field namedefaultValue
- default value if value does not exists- Returns:
- the value of the field. Can be null
- Throws:
NullPointerException
- if value is null
-
getLong
public long getLong(String fieldName)
Get the value of a field as a long.- Parameters:
fieldName
- the field name- Returns:
- the value of the field. Can be null
- Throws:
NullPointerException
- if value does not exists
-
getLong
public long getLong(String fieldName, int defaultValue)
Get the value of a field as a long.- Parameters:
fieldName
- the field namedefaultValue
- default value if value does not exists- Returns:
- the value of the field. Can be null
- Throws:
NullPointerException
- if value is null
-
getFloat
public float getFloat(String fieldName)
Get the value of a field as a float.- Parameters:
fieldName
- the field name- Returns:
- the value of the field. Can be null
- Throws:
NullPointerException
- if value does not exists
-
getFloat
public float getFloat(String fieldName, float defaultValue)
Get the value of a field as a float.- Parameters:
fieldName
- the field namedefaultValue
- default value if value does not exists- Returns:
- the value of the field. Can be null
- Throws:
NullPointerException
- if value is null
-
getDouble
public double getDouble(String fieldName)
Get the value of a field as a double.- Parameters:
fieldName
- the field name- Returns:
- the value of the field. Can be null
- Throws:
NullPointerException
- if value does not exists
-
getDouble
public double getDouble(String fieldName, double defaultValue)
Get the value of a field as a double.- Parameters:
fieldName
- the field namedefaultValue
- default value if value does not exists- Returns:
- the value of the field. Can be null
- Throws:
NullPointerException
- if value is null
-
-