public class CsvReader extends CsvBaseReader
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 |
|---|---|
CsvData |
read()
读取CSV文件,此方法只能调用一次
调用此方法的前提是构造中传入文件路径或Reader |
void |
read(CsvRowHandler rowHandler)
读取CSV数据,此方法只能调用一次
调用此方法的前提是构造中传入文件路径或Reader |
read, read, read, read, read, read, read, readMapList, setContainsHeader, setErrorOnDifferentFieldCount, setFieldSeparator, setSkipEmptyRows, setTextDelimiterpublic 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(CsvRowHandler rowHandler) throws IORuntimeException
rowHandler - 行处理器,用于一行一行的处理数据IORuntimeException - IO异常Copyright © 2021. All rights reserved.