|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.univocity.parsers.common.CommonSettings<F>
com.univocity.parsers.common.CommonWriterSettings<FixedWidthFormat>
com.univocity.parsers.fixed.FixedWidthWriterSettings
public class FixedWidthWriterSettings
This is the configuration class used by the Fixed-Width writer (FixedWidthWriter)
The FixedWidthWriterSettings provides all configuration options in CommonWriterSettings and currently does not require any additional setting.
The FixedWidthParserSettings requires a definition of the field lengths of each record in the input. This must provided using an instance of FixedWidthFields.
FixedWidthWriter,
FixedWidthFormat,
FixedWidthFields,
CommonWriterSettings| Constructor Summary | |
|---|---|
FixedWidthWriterSettings()
Creates a basic configuration object for the Fixed-Width writer with no field length configuration. |
|
FixedWidthWriterSettings(FixedWidthFields fieldLengths)
You can only create an instance of this class by providing a definition of the field lengths of each record in the input. |
|
| Method Summary | |
|---|---|
protected void |
addConfiguration(Map<String,Object> out)
|
void |
addFormatForLookahead(String lookahead,
FixedWidthFields lengths)
Defines the format of records identified by a lookahead symbol. |
void |
addFormatForLookbehind(String lookbehind,
FixedWidthFields lengths)
Defines the format of records identified by a lookbehind symbol. |
protected FixedWidthFormat |
createDefaultFormat()
Returns the default FixedWidthFormat configured to handle Fixed-Width outputs |
FieldAlignment |
getDefaultAlignmentForHeaders()
Returns the default alignment to use when writing headers. |
int |
getMaxColumns()
Returns the hard limit of how many columns a record can have (defaults to 512). |
boolean |
getUseDefaultPaddingForHeaders()
Indicates whether headers should be written using the default padding specified in FixedWidthFormat.getPadding()
instead of any custom padding associated with a given field (in FixedWidthFields.setPadding(char, int...))
Defaults to true |
boolean |
getWriteLineSeparatorAfterRecord()
Returns a flag indicating whether each record, when written, should be followed by a line separator (as specified in Format.getLineSeparator(). |
void |
setDefaultAlignmentForHeaders(FieldAlignment defaultAlignmentForHeaders)
Defines the default alignment to use when writing headers. |
void |
setUseDefaultPaddingForHeaders(boolean useDefaultPaddingForHeaders)
Defines whether headers should be written using the default padding specified in FixedWidthFormat.getPadding()
instead of any custom padding associated with a given field (in FixedWidthFields.setPadding(char, int...)) |
void |
setWriteLineSeparatorAfterRecord(boolean writeLineSeparatorAfterRecord)
Defines whether each record, when written, should be followed by a line separator (as specified in Format.getLineSeparator(). |
| Methods inherited from class com.univocity.parsers.common.CommonWriterSettings |
|---|
getEmptyValue, getExpandIncompleteRows, getRowWriterProcessor, isHeaderWritingEnabled, setEmptyValue, setExpandIncompleteRows, setHeaderWritingEnabled, setRowWriterProcessor |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public FixedWidthWriterSettings(FixedWidthFields fieldLengths)
This must provided using an instance of FixedWidthFields.
fieldLengths - the instance of FixedWidthFields which provides the lengths of each field in the fixed-width records to be parsedFixedWidthFieldspublic FixedWidthWriterSettings()
addFormatForLookahead(String, FixedWidthFields), addFormatForLookbehind(String, FixedWidthFields)
| Method Detail |
|---|
protected FixedWidthFormat createDefaultFormat()
createDefaultFormat in class CommonSettings<FixedWidthFormat>public int getMaxColumns()
CommonSettings
getMaxColumns in class CommonSettings<FixedWidthFormat>
public void addFormatForLookahead(String lookahead,
FixedWidthFields lengths)
lookahead - the lookahead value that when found in the output row,
will notify the writer to switch to a new record format, with different field lengthslengths - the field lengths of the record format identified by the given lookahead symbol.
public void addFormatForLookbehind(String lookbehind,
FixedWidthFields lengths)
lookbehind - the lookbehind value that when present in the previous output row,
will notify the writer to switch to a new record format, with different field lengthslengths - the field lengths of the record format identified by the given lookbehind symbol.public boolean getUseDefaultPaddingForHeaders()
FixedWidthFormat.getPadding()
instead of any custom padding associated with a given field (in FixedWidthFields.setPadding(char, int...))
Defaults to true
true if the default padding is to be used when writing headers, otherwise falsepublic void setUseDefaultPaddingForHeaders(boolean useDefaultPaddingForHeaders)
FixedWidthFormat.getPadding()
instead of any custom padding associated with a given field (in FixedWidthFields.setPadding(char, int...))
useDefaultPaddingForHeaders - flag indicating whether the default padding is to be used when writing headerspublic FieldAlignment getDefaultAlignmentForHeaders()
null), the headers will be aligned
according to the corresponding field alignment in FixedWidthFields.getAlignment(String).
Defaults to null.
null if the headers should be aligned according to the column alignment.public void setDefaultAlignmentForHeaders(FieldAlignment defaultAlignmentForHeaders)
null), the headers will be aligned
according to the corresponding field alignment in FixedWidthFields.getAlignment(String).
Defaults to null.
defaultAlignmentForHeaders - the alignment to use when writing headers. null indicates that headers
should be aligned according to the column alignment.public boolean getWriteLineSeparatorAfterRecord()
Format.getLineSeparator().
Consider the records [a,b] and [c,d], with field lengths [2, 2], and line separator = \n:
getWriteLineSeparatorAfterRecord() is enabled, the output will be written as: a b \nc d \ngetWriteLineSeparatorAfterRecord() is disabled, the output will be written as: a b c d true.
public void setWriteLineSeparatorAfterRecord(boolean writeLineSeparatorAfterRecord)
Format.getLineSeparator().
Consider the records [a,b] and [c,d], with field lengths [2, 2], and line separator = \n:
getWriteLineSeparatorAfterRecord() is enabled, the output will be written as: a b \nc d \ngetWriteLineSeparatorAfterRecord() is disabled, the output will be written as: a b c d true.
writeLineSeparatorAfterRecord - flag indicating whether the writer should add a line separator after a record is written to the output.protected void addConfiguration(Map<String,Object> out)
addConfiguration in class CommonWriterSettings<FixedWidthFormat>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||