Package org.gbif.utils.file.tabular
Class TabularFiles
java.lang.Object
org.gbif.utils.file.tabular.TabularFiles
Static utility methods related to
TabularDataFileReader instances.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic TabularDataFileReader<List<String>>newTabularFileReader(Reader reader, char delimiterChar, boolean headerLine) Get a new TabularDataFileReader using default quote char (") and default endOfLineSymbols (\n).static TabularDataFileReader<List<String>>newTabularFileReader(Reader reader, char delimiterChar, String endOfLineSymbols, Character quoteChar, boolean headerLine) Get a new TabularDataFileReader.static TabularDataFileReader<List<String>>newTabularFileReader(Reader reader, char delimiterChar, String endOfLineSymbols, Character quoteChar, boolean headerLine, Integer lineToSkipBeforeHeader) Get a new TabularDataFileReader.
-
Constructor Details
-
TabularFiles
public TabularFiles()
-
-
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- nullableheaderLine-- 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- NullableheaderLine- do we expect the first line before the data to be a header linelineToSkipBeforeHeader- 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
-