Class 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 new CSVParser.
    Since:
    1.13.0
    • 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 to 1.
      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
      • Methods inherited from class org.apache.commons.io.build.AbstractSupplier

        asThis
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.apache.commons.io.function.IOSupplier

        asSupplier, getUnchecked
    • Field Detail

      • characterOffset

        private long characterOffset
      • recordNumber

        private long recordNumber
      • trackBytes

        private boolean trackBytes
    • Constructor Detail

      • Builder

        protected Builder()
        Constructs a new instance.
    • 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 is equivalent to CSVFormat.DEFAULT.
        Returns:
        this instance.
      • setRecordNumber

        public CSVParser.Builder setRecordNumber​(long recordNumber)
        Sets the next record number to assign, defaults to 1.
        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