AbstractParser)
By default, all parsers work with, at least, the following configuration options in addition to the ones provided by CommonSettings:
RowProcessor which handles the life cycle of the parsing process and processes each record extracted from the inputCommonSettings) should be reordered.
When disabled, each parsed record will contain values for all columns, in the order they occur in the input. Fields which were not selected will not be parsed but and the record will contain empty values.
When enabled, each parsed record will contain values only for the selected columns. The values will be ordered according to the selection.
When enabled, a reading thread (in input.concurrent.ConcurrentCharInputReader) will be started and load characters from the input, while the parser is processing its input buffer.
This yields better performance, especially when reading from big input (greater than 100 mb)
When disabled, the parsing process will briefly pause so the buffer can be replenished every time it is exhausted (in DefaultCharInputReader it is not as bad or slow as it sounds, and can even be (slightly) more efficient if your input is small)
com.univocity.parsers.common.processor.RowProcessor , com.univocity.parsers.csv.CsvParserSettings , com.univocity.parsers.fixed.FixedWidthParserSettings
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private boolean | |
| private boolean | |
| private boolean | |
| protected Boolean | |
| private List | |
| private int | |
| private boolean | |
| private long | |
| private long | |
| private Processor | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| public void | addInputAnalysisProcess(InputAnalysisProcess
a custom process to analyze the contents of the first input buffer loaded when the parsing starts. inputAnalysisProcess)Provides a custom |
| protected void | clearInputSpecificSettings()
Overrides com. |
| protected CommonParserSettings | clone(boolean
flag indicating whether to clear settings that are likely to be associated with a given input. clearInputSpecificSettings)Overrides com. |
| protected CommonParserSettings | clone()
Overrides com. |
| protected synchronized void | configureFromAnnotations(Class<?>
the classes whose annotations will be processed to derive configurations for parsing beanClass)Configures the parser based on the annotations provided in a given class |
| pack-priv FieldSelector | Returns: the FieldSelector object, which handles selected fields. Null if no field was selected/excludedOverrides com. |
| pack-priv FieldSet | Returns: the set of selected fields. Null if no field was selected/excludedOverrides com. |
| public List | Returns: the list of custom processes to analyze the contents of the first input buffer loaded when the parsing starts.Returns the sequence of |
| public int | Returns: the number of characters held by the parser's buffer when processing the inputInforms the number of characters held by the parser's buffer when processing the input (defaults to 1024*1024 characters). |
| public long | Returns: the number of records to read before stopping the parsing process.The number of valid records to be parsed before the process is stopped. |
| public final long | Returns: number of rows to skip before parsingReturns the number of rows to skip from the input before the parser can begin to execute. |
| public < the context type supported by the parser implementation. T extends Context> Processor | Returns: Returns theProcessor used by the parser to handle each recordReturns the callback implementation of the interface |
| public boolean | Returns: true if the input should be read on a separate thread, false otherwiseIndicates whether or not a separate thread will be used to read characters from the input while parsing (defaults true if the number of available processors at runtime is greater than 1) When enabled, a reading thread (in |
| public RowProcessor | Returns: Returns the RowProcessor used by the parser to handle each record
Deprecated
Use the
Returns the callback implementation of the interface getProcessor() method as it allows format-specific processors to be built to work with different implementations of Context.
RowProcessor which handles the lifecycle of the parsing process and processes each record
extracted from the input
|
| public boolean | Returns: flag indicating whether automatic input closing is enabled.Indicates whether automatic closing of the input (reader, stream, etc) is enabled. |
| public boolean | Returns: true if the selected fields should be reordered and returned by the parser, false otherwiseIndicates whether fields selected using the field selection methods (defined by the parent class |
| public boolean | Returns: a flag indicating whether or not to enable collection of comments.Indicates that comments found in the input must be collected (disabled by default). |
| public boolean | Returns: flag indicating whether parser will check for the comment line If disabled/false then parser wont treat any line as comment line including default(#) this condition will supersede the comment character(#)Indicates whether code will check for comment line in the data file is enabled. |
| public boolean | Returns: true if the first valid record parsed from the input should be considered as the row containing the names of each column, false otherwiseIndicates whether or not the first valid record parsed from the input should be considered as the row containing the names of each column |
| public final boolean | Returns: true if the first line of the input should be used to search for common line separator sequences (the matching sequence will be used as
the line separator for parsing). Otherwise false.Indicates whether the parser should detect the line separator automatically. |
| protected CharAppender | Returns: an instance of CharAppender with the configured limit of maximum characters per column and the default value used to represent a null value (when the String parsed from the input is empty)Returns an instance of CharAppender with the configured limit of maximum characters per column and the default value used to represent a null value (when the String parsed from the input is empty) |
| protected CharInputReader | Returns: The input reader as chosen with the readInputOnSeparateThread property.starting range of characters considered to be whitespace. whitespaceRangeStart)An implementation of |
| private boolean | |
| pack-priv final void | |
| public void | setAutoClosingEnabled(boolean
flag determining whether automatic input closing should be enabled. autoClosingEnabled)Configures whether the parser should always close the input (reader, stream, etc) automatically when all records have been parsed or when an error occurs. |
| public void | setColumnReorderingEnabled(boolean
the flag indicating whether or not selected fields should be reordered and returned by the parser columnReorderingEnabled)Defines whether fields selected using the field selection methods (defined by the parent class |
| public void | setCommentCollectionEnabled(boolean
flag indicating whether or not to enable collection of comments. commentCollectionEnabled)Enables collection of comments found in the input (disabled by default). |
| public void | setCommentProcessingEnabled(boolean
flag determining whether comment line check should be performed
If disabled/false then parser wont treat any line as comment line including default(#)
this condition will supersede the comment character(#) commentProcessingEnabled)Configures whether the parser will check for the comment line in the file
Defaults to |
| public void | setHeaderExtractionEnabled(boolean
a flag indicating whether the first valid record parsed from the input should be considered as the row containing the
names of each column headerExtractionEnabled)Defines whether or not the first valid record parsed from the input should be considered as the row containing the names of each column |
| public void | setInputBufferSize(int
the new input buffer size (in number of characters) inputBufferSize)Defines the number of characters held by the parser's buffer when processing the input (defaults to 1024*1024 characters). |
| public final void | setLineSeparatorDetectionEnabled(boolean
a flag indicating whether the first line of the input should be used to search for common line separator sequences
(the matching sequence will be used as the line separator for parsing). lineSeparatorDetectionEnabled)Defines whether the parser should detect the line separator automatically. |
| public void | setNumberOfRecordsToRead(long
the number of records to read before stopping the parsing process. numberOfRecordsToRead)Defines the number of valid records to be parsed before the process is stopped. |
| public final void | setNumberOfRowsToSkip(long
number of rows to skip before parsing numberOfRowsToSkip)Defines a number of rows to skip from the input before the parser can begin to execute. |
| public void | setProcessor(Processor<? extends Context>
the processor)Processor instance which should used by the parser to handle each recordDefines the callback implementation of the interface |
| public void | setReadInputOnSeparateThread(boolean
the flag indicating whether or not the input should be read on a separate thread readInputOnSeparateThread)Defines whether or not a separate thread will be used to read characters from the input while parsing (defaults true if the number of available processors at runtime is greater than 1) When enabled, a reading thread (in |
| public void | setRowProcessor(RowProcessor
the RowProcessor instance which should used by the parser to handle each record processor)
Deprecated
Use the
Defines the callback implementation of the interface setProcessor(Processor) method as it allows format-specific processors to be built to work with different implementations of
Context.
RowProcessor which handles the lifecycle of the parsing process and processes each record
extracted from the input
|
| autoClosingEnabled | back to summary |
|---|---|
| private boolean autoClosingEnabled | |
| columnReorderingEnabled | back to summary |
|---|---|
| private boolean columnReorderingEnabled | |
| commentCollectionEnabled | back to summary |
|---|---|
| private boolean commentCollectionEnabled | |
| commentProcessingEnabled | back to summary |
|---|---|
| private boolean commentProcessingEnabled | |
| headerExtractionEnabled | back to summary |
|---|---|
| protected Boolean headerExtractionEnabled | |
| inputAnalysisProcesses | back to summary |
|---|---|
| private List<InputAnalysisProcess> inputAnalysisProcesses | |
| inputBufferSize | back to summary |
|---|---|
| private int inputBufferSize | |
| lineSeparatorDetectionEnabled | back to summary |
|---|---|
| private boolean lineSeparatorDetectionEnabled | |
| numberOfRecordsToRead | back to summary |
|---|---|
| private long numberOfRecordsToRead | |
| numberOfRowsToSkip | back to summary |
|---|---|
| private long numberOfRowsToSkip | |
| processor | back to summary |
|---|---|
| private Processor<? extends Context> processor | |
| readInputOnSeparateThread | back to summary |
|---|---|
| private boolean readInputOnSeparateThread | |
| CommonParserSettings | back to summary |
|---|---|
| public CommonParserSettings() | |
| addConfiguration | back to summary |
|---|---|
| protected void addConfiguration(Map<String, Object> out) Overrides com.
| |
| addInputAnalysisProcess | back to summary |
|---|---|
| public void addInputAnalysisProcess(InputAnalysisProcess inputAnalysisProcess) Provides a custom
| |
| clearInputSpecificSettings | back to summary |
|---|---|
| protected void clearInputSpecificSettings() Overrides com. Doc from com. Clears settings that are likely to be specific to a given input.
| |
| clone | back to summary |
|---|---|
| protected CommonParserSettings Overrides com. Doc from com. Clones this configuration object to reuse user-provided settings.
Properties that are specific to a given input (such as header names and selection of fields) can be reset to their defaults
if the
| |
| clone | back to summary |
|---|---|
| protected CommonParserSettings Overrides com. Doc from com. Clones this configuration object. Use alternative
| |
| configureFromAnnotations | back to summary |
|---|---|
| protected synchronized void configureFromAnnotations(Class<?> beanClass) Configures the parser based on the annotations provided in a given class
| |
| getFieldSelector | back to summary |
|---|---|
| pack-priv FieldSelector getFieldSelector() Overrides com. Returns the FieldSelector object, which handles selected fields.
| |
| getFieldSet | back to summary |
|---|---|
| pack-priv FieldSet Overrides com. Returns the set of selected fields, if any | |
| getInputAnalysisProcesses | back to summary |
|---|---|
| public List Returns the sequence of
| |
| getInputBufferSize | back to summary |
|---|---|
| public int getInputBufferSize() Informs the number of characters held by the parser's buffer when processing the input (defaults to 1024*1024 characters).
| |
| getNumberOfRecordsToRead | back to summary |
|---|---|
| public long getNumberOfRecordsToRead() The number of valid records to be parsed before the process is stopped. A negative value indicates there's no limit (defaults to -1).
| |
| getNumberOfRowsToSkip | back to summary |
|---|---|
| public final long getNumberOfRowsToSkip() Returns the number of rows to skip from the input before the parser can begin to execute.
| |
| getProcessor | back to summary |
|---|---|
| public <T extends Context> Processor Returns the callback implementation of the interface
| |
| getReadInputOnSeparateThread | back to summary |
|---|---|
| public boolean getReadInputOnSeparateThread() Indicates whether or not a separate thread will be used to read characters from the input while parsing (defaults true if the number of available processors at runtime is greater than 1) When enabled, a reading thread (in When disabled, the parsing process will briefly pause so the buffer can be replenished every time it is exhausted
(in
| |
| getRowProcessor | back to summary |
|---|---|
| public RowProcessor getRowProcessor()
Deprecated Use the Returns the callback implementation of the interface
| |
| isAutoClosingEnabled | back to summary |
|---|---|
| public boolean isAutoClosingEnabled() Indicates whether automatic closing of the input (reader, stream, etc)
is enabled. If
| |
| isColumnReorderingEnabled | back to summary |
|---|---|
| public boolean isColumnReorderingEnabled() Indicates whether fields selected using the field selection methods (defined by the parent class When disabled, each parsed record will contain values for all columns, in the order they occur in the input. Fields which were not selected will not be parsed but and the record will contain empty values. When enabled, each parsed record will contain values only for the selected columns. The values will be ordered according to the selection.
| |
| isCommentCollectionEnabled | back to summary |
|---|---|
| public boolean isCommentCollectionEnabled() Indicates that comments found in the input must be collected (disabled by default). If enabled, comment lines will be
stored by the parser and made available via
| |
| isCommentProcessingEnabled | back to summary |
|---|---|
| public boolean isCommentProcessingEnabled() Indicates whether code will check for comment line in the data file
is enabled. If
| |
| isHeaderExtractionEnabled | back to summary |
|---|---|
| public boolean isHeaderExtractionEnabled() Indicates whether or not the first valid record parsed from the input should be considered as the row containing the names of each column
| |
| isLineSeparatorDetectionEnabled | back to summary |
|---|---|
| public final boolean isLineSeparatorDetectionEnabled() Indicates whether the parser should detect the line separator automatically.
| |
| newCharAppender | back to summary |
|---|---|
| protected CharAppender newCharAppender() Returns an instance of CharAppender with the configured limit of maximum characters per column and the default value used to represent a null value (when the String parsed from the input is empty)
| |
| newCharInputReader | back to summary |
|---|---|
| protected CharInputReader newCharInputReader(int whitespaceRangeStart) An implementation of
| |
| preventReordering | back to summary |
|---|---|
| private boolean preventReordering() | |
| runAutomaticConfiguration | back to summary |
|---|---|
| pack-priv final void runAutomaticConfiguration() Overrides com.
| |
| setAutoClosingEnabled | back to summary |
|---|---|
| public void setAutoClosingEnabled(boolean autoClosingEnabled) Configures whether the parser should always close the input (reader, stream, etc) automatically
when all records have been parsed or when an error occurs.
Defaults to
| |
| setColumnReorderingEnabled | back to summary |
|---|---|
| public void setColumnReorderingEnabled(boolean columnReorderingEnabled) Defines whether fields selected using the field selection methods (defined by the parent class When disabled, each parsed record will contain values for all columns, in the order they occur in the input. Fields which were not selected will not be parsed but the record will contain empty values. When enabled, each parsed record will contain values only for the selected columns. The values will be ordered according to the selection.
| |
| setCommentCollectionEnabled | back to summary |
|---|---|
| public void setCommentCollectionEnabled(boolean commentCollectionEnabled) Enables collection of comments found in the input (disabled by default). If enabled, comment lines will be
stored by the parser and made available via
| |
| setCommentProcessingEnabled | back to summary |
|---|---|
| public void setCommentProcessingEnabled(boolean commentProcessingEnabled) Configures whether the parser will check for the comment line in the file
Defaults to
| |
| setHeaderExtractionEnabled | back to summary |
|---|---|
| public void setHeaderExtractionEnabled(boolean headerExtractionEnabled) Defines whether or not the first valid record parsed from the input should be considered as the row containing the names of each column
| |
| setInputBufferSize | back to summary |
|---|---|
| public void setInputBufferSize(int inputBufferSize) Defines the number of characters held by the parser's buffer when processing the input (defaults to 1024*1024 characters).
| |
| setLineSeparatorDetectionEnabled | back to summary |
|---|---|
| public final void setLineSeparatorDetectionEnabled(boolean lineSeparatorDetectionEnabled) Defines whether the parser should detect the line separator automatically.
| |
| setNumberOfRecordsToRead | back to summary |
|---|---|
| public void setNumberOfRecordsToRead(long numberOfRecordsToRead) Defines the number of valid records to be parsed before the process is stopped. A negative value indicates there's no limit (defaults to -1).
| |
| setNumberOfRowsToSkip | back to summary |
|---|---|
| public final void setNumberOfRowsToSkip(long numberOfRowsToSkip) Defines a number of rows to skip from the input before the parser can begin to execute.
| |
| setProcessor | back to summary |
|---|---|
| public void setProcessor(Processor<? extends Context> processor) Defines the callback implementation of the interface | |
| setReadInputOnSeparateThread | back to summary |
|---|---|
| public void setReadInputOnSeparateThread(boolean readInputOnSeparateThread) Defines whether or not a separate thread will be used to read characters from the input while parsing (defaults true if the number of available processors at runtime is greater than 1) When enabled, a reading thread (in When disabled, the parsing process will briefly pause so the buffer can be replenished every time it is exhausted (in
| |
| setRowProcessor | back to summary |
|---|---|
| public void setRowProcessor(RowProcessor processor)
Deprecated Use the Defines the callback implementation of the interface
| |