public interface CSVFile
CSVFile file; // get it from a plug-in
// Prepare config with auto guessing of encoding etc.
CSVConfig importConfig = new CSVConfig(csvFile);
// Read header
try {
String[] header = csvFile.readHeader(importConfig);
} catch (IOException e) {
// do someting
}
// Read content
try (ICSVReader reader = csvFile.createReader(importConfig)) {
while ((nextLine = reader.readNext()) != null) {
// do something
}
}
| Modifier and Type | Method and Description |
|---|---|
ICSVReader |
createReader(CSVConfig config)
Returns a new
ICSVReader that can be used to read through the
input stream. |
ICSV |
getCSV() |
java.nio.file.Path |
getFile() |
java.lang.String |
getFilename() |
java.io.InputStream |
getInputStream() |
java.lang.String[] |
readHeader(CSVConfig config)
Returns the first row of the CSV file.
|
java.nio.file.Path getFile()
java.lang.String getFilename()
java.io.InputStream getInputStream()
throws java.io.FileNotFoundException,
java.io.IOException
java.io.FileNotFoundExceptionjava.io.IOExceptionjava.lang.String[] readHeader(CSVConfig config) throws java.io.IOException
config - java.io.IOExceptionICSVReader createReader(CSVConfig config) throws java.io.IOException
ICSVReader that can be used to read through the
input stream. The caller is responsible for calling
ICSVReader.close() on the reader.config - java.io.IOException