public class CsvReader extends CsvBaseReader implements Iterable<CsvRow>, Closeable
DEFAULT_CHARSET| Constructor and Description |
|---|
CsvReader()
构造,使用默认配置项
|
CsvReader(CsvReadConfig config)
构造
|
CsvReader(File file,
Charset charset,
CsvReadConfig config)
构造
|
CsvReader(File file,
CsvReadConfig config)
|
CsvReader(Path path,
Charset charset,
CsvReadConfig config)
构造
|
CsvReader(Path path,
CsvReadConfig config)
|
CsvReader(Reader reader,
CsvReadConfig config)
构造
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
Iterator<CsvRow> |
iterator() |
CsvData |
read()
读取CSV文件,此方法只能调用一次
调用此方法的前提是构造中传入文件路径或Reader |
void |
read(SerConsumer<CsvRow> rowHandler)
读取CSV数据,此方法只能调用一次
调用此方法的前提是构造中传入文件路径或Reader |
Stream<CsvRow> |
stream()
根据Reader创建
Stream,以便使用stream方式读取csv行 |
parse, read, read, read, read, read, read, read, read, readFromStr, readFromStr, readMapList, setContainsHeader, setErrorOnDifferentFieldCount, setFieldSeparator, setSkipEmptyRows, setTextDelimiterclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic CsvReader()
public CsvReader(CsvReadConfig config)
config - 配置项public CsvReader(File file, CsvReadConfig config)
file - CSV文件路径,null表示不设置路径config - 配置项,null表示默认配置public CsvReader(Path path, CsvReadConfig config)
path - CSV文件路径,null表示不设置路径config - 配置项,null表示默认配置public CsvReader(File file, Charset charset, CsvReadConfig config)
file - CSV文件路径,null表示不设置路径charset - 编码config - 配置项,null表示默认配置public CsvReader(Path path, Charset charset, CsvReadConfig config)
path - CSV文件路径,null表示不设置路径charset - 编码config - 配置项,null表示默认配置public CsvReader(Reader reader, CsvReadConfig config)
reader - Reader,null表示不设置默认readerconfig - 配置项,null表示默认配置public CsvData read() throws IORuntimeException
CsvData,包含数据列表和行信息IORuntimeException - IO异常public void read(SerConsumer<CsvRow> rowHandler) throws IORuntimeException
rowHandler - 行处理器,用于一行一行的处理数据IORuntimeException - IO异常public Stream<CsvRow> stream()
Stream,以便使用stream方式读取csv行Streampublic void close()
close in interface Closeableclose in interface AutoCloseableCopyright © 2025. All rights reserved.