F - uniVocity format classCWS - uniVocity writer settings classW - uniVocity writer classCPS - uniVocity parser settings classP - uniVocity parser classDF - the data format class (for providing a fluent API)public abstract class AbstractUniVocityDataFormat<F extends com.univocity.parsers.common.Format,CWS extends com.univocity.parsers.common.CommonWriterSettings<F>,W extends com.univocity.parsers.common.AbstractWriter<CWS>,CPS extends com.univocity.parsers.common.CommonParserSettings<F>,P extends com.univocity.parsers.common.AbstractParser<CPS>,DF extends AbstractUniVocityDataFormat<F,CWS,W,CPS,P,DF>> extends Object implements org.apache.camel.spi.DataFormat
reset() method in order to clear the cache for marshalling and
unmarshalling.| Modifier and Type | Field and Description |
|---|---|
protected boolean |
asMap |
protected Character |
comment |
protected String |
emptyValue |
protected Boolean |
headerExtractionEnabled |
protected String[] |
headers |
protected boolean |
headersDisabled |
protected Boolean |
ignoreLeadingWhitespaces |
protected Boolean |
ignoreTrailingWhitespaces |
protected boolean |
lazyLoad |
protected String |
lineSeparator |
protected Character |
normalizedLineSeparator |
protected String |
nullValue |
protected Integer |
numberOfRecordsToRead |
protected Boolean |
skipEmptyLines |
| Constructor and Description |
|---|
AbstractUniVocityDataFormat() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
configureFormat(F format)
Configures the format.
|
protected void |
configureParserSettings(CPS settings)
Configure the parser settings.
|
protected void |
configureWriterSettings(CWS settings)
Configures the writer settings.
|
protected abstract P |
createParser(CPS settings)
Creates a new instance of the uniVocity parser.
|
protected abstract CPS |
createParserSettings()
Creates a new instance of the parser settings.
|
protected abstract W |
createWriter(Writer writer,
CWS settings)
Creates a new instance of the uniVocity writer.
|
protected abstract CWS |
createWriterSettings()
Creates a new instance of the writer settings.
|
Character |
getComment()
Gets the comment symbol.
|
String |
getEmptyValue()
Gets the String representation of an empty value.
|
Boolean |
getHeaderExtractionEnabled()
Gets whether or not the header extraction is enabled.
|
String[] |
getHeaders()
Gets the headers.
|
Boolean |
getIgnoreLeadingWhitespaces()
Gets whether or not leading whitespaces should be ignored.
|
Boolean |
getIgnoreTrailingWhitespaces()
Gets whether or not trailing whitespaces should be ignored.
|
String |
getLineSeparator()
Gets the line separator.
|
Character |
getNormalizedLineSeparator()
Gets the normalized line separator.
|
String |
getNullValue()
Gets the String representation of a null value.
|
Integer |
getNumberOfRecordsToRead()
Gets the number of records to read.
|
Boolean |
getSkipEmptyLines()
Gets whether or not empty lines should be ignored.
|
boolean |
isAsMap()
Gets whether or not the unmarshalling should produces maps instead of lists.
|
boolean |
isHeadersDisabled()
Gets whether or not headers are disabled.
|
boolean |
isLazyLoad()
Gets whether or not the unmarshalling should read lines lazily.
|
void |
marshal(org.apache.camel.Exchange exchange,
Object body,
OutputStream stream) |
protected void |
reset()
Resets the caches.
|
DF |
setAsMap(boolean asMap)
Sets whether or not the unmarshalling should produces maps instead of lists.
|
DF |
setComment(Character comment)
Gets the comment symbol.
|
DF |
setEmptyValue(String emptyValue)
Sets the String representation of an empty value.
|
DF |
setHeaderExtractionEnabled(Boolean headerExtractionEnabled)
Sets whether or not the header extraction is enabled.
|
DF |
setHeaders(String[] headers)
Sets the headers.
|
DF |
setHeadersDisabled(boolean headersDisabled)
Sets whether or not headers are disabled.
|
DF |
setIgnoreLeadingWhitespaces(Boolean ignoreLeadingWhitespaces)
Sets whether or not leading whitespaces should be ignored.
|
DF |
setIgnoreTrailingWhitespaces(Boolean ignoreTrailingWhitespaces)
Sets whether or not trailing whitespaces should be ignored.
|
DF |
setLazyLoad(boolean lazyLoad)
Sets whether or not the unmarshalling should read lines lazily.
|
DF |
setLineSeparator(String lineSeparator)
Sets the line separator.
|
DF |
setNormalizedLineSeparator(Character normalizedLineSeparator)
Sets the normalized line separator.
|
DF |
setNullValue(String nullValue)
Sets the String representation of a null value.
|
DF |
setNumberOfRecordsToRead(Integer numberOfRecordsToRead)
Sets the number of records to read.
|
DF |
setSkipEmptyLines(Boolean skipEmptyLines)
Sets whether or not empty lines should be ignored.
|
Object |
unmarshal(org.apache.camel.Exchange exchange,
InputStream stream) |
protected String nullValue
protected Boolean skipEmptyLines
protected Boolean ignoreTrailingWhitespaces
protected Boolean ignoreLeadingWhitespaces
protected boolean headersDisabled
protected String[] headers
protected Boolean headerExtractionEnabled
protected Integer numberOfRecordsToRead
protected String emptyValue
protected String lineSeparator
protected Character normalizedLineSeparator
protected Character comment
protected boolean lazyLoad
protected boolean asMap
public void marshal(org.apache.camel.Exchange exchange,
Object body,
OutputStream stream)
throws Exception
marshal in interface org.apache.camel.spi.DataFormatExceptionpublic Object unmarshal(org.apache.camel.Exchange exchange, InputStream stream) throws Exception
unmarshal in interface org.apache.camel.spi.DataFormatExceptionpublic String getNullValue()
null then the default settings value is used.CommonSettings.getNullValue()public DF setNullValue(String nullValue)
null then the default settings value is used.nullValue - the String representation of a null valueCommonSettings.setNullValue(String)public Boolean getSkipEmptyLines()
null then the default settings value is used.CommonSettings.getSkipEmptyLines()public DF setSkipEmptyLines(Boolean skipEmptyLines)
null then the default settings value is used.skipEmptyLines - whether or not empty lines should be ignoredCommonSettings.setSkipEmptyLines(boolean)public Boolean getIgnoreTrailingWhitespaces()
null then the default settings value is used.CommonSettings.getIgnoreTrailingWhitespaces()public DF setIgnoreTrailingWhitespaces(Boolean ignoreTrailingWhitespaces)
null then the default settings value is used.ignoreTrailingWhitespaces - whether or not trailing whitespaces should be ignoredCommonSettings.setIgnoreTrailingWhitespaces(boolean)public Boolean getIgnoreLeadingWhitespaces()
null then the default settings value is used.CommonSettings.getIgnoreLeadingWhitespaces()public DF setIgnoreLeadingWhitespaces(Boolean ignoreLeadingWhitespaces)
null then the default settings value is used.ignoreLeadingWhitespaces - whether or not leading whitespaces should be ignoredCommonSettings.setIgnoreLeadingWhitespaces(boolean)public boolean isHeadersDisabled()
true then it passes null to
CommonSettings.setHeaders(String...) in order to disabled them.CommonSettings.getHeaders()public DF setHeadersDisabled(boolean headersDisabled)
true then it passes null to
CommonSettings.setHeaders(String...) in order to disabled them.headersDisabled - whether or not headers are disabledCommonSettings.setHeaders(String...)public String[] getHeaders()
null then the default settings value is used.CommonSettings.getHeaders()public DF setHeaders(String[] headers)
null then the default settings value is used.headers - the headersCommonSettings.setHeaders(String...)public Boolean getHeaderExtractionEnabled()
null then the default settings value is used.CommonParserSettings.isHeaderExtractionEnabled()public DF setHeaderExtractionEnabled(Boolean headerExtractionEnabled)
null then the default settings value is used.headerExtractionEnabled - whether or not the header extraction is enabledCommonParserSettings.setHeaderExtractionEnabled(boolean)public Integer getNumberOfRecordsToRead()
null then the default settings value is used.CommonParserSettings.getNumberOfRecordsToRead()public DF setNumberOfRecordsToRead(Integer numberOfRecordsToRead)
null then the default settings value is used.numberOfRecordsToRead - the number of records to readCommonParserSettings.setNumberOfRecordsToRead(int)public String getEmptyValue()
null then the default settings value is used.CommonWriterSettings.getEmptyValue()public DF setEmptyValue(String emptyValue)
null then the default settings value is used.emptyValue - the String representation of an empty valueCommonWriterSettings.setEmptyValue(String)public String getLineSeparator()
null then the default format value is used.Format.getLineSeparatorString()public DF setLineSeparator(String lineSeparator)
null then the default format value is used.lineSeparator - the line separatorFormat.setLineSeparator(String)public Character getNormalizedLineSeparator()
null then the default format value is used.Format.getNormalizedNewline()public DF setNormalizedLineSeparator(Character normalizedLineSeparator)
null then the default format value is used.normalizedLineSeparator - the normalized line separatorFormat.setNormalizedNewline(char)public Character getComment()
null then the default format value is used.Format.getComment()public DF setComment(Character comment)
null then the default format value is used.comment - the comment symbolFormat.setComment(char)public boolean isLazyLoad()
public DF setLazyLoad(boolean lazyLoad)
lazyLoad - whether or not the unmarshalling should read lines lazilypublic boolean isAsMap()
public DF setAsMap(boolean asMap)
asMap - whether or not the unmarshalling should produces maps instead of listsprotected abstract CWS createWriterSettings()
protected void configureWriterSettings(CWS settings)
settings - Writer settings to configureprotected abstract W createWriter(Writer writer, CWS settings)
writer - Output writer to usesettings - Writer settings to useprotected abstract CPS createParserSettings()
protected void configureParserSettings(CPS settings)
settings - Parser settings to configureprotected abstract P createParser(CPS settings)
settings - Parser settings to useprotected void configureFormat(F format)
format - format to configureprotected void reset()
Apache Camel