Package com.univocity.parsers.fixed
Class FixedWidthRoutines
- java.lang.Object
-
- com.univocity.parsers.common.routine.AbstractRoutines<FixedWidthParserSettings,FixedWidthWriterSettings>
-
- com.univocity.parsers.fixed.FixedWidthRoutines
-
public class FixedWidthRoutines extends AbstractRoutines<FixedWidthParserSettings,FixedWidthWriterSettings>
A collection of common routines involving the processing of Fixed-Width data.
-
-
Constructor Summary
Constructors Constructor Description FixedWidthRoutines()
Creates a new instance of the Fixed-width routine class without any predefined parsing/writing configuration.FixedWidthRoutines(FixedWidthParserSettings parserSettings)
Creates a new instance of the Fixed-width routine class.FixedWidthRoutines(FixedWidthParserSettings parserSettings, FixedWidthWriterSettings writerSettings)
Creates a new instance of the Fixed-width routine class.FixedWidthRoutines(FixedWidthWriterSettings writerSettings)
Creates a new instance of the Fixed-width routine class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
adjustColumnLengths(java.lang.String[] headers, int[] lengths)
Allows writers of any given format to adjust its settings to take into account column headers and lengths prior to writing data in any routine.protected FixedWidthParserSettings
createDefaultParserSettings()
Creates a default parser settings configurationprotected FixedWidthWriterSettings
createDefaultWriterSettings()
Creates a default writer settings configurationprotected FixedWidthParser
createParser(FixedWidthParserSettings parserSettings)
Creates a new parser implementation using the given parser configurationprotected FixedWidthWriter
createWriter(java.io.Writer output, FixedWidthWriterSettings writerSettings)
Creates a new writer implementation using the given writer configuration-
Methods inherited from class com.univocity.parsers.common.routine.AbstractRoutines
getColumnMapper, getInputDimension, getInputDimension, getInputDimension, getInputDimension, getInputDimension, getKeepResourcesOpen, getParserSettings, getWriterSettings, iterate, iterate, iterate, iterate, iterate, iterate, iterate, parseAll, parseAll, parseAll, parseAll, parseAll, parseAll, parseAll, parseAll, parseAll, parseAll, parseAll, parseAll, parseAll, parseAll, parseAndWrite, setColumnMapper, setKeepResourcesOpen, setParserSettings, setWriterSettings, toString, write, write, write, write, write, write, write, writeAll, writeAll, writeAll, writeAll, writeAll, writeAll, writeAll
-
-
-
-
Constructor Detail
-
FixedWidthRoutines
public FixedWidthRoutines()
Creates a new instance of the Fixed-width routine class without any predefined parsing/writing configuration.
-
FixedWidthRoutines
public FixedWidthRoutines(FixedWidthParserSettings parserSettings)
Creates a new instance of the Fixed-width routine class.- Parameters:
parserSettings
- configuration to use for Fixed-width parsing
-
FixedWidthRoutines
public FixedWidthRoutines(FixedWidthWriterSettings writerSettings)
Creates a new instance of the Fixed-width routine class.- Parameters:
writerSettings
- configuration to use for Fixed-width writing
-
FixedWidthRoutines
public FixedWidthRoutines(FixedWidthParserSettings parserSettings, FixedWidthWriterSettings writerSettings)
Creates a new instance of the Fixed-width routine class.- Parameters:
parserSettings
- configuration to use for Fixed-width parsingwriterSettings
- configuration to use for Fixed-width writing
-
-
Method Detail
-
adjustColumnLengths
protected void adjustColumnLengths(java.lang.String[] headers, int[] lengths)
Description copied from class:AbstractRoutines
Allows writers of any given format to adjust its settings to take into account column headers and lengths prior to writing data in any routine.- Overrides:
adjustColumnLengths
in classAbstractRoutines<FixedWidthParserSettings,FixedWidthWriterSettings>
- Parameters:
headers
- headers to be writtenlengths
- the corresponding lengths of each header
-
createParser
protected FixedWidthParser createParser(FixedWidthParserSettings parserSettings)
Description copied from class:AbstractRoutines
Creates a new parser implementation using the given parser configuration- Specified by:
createParser
in classAbstractRoutines<FixedWidthParserSettings,FixedWidthWriterSettings>
- Parameters:
parserSettings
- the configuration for new parser- Returns:
- a parser implementation configured according to the given settings object.
-
createWriter
protected FixedWidthWriter createWriter(java.io.Writer output, FixedWidthWriterSettings writerSettings)
Description copied from class:AbstractRoutines
Creates a new writer implementation using the given writer configuration- Specified by:
createWriter
in classAbstractRoutines<FixedWidthParserSettings,FixedWidthWriterSettings>
- Parameters:
output
- target output of the routine.writerSettings
- the configuration for new writer- Returns:
- a writer implementation configured according to the given settings object.
-
createDefaultParserSettings
protected FixedWidthParserSettings createDefaultParserSettings()
Description copied from class:AbstractRoutines
Creates a default parser settings configuration- Specified by:
createDefaultParserSettings
in classAbstractRoutines<FixedWidthParserSettings,FixedWidthWriterSettings>
- Returns:
- a new instance of a usable parser configuration.
-
createDefaultWriterSettings
protected FixedWidthWriterSettings createDefaultWriterSettings()
Description copied from class:AbstractRoutines
Creates a default writer settings configuration- Specified by:
createDefaultWriterSettings
in classAbstractRoutines<FixedWidthParserSettings,FixedWidthWriterSettings>
- Returns:
- a new instance of a usable writer configuration.
-
-