Class UniVocityFixedWidthDataFormat
- java.lang.Object
-
- org.apache.camel.support.service.BaseService
-
- org.apache.camel.support.service.ServiceSupport
-
- org.apache.camel.dataformat.univocity.AbstractUniVocityDataFormat<com.univocity.parsers.fixed.FixedWidthFormat,com.univocity.parsers.fixed.FixedWidthWriterSettings,com.univocity.parsers.fixed.FixedWidthWriter,com.univocity.parsers.fixed.FixedWidthParserSettings,com.univocity.parsers.fixed.FixedWidthParser,UniVocityFixedWidthDataFormat>
-
- org.apache.camel.dataformat.univocity.UniVocityFixedWidthDataFormat
-
- All Implemented Interfaces:
AutoCloseable
,org.apache.camel.Service
,org.apache.camel.ShutdownableService
,org.apache.camel.spi.DataFormat
,org.apache.camel.spi.DataFormatName
,org.apache.camel.StatefulService
,org.apache.camel.SuspendableService
@Dataformat("univocity-fixed") public class UniVocityFixedWidthDataFormat extends AbstractUniVocityDataFormat<com.univocity.parsers.fixed.FixedWidthFormat,com.univocity.parsers.fixed.FixedWidthWriterSettings,com.univocity.parsers.fixed.FixedWidthWriter,com.univocity.parsers.fixed.FixedWidthParserSettings,com.univocity.parsers.fixed.FixedWidthParser,UniVocityFixedWidthDataFormat>
This class is the data format that uses the fixed-width uniVocity parser.
-
-
Field Summary
Fields Modifier and Type Field Description protected int[]
fieldLengths
protected Character
padding
protected Boolean
recordEndsOnNewline
protected Boolean
skipTrailingCharsUntilNewline
-
Fields inherited from class org.apache.camel.dataformat.univocity.AbstractUniVocityDataFormat
asMap, comment, emptyValue, headerExtractionEnabled, headers, headersDisabled, ignoreLeadingWhitespaces, ignoreTrailingWhitespaces, lazyLoad, lineSeparator, normalizedLineSeparator, nullValue, numberOfRecordsToRead, skipEmptyLines
-
-
Constructor Summary
Constructors Constructor Description UniVocityFixedWidthDataFormat()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
configureFormat(com.univocity.parsers.fixed.FixedWidthFormat format)
Configures the format.protected void
configureParserSettings(com.univocity.parsers.fixed.FixedWidthParserSettings settings)
Configure the parser settings.protected com.univocity.parsers.fixed.FixedWidthParser
createParser(com.univocity.parsers.fixed.FixedWidthParserSettings settings)
Creates a new instance of the uniVocity parser.protected com.univocity.parsers.fixed.FixedWidthParserSettings
createParserSettings()
Creates a new instance of the parser settings.protected com.univocity.parsers.fixed.FixedWidthWriter
createWriter(Writer writer, com.univocity.parsers.fixed.FixedWidthWriterSettings settings)
Creates a new instance of the uniVocity writer.protected com.univocity.parsers.fixed.FixedWidthWriterSettings
createWriterSettings()
Creates a new instance of the writer settings.String
getDataFormatName()
int[]
getFieldLengths()
Gets the field lengths.Character
getPadding()
Gets the padding symbol.Boolean
getRecordEndsOnNewline()
Gets whether or not the record ends on new line.Boolean
getSkipTrailingCharsUntilNewline()
Gets whether or not trailing characters until new line must be ignored.UniVocityFixedWidthDataFormat
setFieldLengths(int[] fieldLengths)
Sets the field lengths It's used to construct uniVocityFixedWidthFields
instance.UniVocityFixedWidthDataFormat
setPadding(Character padding)
Sets the padding symbol.UniVocityFixedWidthDataFormat
setRecordEndsOnNewline(Boolean recordEndsOnNewline)
Sets whether or not the record ends on new lineUniVocityFixedWidthDataFormat
setSkipTrailingCharsUntilNewline(Boolean skipTrailingCharsUntilNewline)
Sets whether or not trailing characters until new line must be ignored.-
Methods inherited from class org.apache.camel.dataformat.univocity.AbstractUniVocityDataFormat
configureWriterSettings, doStart, doStop, getComment, getEmptyValue, getHeaderExtractionEnabled, getHeaders, getIgnoreLeadingWhitespaces, getIgnoreTrailingWhitespaces, getLineSeparator, getNormalizedLineSeparator, getNullValue, getNumberOfRecordsToRead, getSkipEmptyLines, isAsMap, isHeadersDisabled, isLazyLoad, marshal, setAsMap, setComment, setEmptyValue, setHeaderExtractionEnabled, setHeaders, setHeadersDisabled, setIgnoreLeadingWhitespaces, setIgnoreTrailingWhitespaces, setLazyLoad, setLineSeparator, setNormalizedLineSeparator, setNullValue, setNumberOfRecordsToRead, setSkipEmptyLines, unmarshal
-
Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doInit, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Method Detail
-
getFieldLengths
public int[] getFieldLengths()
Gets the field lengths. It's used to construct uniVocityFixedWidthFields
instance.- Returns:
- the field lengths
-
setFieldLengths
public UniVocityFixedWidthDataFormat setFieldLengths(int[] fieldLengths)
Sets the field lengths It's used to construct uniVocityFixedWidthFields
instance.- Parameters:
fieldLengths
- the field length- Returns:
- current data format instance, fluent API
-
getSkipTrailingCharsUntilNewline
public Boolean getSkipTrailingCharsUntilNewline()
Gets whether or not trailing characters until new line must be ignored.- Returns:
- whether or not trailing characters until new line must be ignored
- See Also:
FixedWidthParserSettings.getSkipTrailingCharsUntilNewline()
-
setSkipTrailingCharsUntilNewline
public UniVocityFixedWidthDataFormat setSkipTrailingCharsUntilNewline(Boolean skipTrailingCharsUntilNewline)
Sets whether or not trailing characters until new line must be ignored.- Parameters:
skipTrailingCharsUntilNewline
- whether or not trailing characters until new line must be ignored- Returns:
- current data format instance, fluent API
- See Also:
FixedWidthParserSettings.setSkipTrailingCharsUntilNewline(boolean)
-
getRecordEndsOnNewline
public Boolean getRecordEndsOnNewline()
Gets whether or not the record ends on new line.- Returns:
- whether or not the record ends on new line
- See Also:
FixedWidthParserSettings.getRecordEndsOnNewline()
-
setRecordEndsOnNewline
public UniVocityFixedWidthDataFormat setRecordEndsOnNewline(Boolean recordEndsOnNewline)
Sets whether or not the record ends on new line- Parameters:
recordEndsOnNewline
- whether or not the record ends on new line- Returns:
- current data format instance, fluent API
- See Also:
FixedWidthParserSettings.setRecordEndsOnNewline(boolean)
-
getPadding
public Character getPadding()
Gets the padding symbol. Ifnull
then the default format value is used.- Returns:
- the padding symbol
- See Also:
FixedWidthFormat.getPadding()
-
setPadding
public UniVocityFixedWidthDataFormat setPadding(Character padding)
Sets the padding symbol. Ifnull
then the default format value is used.- Parameters:
padding
- the padding symbol- Returns:
- current data format instance, fluent API
- See Also:
FixedWidthFormat.setPadding(char)
-
createWriterSettings
protected com.univocity.parsers.fixed.FixedWidthWriterSettings createWriterSettings()
Creates a new instance of the writer settings.- Specified by:
createWriterSettings
in classAbstractUniVocityDataFormat<com.univocity.parsers.fixed.FixedWidthFormat,com.univocity.parsers.fixed.FixedWidthWriterSettings,com.univocity.parsers.fixed.FixedWidthWriter,com.univocity.parsers.fixed.FixedWidthParserSettings,com.univocity.parsers.fixed.FixedWidthParser,UniVocityFixedWidthDataFormat>
- Returns:
- New instance of the writer settings
-
createWriter
protected com.univocity.parsers.fixed.FixedWidthWriter createWriter(Writer writer, com.univocity.parsers.fixed.FixedWidthWriterSettings settings)
Creates a new instance of the uniVocity writer.- Specified by:
createWriter
in classAbstractUniVocityDataFormat<com.univocity.parsers.fixed.FixedWidthFormat,com.univocity.parsers.fixed.FixedWidthWriterSettings,com.univocity.parsers.fixed.FixedWidthWriter,com.univocity.parsers.fixed.FixedWidthParserSettings,com.univocity.parsers.fixed.FixedWidthParser,UniVocityFixedWidthDataFormat>
- Parameters:
writer
- Output writer to usesettings
- Writer settings to use- Returns:
- New uinstance of the uniVocity writer
-
createParserSettings
protected com.univocity.parsers.fixed.FixedWidthParserSettings createParserSettings()
Creates a new instance of the parser settings.- Specified by:
createParserSettings
in classAbstractUniVocityDataFormat<com.univocity.parsers.fixed.FixedWidthFormat,com.univocity.parsers.fixed.FixedWidthWriterSettings,com.univocity.parsers.fixed.FixedWidthWriter,com.univocity.parsers.fixed.FixedWidthParserSettings,com.univocity.parsers.fixed.FixedWidthParser,UniVocityFixedWidthDataFormat>
- Returns:
- New instance of the parser settings
-
configureParserSettings
protected void configureParserSettings(com.univocity.parsers.fixed.FixedWidthParserSettings settings)
Description copied from class:AbstractUniVocityDataFormat
Configure the parser settings.- Overrides:
configureParserSettings
in classAbstractUniVocityDataFormat<com.univocity.parsers.fixed.FixedWidthFormat,com.univocity.parsers.fixed.FixedWidthWriterSettings,com.univocity.parsers.fixed.FixedWidthWriter,com.univocity.parsers.fixed.FixedWidthParserSettings,com.univocity.parsers.fixed.FixedWidthParser,UniVocityFixedWidthDataFormat>
- Parameters:
settings
- Parser settings to configure
-
createParser
protected com.univocity.parsers.fixed.FixedWidthParser createParser(com.univocity.parsers.fixed.FixedWidthParserSettings settings)
Creates a new instance of the uniVocity parser.- Specified by:
createParser
in classAbstractUniVocityDataFormat<com.univocity.parsers.fixed.FixedWidthFormat,com.univocity.parsers.fixed.FixedWidthWriterSettings,com.univocity.parsers.fixed.FixedWidthWriter,com.univocity.parsers.fixed.FixedWidthParserSettings,com.univocity.parsers.fixed.FixedWidthParser,UniVocityFixedWidthDataFormat>
- Parameters:
settings
- Parser settings to use- Returns:
- New instance of the uniVocity parser
-
configureFormat
protected void configureFormat(com.univocity.parsers.fixed.FixedWidthFormat format)
Configures the format.- Overrides:
configureFormat
in classAbstractUniVocityDataFormat<com.univocity.parsers.fixed.FixedWidthFormat,com.univocity.parsers.fixed.FixedWidthWriterSettings,com.univocity.parsers.fixed.FixedWidthWriter,com.univocity.parsers.fixed.FixedWidthParserSettings,com.univocity.parsers.fixed.FixedWidthParser,UniVocityFixedWidthDataFormat>
- Parameters:
format
- format to configure
-
getDataFormatName
public String getDataFormatName()
-
-