public final class CsvParser extends ComputeIterator<CsvRow> implements Closeable, Serializable
| Constructor and Description |
|---|
CsvParser(Reader reader,
CsvReadConfig config)
CSV解析器
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected CsvRow |
computeNext()
计算新的节点,通过实现此方法,当调用
ComputeIterator.hasNext()时将此方法产生的节点缓存,直到调用ComputeIterator.next()取出
当无下一个节点时,须返回null表示遍历结束 |
List<String> |
getHeader()
获取头部字段列表,如果containsHeader设置为false则抛出异常
|
CsvRow |
nextRow()
读取下一行数据
|
finish, hasNext, nextclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEachRemaining, removepublic CsvParser(Reader reader, CsvReadConfig config)
reader - Readerconfig - 配置,null则为默认配置protected CsvRow computeNext()
ComputeIteratorComputeIterator.hasNext()时将此方法产生的节点缓存,直到调用ComputeIterator.next()取出
当无下一个节点时,须返回null表示遍历结束computeNext in class ComputeIterator<CsvRow>public List<String> getHeader()
IllegalStateException - 如果不解析头部或者没有调用nextRow()方法public CsvRow nextRow() throws InstrumentException
InstrumentException - IO读取异常public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2021. All rights reserved.