public class CSVReader extends Object implements StructuredFileReader
Constructor and Description |
---|
CSVReader() |
CSVReader(CSVSettings settings) |
CSVReader(Element config) |
CSVReader(InputStream input) |
CSVReader(InputStream input,
Charset charset) |
CSVReader(InputStream input,
CSVSettings settings) |
CSVReader(Reader input) |
CSVReader(Reader input,
CSVSettings settings) |
Modifier and Type | Method and Description |
---|---|
void |
close()
closes the underlying IO-structures and releases any resources.
|
Object |
get(int index)
returns the field with the given index of the current record
|
Object |
get(String columnName)
returns the field with the given name of the current record
is only working if headers are set
|
String |
getRowComment() |
int |
getRowCount()
returns the current amount of successfully read rows
|
CSVSettings |
getSettings()
returns the settings applied to this reader
|
Map<String,Object> |
getValueMap()
gets the current record's values mapped to the column names
if the column names aren't unique, the values may be overwritten
|
boolean |
readRecord()
reads the next record
data will be available thru
get(int) and get(String) |
void |
skipRecord()
skips one record
|
void |
skipRecords(int count)
skips count records
|
public CSVReader()
public CSVReader(CSVSettings settings)
settings
- to usepublic CSVReader(Element config) throws InstantiationException, IllegalAccessException, ClassNotFoundException
public CSVReader(InputStream input)
input
- the stream to read frompublic CSVReader(InputStream input, Charset charset)
input
- the stream to read fromcharset
- the charset to usepublic CSVReader(InputStream input, CSVSettings settings)
input
- the stream to read fromsettings
- the settings to usepublic CSVReader(Reader input)
input
- the reader to read frompublic CSVReader(Reader input, CSVSettings settings)
input
- the reader to read fromsettings
- the settings to usepublic Object get(int index)
index
- public Object get(String columnName)
columnName
- public int getRowCount()
StructuredFileReader
getRowCount
in interface StructuredFileReader
public CSVSettings getSettings()
StructuredFileReader
getSettings
in interface StructuredFileReader
public Map<String,Object> getValueMap()
StructuredFileReader
getValueMap
in interface StructuredFileReader
public boolean readRecord() throws IOException
get(int)
and get(String)
readRecord
in interface StructuredFileReader
IOException
public void skipRecord() throws IOException
IOException
public void skipRecords(int count) throws IOException
count
- IOException
public void close() throws IOException
StructuredFileReader
close
in interface StructuredFileReader
close
in interface AutoCloseable
IOException
public String getRowComment()
@enterprise 10.0.39049 Copyright © 2024 FREQUENTIS AG. All Rights Reserved.