Package org.apache.commons.csv
Class CSVParser.Builder
- java.lang.Object
-
- org.apache.commons.io.build.AbstractSupplier<T,B>
-
- org.apache.commons.io.build.AbstractOriginSupplier<T,B>
-
- org.apache.commons.io.build.AbstractStreamBuilder<CSVParser,CSVParser.Builder>
-
- org.apache.commons.csv.CSVParser.Builder
-
- All Implemented Interfaces:
org.apache.commons.io.function.IOSupplier<CSVParser>
- Enclosing class:
- CSVParser
public static class CSVParser.Builder extends org.apache.commons.io.build.AbstractStreamBuilder<CSVParser,CSVParser.Builder>
Builds a newCSVParser.- Since:
- 1.13.0
-
-
Field Summary
Fields Modifier and Type Field Description private longcharacterOffsetprivate CSVFormatformatprivate longrecordNumberprivate booleantrackBytes
-
Constructor Summary
Constructors Modifier Constructor Description protectedBuilder()Constructs a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CSVParserget()CSVParser.BuildersetCharacterOffset(long characterOffset)Sets the lexer offset when the parser does not start parsing at the beginning of the source.CSVParser.BuildersetFormat(CSVFormat format)Sets the CSV format.CSVParser.BuildersetRecordNumber(long recordNumber)Sets the next record number to assign, defaults to1.CSVParser.BuildersetTrackBytes(boolean trackBytes)Sets whether to enable byte tracking for the parser.-
Methods inherited from class org.apache.commons.io.build.AbstractStreamBuilder
getBufferSize, getBufferSizeDefault, getChannel, getCharSequence, getCharset, getCharsetDefault, getFile, getInputStream, getOpenOptions, getOutputStream, getPath, getRandomAccessFile, getReader, getWriter, setBufferSize, setBufferSize, setBufferSizeChecker, setBufferSizeDefault, setBufferSizeMax, setCharset, setCharset, setCharsetDefault, setOpenOptions
-
Methods inherited from class org.apache.commons.io.build.AbstractOriginSupplier
checkOrigin, getOrigin, hasOrigin, newByteArrayOrigin, newChannelOrigin, newCharSequenceOrigin, newFileOrigin, newFileOrigin, newInputStreamOrigin, newOutputStreamOrigin, newPathOrigin, newPathOrigin, newRandomAccessFileOrigin, newRandomAccessFileOrigin, newReaderOrigin, newURIOrigin, newWriterOrigin, setByteArray, setChannel, setCharSequence, setFile, setFile, setInputStream, setOrigin, setOutputStream, setPath, setPath, setRandomAccessFile, setRandomAccessFile, setReader, setURI, setWriter
-
-
-
-
Field Detail
-
format
private CSVFormat format
-
characterOffset
private long characterOffset
-
recordNumber
private long recordNumber
-
trackBytes
private boolean trackBytes
-
-
Method Detail
-
get
public CSVParser get() throws java.io.IOException
- Throws:
java.io.IOException
-
setCharacterOffset
public CSVParser.Builder setCharacterOffset(long characterOffset)
Sets the lexer offset when the parser does not start parsing at the beginning of the source.- Parameters:
characterOffset- the lexer offset.- Returns:
- this instance.
-
setFormat
public CSVParser.Builder setFormat(CSVFormat format)
Sets the CSV format. A copy of the given format is kept.- Parameters:
format- the CSV format,nullresets toCSVFormat.DEFAULT.- Returns:
- this instance.
-
setRecordNumber
public CSVParser.Builder setRecordNumber(long recordNumber)
Sets the next record number to assign, defaults to1.- Parameters:
recordNumber- the next record number to assign.- Returns:
- this instance.
-
setTrackBytes
public CSVParser.Builder setTrackBytes(boolean trackBytes)
Sets whether to enable byte tracking for the parser.- Parameters:
trackBytes-trueto enable byte tracking;falseto disable it.- Returns:
- this instance.
- Since:
- 1.13.0
-
-