public class TsvParserSettings extends CommonParserSettings<TsvFormat>
TsvParser)
It supports the configuration options provided by CommonParserSettings only
TsvParser,
TsvFormat,
CommonParserSettingsheaderExtractionEnabled| Constructor and Description |
|---|
TsvParserSettings() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addConfiguration(Map<String,Object> out) |
TsvParserSettings |
clone()
Clones this configuration object.
|
TsvParserSettings |
clone(boolean clearInputSpecificSettings)
Clones this configuration object to reuse user-provided settings.
|
protected TsvFormat |
createDefaultFormat()
Returns the default TsvFormat configured to handle TSV inputs
|
boolean |
isLineJoiningEnabled()
Identifies whether or lines ending with the escape character (defined by
TsvFormat.getEscapeChar()
and followed by a line separator character should be joined with the following line. |
TsvParserSettings |
setAutoConfigurationEnabled(boolean autoConfigurationEnabled)
Indicates whether this settings object can automatically derive configuration options.
|
TsvParserSettings |
setErrorContentLength(int errorContentLength)
Configures the parser/writer to limit the length of displayed contents being parsed/written in the exception message when an error occurs.
|
TsvParserSettings |
setFormat(TsvFormat format)
Defines the format of the file to be parsed/written (returns the format's defaults).
|
TsvParserSettings |
setHeaders(String... headers)
Defines the field names in the input/output, in the sequence they occur (defaults to null).
|
TsvParserSettings |
setHeadersDerivedFromClass(Class<?> headerSourceClass,
String... headers)
Defines the field names in the input/output derived from a given class with
Parsed annotated attributes/methods. |
TsvParserSettings |
setIgnoreLeadingWhitespaces(boolean ignoreLeadingWhitespaces)
Defines whether or not leading whitespaces from values being read/written should be skipped (defaults to true)
|
TsvParserSettings |
setIgnoreTrailingWhitespaces(boolean ignoreTrailingWhitespaces)
Defines whether or not trailing whitespaces from values being read/written should be skipped (defaults to true)
|
TsvParserSettings |
setLineJoiningEnabled(boolean lineJoiningEnabled)
Defines how the parser should handle escaped line separators.
|
TsvParserSettings |
setMaxCharsPerColumn(int maxCharsPerColumn)
Defines the maximum number of characters allowed for any given value being written/read.
|
TsvParserSettings |
setMaxColumns(int maxColumns)
Defines a hard limit of how many columns a record can have (defaults to 512).
|
TsvParserSettings |
setNullValue(String emptyValue)
Sets the String representation of a null value (defaults to null)
|
TsvParserSettings |
setProcessorErrorHandler(ProcessorErrorHandler<? extends Context> processorErrorHandler)
Defines a custom error handler to capture and handle errors that might happen while processing records with a
Processor
or a RowWriterProcessor (i.e. |
TsvParserSettings |
setRowProcessorErrorHandler(RowProcessorErrorHandler rowProcessorErrorHandler)
Deprecated.
Use the
setProcessorErrorHandler(ProcessorErrorHandler) method as it allows format-specific error handlers to be built to work with different implementations of Context.
Implementations based on RowProcessorErrorHandler allow only parsers who provide a ParsingContext to be used. |
TsvParserSettings |
setSkipBitsAsWhitespace(boolean skipBitsAsWhitespace)
Configures the parser to skip bit values as whitespace.
|
TsvParserSettings |
setSkipEmptyLines(boolean skipEmptyLines)
Defines whether or not empty lines should be ignored (defaults to true)
|
addInputAnalysisProcess, clearInputSpecificSettings, configureFromAnnotations, getInputAnalysisProcesses, getInputBufferSize, getNumberOfRecordsToRead, getNumberOfRowsToSkip, getProcessor, getReadInputOnSeparateThread, getRowProcessor, isAutoClosingEnabled, isBlankCommentCollectionEnabled, isColumnReorderingEnabled, isCommentCollectionEnabled, isCommentProcessingEnabled, isHeaderExtractionEnabled, isLineSeparatorDetectionEnabled, newCharAppender, newCharInputReader, setAutoClosingEnabled, setColumnReorderingEnabled, setCommentCollectionEnabled, setCommentCollectionEnabled, setCommentProcessingEnabled, setHeaderExtractionEnabled, setInputBufferSize, setLineSeparatorDetectionEnabled, setNumberOfRecordsToRead, setNumberOfRowsToSkip, setProcessor, setReadInputOnSeparateThread, setRowProcessorexcludeFields, excludeFields, excludeIndexes, getErrorContentLength, getFormat, getHeaders, getIgnoreLeadingWhitespaces, getIgnoreTrailingWhitespaces, getMaxCharsPerColumn, getMaxColumns, getNullValue, getProcessorErrorHandler, getRowProcessorErrorHandler, getSkipBitsAsWhitespace, getSkipEmptyLines, getWhitespaceRangeStart, isAutoConfigurationEnabled, isProcessorErrorHandlerDefined, selectFields, selectFields, selectIndexes, toString, trimValuespublic boolean isLineJoiningEnabled()
TsvFormat.getEscapeChar()
and followed by a line separator character should be joined with the following line.
Typical examples include inputs where lines end with sequences such as: '\'+'\n' and '\'+'\r'+'\n'.
When line joining is disabled (the default), the TsvParser converts sequences containing
the escape character (typically '\') followed by characters 'n' or 'r' into a '\n' or '\r' character.
It will continue processing the contents found in the same line, until a new line character is found.
If line joining is enabled, the TsvParser will convert sequences containing
the escape character, followed by characters '\n', '\r' or '\r\n', into a '\n' or '\r' character.
It will continue processing the contents found in the next line, until a new line character is found, given it is
not preceded by another escape character.true if line joining is enabled, otherwise falsepublic TsvParserSettings setLineJoiningEnabled(boolean lineJoiningEnabled)
TsvFormat.getEscapeChar()
and followed by a line separator character will be joined with the following line.
Typical examples include inputs where lines end with sequences such as: '\'+'\n' and '\'+'\r'+'\n'.
When line joining is disabled (the default), the TsvParser converts sequences containing
the escape character (typically '\') followed by characters 'n' or 'r' into a '\n' or '\r' character.
It will continue processing the contents found in the same line, until a new line character is found.
If line joining is enabled, the TsvParser will convert sequences containing
the escape character, followed by characters '\n', '\r' or '\r\n', into a '\n' or '\r' character.
It will continue processing the contents found in the next line, until a new line character is found, given it is
not preceded by another escape character.lineJoiningEnabled - a flag indicating whether or not to enable line joining.TsvParserSettings instancepublic TsvParserSettings setNullValue(String emptyValue)
When reading, if the parser does not read any character from the input, the nullValue is used instead of an empty string
When writing, if the writer has a null object to write to the output, the nullValue is used instead of an empty string
setNullValue in class CommonSettings<TsvFormat>emptyValue - the String representation of a null valueTsvParserSettings instancepublic TsvParserSettings setMaxCharsPerColumn(int maxCharsPerColumn)
To enable auto-expansion of the internal array, set this property to -1
setMaxCharsPerColumn in class CommonSettings<TsvFormat>maxCharsPerColumn - The maximum number of characters allowed for any given value being written/readTsvParserSettings instancepublic TsvParserSettings setSkipEmptyLines(boolean skipEmptyLines)
when reading, if the parser reads a line that is empty, it will be skipped.
when writing, if the writer receives an empty or null row to write to the output, it will be ignored
setSkipEmptyLines in class CommonSettings<TsvFormat>skipEmptyLines - true if empty lines should be ignored, false otherwiseTsvParserSettings instancepublic TsvParserSettings setIgnoreTrailingWhitespaces(boolean ignoreTrailingWhitespaces)
setIgnoreTrailingWhitespaces in class CommonSettings<TsvFormat>ignoreTrailingWhitespaces - true if trailing whitespaces from values being read/written should be skipped, false otherwiseTsvParserSettings instancepublic TsvParserSettings setIgnoreLeadingWhitespaces(boolean ignoreLeadingWhitespaces)
setIgnoreLeadingWhitespaces in class CommonSettings<TsvFormat>ignoreLeadingWhitespaces - true if leading whitespaces from values being read/written should be skipped, false otherwiseTsvParserSettings instancepublic TsvParserSettings setHeaders(String... headers)
when reading, the given header names will be used to refer to each column irrespective of whether or not the input contains a header row
when writing, the given header names will be used to refer to each column and can be used for writing the header row
setHeaders in class CommonSettings<TsvFormat>headers - the field name sequence associated with each column in the input/output.TsvParserSettings instancepublic TsvParserSettings setHeadersDerivedFromClass(Class<?> headerSourceClass, String... headers)
Parsed annotated attributes/methods.
when reading, the given header names will be used to refer to each column irrespective of whether or not the input contains a header row
when writing, the given header names will be used to refer to each column and can be used for writing the header row
setHeadersDerivedFromClass in class CommonSettings<TsvFormat>headerSourceClass - the class from which the headers have been derived.headers - the field name sequence associated with each column in the input/output.TsvParserSettings instancepublic TsvParserSettings setMaxColumns(int maxColumns)
setMaxColumns in class CommonSettings<TsvFormat>maxColumns - The maximum number of columns a record can have.TsvParserSettings instancepublic TsvParserSettings setFormat(TsvFormat format)
setFormat in class CommonSettings<TsvFormat>format - The format of the file to be parsed/writtenTsvParserSettings instancepublic final TsvParserSettings setAutoConfigurationEnabled(boolean autoConfigurationEnabled)
BeanWriterProcessor where the bean class contains a Headers annotation, or to enable header extraction when the bean class of a
BeanProcessor has attributes mapping to header names.setAutoConfigurationEnabled in class CommonSettings<TsvFormat>autoConfigurationEnabled - a flag to turn the automatic configuration feature on/off.TsvParserSettings instance@Deprecated public TsvParserSettings setRowProcessorErrorHandler(RowProcessorErrorHandler rowProcessorErrorHandler)
setProcessorErrorHandler(ProcessorErrorHandler) method as it allows format-specific error handlers to be built to work with different implementations of Context.
Implementations based on RowProcessorErrorHandler allow only parsers who provide a ParsingContext to be used.RowProcessor
or a RowWriterProcessor (i.e. non-fatal DataProcessingExceptions).
The parsing parsing/writing won't stop (unless the error handler rethrows the DataProcessingException or manually stops the process).
setRowProcessorErrorHandler in class CommonSettings<TsvFormat>rowProcessorErrorHandler - the callback error handler with custom code to manage occurrences of DataProcessingException.TsvParserSettings instancepublic TsvParserSettings setProcessorErrorHandler(ProcessorErrorHandler<? extends Context> processorErrorHandler)
Processor
or a RowWriterProcessor (i.e. non-fatal DataProcessingExceptions).
The parsing parsing/writing won't stop (unless the error handler rethrows the DataProcessingException or manually stops the process).
setProcessorErrorHandler in class CommonSettings<TsvFormat>processorErrorHandler - the callback error handler with custom code to manage occurrences of DataProcessingException.TsvParserSettings instancepublic TsvParserSettings setErrorContentLength(int errorContentLength)
If set to 0, then no exceptions will include the content being manipulated in their attributes,
and the "<omitted>" string will appear in error messages as the parsed/written content.
defaults to -1 (no limit)
setErrorContentLength in class CommonSettings<TsvFormat>errorContentLength - maximum length of contents displayed in exception messages in case of errors while parsing/writing.TsvParserSettings instancepublic final TsvParserSettings setSkipBitsAsWhitespace(boolean skipBitsAsWhitespace)
character <= ' ' evaluates to
true. This includes bit values, i.e. 0 (the \0 character) and 1 which might
be produced by database dumps. Disabling this flag will prevent the parser/writer from discarding these characters
when CommonSettings.getIgnoreLeadingWhitespaces() or CommonSettings.getIgnoreTrailingWhitespaces() evaluate to true.
defaults to true
setSkipBitsAsWhitespace in class CommonSettings<TsvFormat>skipBitsAsWhitespace - a flag indicating whether bit values (0 or 1) should be considered whitespace.TsvParserSettings instanceprotected TsvFormat createDefaultFormat()
createDefaultFormat in class CommonSettings<TsvFormat>protected void addConfiguration(Map<String,Object> out)
addConfiguration in class CommonParserSettings<TsvFormat>public final TsvParserSettings clone()
CommonSettingsCommonSettings.clone(boolean) method to reset properties that are
specific to a given input, such as header names and selection of fields.clone in class CommonParserSettings<TsvFormat>public final TsvParserSettings clone(boolean clearInputSpecificSettings)
CommonSettingsclearInputSpecificSettings flag is set to trueclone in class CommonParserSettings<TsvFormat>clearInputSpecificSettings - flag indicating whether to clear settings that are likely to be associated with a given input.Copyright © 2024. All rights reserved.