Package org.gbif.utils.file.csv
Class CSVReaderFactory
java.lang.Object
org.gbif.utils.file.csv.CSVReaderFactory
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classData about the CSV file -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic CSVReaderAssumes 1 header rowstatic CSVReaderBuild a CSVReader and try to detect the encoding, delimiter and quotes.static CSVReaderBuild a CSVReader with specific delimiter and presence or not of a header line.static CSVReaderBuild a CSVReader with specific encoding, delimiter, quotes character and number of header row(s).static CSVReaderBuild a CSVReader with specific encoding, delimiter and number of header row(s) but default quote character (quotation marks)static CSVReaderBuild a CSVReader with specific encoding, delimiter quotes and number of header row(s)static CSVReaderbuildTabReader(InputStream stream, String encoding, Integer headerRows) static CSVReaderbuildUtf8TabReader(InputStream stream) static CSVReaderFactory.CSVMetadataextractCsvMetadata(File source, String encoding) Replaced byTabularFileMetadataExtractorExtract metadata from a CSV file.
-
Constructor Details
-
CSVReaderFactory
public CSVReaderFactory()
-
-
Method Details
-
build
Build a CSVReader with specific delimiter and presence or not of a header line. Encoding detection will be attempted.- Parameters:
source-delimiter-header- Does the file include a header line ?- Returns:
- Throws:
IOException
-
build
public static CSVReader build(File source, String encoding, String delimiter, Character quotes, Integer headerRows) throws IOException Build a CSVReader with specific encoding, delimiter, quotes character and number of header row(s).- Parameters:
source-encoding-delimiter-quotes-headerRows-- Returns:
- Throws:
IOException
-
build
public static CSVReader build(File source, String encoding, String delimiter, Integer headerRows) throws IOException Build a CSVReader with specific encoding, delimiter and number of header row(s) but default quote character (quotation marks)- Parameters:
source-encoding-delimiter-headerRows-- Returns:
- Throws:
IOException
-
build
public static CSVReader build(InputStream stream, String encoding, String delimiter, Character quotes, Integer headerRows) throws IOException Build a CSVReader with specific encoding, delimiter quotes and number of header row(s)- Parameters:
stream-encoding-delimiter-quotes-headerRows-- Returns:
- Throws:
IOException
-
build
Build a CSVReader and try to detect the encoding, delimiter and quotes.- Parameters:
source-headerRows-- Returns:
- Throws:
IOException
-
build
Assumes 1 header row- Parameters:
source-- Returns:
- Throws:
IOException
-
buildTabReader
public static CSVReader buildTabReader(InputStream stream, String encoding, Integer headerRows) throws IOException - Throws:
IOException
-
buildUtf8TabReader
- Throws:
IOException
-
extractCsvMetadata
public static CSVReaderFactory.CSVMetadata extractCsvMetadata(File source, String encoding) throws UnknownDelimitersException Replaced byTabularFileMetadataExtractorExtract metadata from a CSV file. Metadata includes delimiter and quotes character.- Parameters:
source-encoding-- Returns:
- Throws:
UnknownDelimitersException
-