Package org.aoju.bus.office.csv
Class CsvParser
java.lang.Object
org.aoju.bus.core.collection.ComputeIterator<CsvRow>
org.aoju.bus.office.csv.CsvParser
- All Implemented Interfaces:
Closeable,Serializable,AutoCloseable,Iterator<CsvRow>
public final class CsvParser
extends org.aoju.bus.core.collection.ComputeIterator<CsvRow>
implements Closeable, Serializable
CSV行解析器,参考:FastCSV
- Since:
- Java 17+
- Author:
- Kimi Liu
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.aoju.bus.core.collection.ComputeIterator
finish, hasNext, nextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Constructor Details
-
CsvParser
CSV解析器- Parameters:
reader- Readerconfig- 配置,null则为默认配置
-
-
Method Details
-
computeNext
- Specified by:
computeNextin classorg.aoju.bus.core.collection.ComputeIterator<CsvRow>
-
getHeader
获取头部字段列表,如果headerLineNo < 0,抛出异常- Returns:
- 头部列表
- Throws:
IllegalStateException- 如果不解析头部或者没有调用nextRow()方法
-
nextRow
读取下一行数据- Returns:
- CsvRow
- Throws:
org.aoju.bus.core.exception.InternalException- IO读取异常
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-