java.lang.Object
org.genesys.taxonomy.gringlobal.component.CabReader

public class CabReader extends Object
The helper class to read USDA-published CAB data.
  • Field Details

    • CSV_DATE_FORMAT

      public static final String CSV_DATE_FORMAT
      Date format used in the Taxonomy CSVs: 2000-12-08 00:00:00.
      See Also:
  • Constructor Details

    • CabReader

      public CabReader()
  • Method Details

    • bomSafeReader

      public static InputStreamReader bomSafeReader(InputStream inputStream) throws IOException
      Handle BOM marker in CSV files.
      Parameters:
      inputStream - the input stream
      Returns:
      a BOM-safe input stream
      Throws:
      IOException - if reading fails
    • beanReader

      public static <T> com.opencsv.bean.CsvToBean<T> beanReader(Class<T> clazz, com.opencsv.CSVReader reader)
      Bean reader.
      Type Parameters:
      T - the generic type
      Parameters:
      clazz - the clazz
      reader - the reader
      Returns:
      the csv to bean
    • openCsvReader

      public static com.opencsv.CSVReader openCsvReader(InputStream inputStream, int startAt) throws IOException
      Returns a CSVReader that properly handles GRIN-Global taxonomy files in CSV format. It converts \N to null in each row.
      Parameters:
      inputStream - the input stream
      startAt - the start row
      Returns:
      the CSV reader
      Throws:
      IOException - I/O exception