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 long
characterOffset
private CSVFormat
format
private long
recordNumber
private boolean
trackBytes
-
Constructor Summary
Constructors Modifier Constructor Description protected
Builder()
Constructs a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CSVParser
get()
CSVParser.Builder
setCharacterOffset(long characterOffset)
Sets the lexer offset when the parser does not start parsing at the beginning of the source.CSVParser.Builder
setFormat(CSVFormat format)
Sets the CSV format.CSVParser.Builder
setRecordNumber(long recordNumber)
Sets the next record number to assign, defaults to1
.CSVParser.Builder
setTrackBytes(boolean trackBytes)
Sets whether to enable byte tracking for the parser.-
Methods inherited from class org.apache.commons.io.build.AbstractStreamBuilder
getBufferSize, getBufferSizeDefault, 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, newCharSequenceOrigin, newFileOrigin, newFileOrigin, newInputStreamOrigin, newOutputStreamOrigin, newPathOrigin, newPathOrigin, newRandomAccessFileOrigin, newRandomAccessFileOrigin, newReaderOrigin, newURIOrigin, newWriterOrigin, setByteArray, 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,null
resets 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
-true
to enable byte tracking;false
to disable it.- Returns:
- this instance.
- Since:
- 1.13.0
-
-