Class TabularFiles

java.lang.Object
org.gbif.utils.file.tabular.TabularFiles

public class TabularFiles extends Object
Static utility methods related to TabularDataFileReader instances.
  • Constructor Details

  • Method Details

    • newTabularFileReader

      public static TabularDataFileReader<List<String>> newTabularFileReader(Reader reader, char delimiterChar, String endOfLineSymbols, Character quoteChar, boolean headerLine) throws IOException
      Get a new TabularDataFileReader.
      Parameters:
      reader -
      delimiterChar -
      endOfLineSymbols -
      quoteChar - nullable
      headerLine -
      Returns:
      Throws:
      IOException
    • newTabularFileReader

      public static TabularDataFileReader<List<String>> newTabularFileReader(Reader reader, char delimiterChar, String endOfLineSymbols, Character quoteChar, boolean headerLine, Integer lineToSkipBeforeHeader) throws IOException
      Get a new TabularDataFileReader.
      Parameters:
      reader -
      delimiterChar -
      endOfLineSymbols -
      quoteChar - Nullable
      headerLine - do we expect the first line before the data to be a header line
      lineToSkipBeforeHeader - Nullable. How many line(s) is required to skip in the file before reading the header or the data. This can be used to skip a comment block but if there is a header line, the comment block shall be before the header.
      Returns:
      Throws:
      IOException
    • newTabularFileReader

      public static TabularDataFileReader<List<String>> newTabularFileReader(Reader reader, char delimiterChar, boolean headerLine) throws IOException
      Get a new TabularDataFileReader using default quote char (") and default endOfLineSymbols (\n). Usage:
       
       try (TabularDataFileReader<List<String>> reader = TabularFiles.newTabularFileReader(
       Files.newBufferedReader(Paths.get("/tmp/test.csv"), StandardCharsets.UTF_8), ',', true)) {
       ...
       }
       
       
      Parameters:
      reader -
      delimiterChar -
      headerLine -
      Throws:
      IOException