Package org.anchoranalysis.io.input.csv
Class CSVReader.OpenedCSVFile
Object
OpenedCSVFile
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
CSVReader
A CSV file that has been opened for reading from the file-system.
- Author:
- Owen File
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
String[]
The header-names of the CSV file if available.boolean
Does the first line of the CSV file specify headers rather than values?readLine()
Reads the next-line from the open CSV file.void
setNumberColumns
(int numberColumns) Sets the number of columns, if it is already known from elsewhere.
-
Constructor Details
-
OpenedCSVFile
public OpenedCSVFile()
-
-
Method Details
-
readLine
Reads the next-line from the open CSV file.- Returns:
- the line or
Optional.empty()
if there are no more lines to read. - Throws:
IOException
- if any problem occurs access the file.
-
close
- Specified by:
close
in interfaceAutoCloseable
- Throws:
CSVReaderException
-
hasHeaders
public boolean hasHeaders()Does the first line of the CSV file specify headers rather than values?- Returns:
- true iff the first line specifies headers.
-
getHeaders
The header-names of the CSV file if available.- Returns:
- an array, corresponding to each header, or
null
if no headers are available.
-
setNumberColumns
public void setNumberColumns(int numberColumns) Sets the number of columns, if it is already known from elsewhere.If no number has been assigned (or -1) it is automatically determined when reading the CSV file.
-