Class CSVLineParser


  • public class CSVLineParser
    extends Object
    This class define a line entry of a CSV file.
    Since:
    3.0
    Author:
    Laurent Jourdren
    • 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 name
        defaultValue - 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 name
        defaultValue - 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 name
        defaultValue - 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 name
        defaultValue - 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 name
        defaultValue - default value if value does not exists
        Returns:
        the value of the field. Can be null
        Throws:
        NullPointerException - if value is null