Package com.univocity.parsers.fixed
Class FixedWidthFormat
java.lang.Object
com.univocity.parsers.common.Format
com.univocity.parsers.fixed.FixedWidthFormat
- All Implemented Interfaces:
Cloneable
The Fixed-Width format configuration. In addition to the default configuration in
Format
, the fixed-width format defines:
- padding (defaults to ' '): the character used for filling unwritten spaces in a fixed-width record.
e.g. if a field has a length of 5 characters, but the value is 'ZZ', the field should contain [ZZ ] (i.e. ZZ followed by 3 unwritten spaces).
If the padding is set to '_', then the field will be written as [ZZ___]
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal FixedWidthFormat
clone()
char
Returns the lookup wildcard character to accept any character in look-ahead or look-behind patterns defined usingFixedWidthParserSettings.addFormatForLookahead(String, FixedWidthFields)
orFixedWidthParserSettings.addFormatForLookbehind(String, FixedWidthFields)
.char
Returns the padding character used to represent unwritten spaces.boolean
isPadding
(char padding) Identifies whether or not a given character represents a padding charactervoid
setLookupWildcard
(char lookupWildcard) Defines the lookup wildcard character to accept any character in look-ahead or look-behind patterns defined usingFixedWidthParserSettings.addFormatForLookahead(String, FixedWidthFields)
orFixedWidthParserSettings.addFormatForLookbehind(String, FixedWidthFields)
.void
setPadding
(char padding) Defines the padding character used to represent unwritten spaces.Methods inherited from class com.univocity.parsers.common.Format
getComment, getLineSeparator, getLineSeparatorString, getNormalizedNewline, getSystemLineSeparator, isComment, isNewLine, setComment, setLineSeparator, setLineSeparator, setNormalizedNewline, toString
-
Field Details
-
padding
private char padding -
lookupWildcard
private char lookupWildcard
-
-
Constructor Details
-
FixedWidthFormat
public FixedWidthFormat()
-
-
Method Details
-
getPadding
public char getPadding()Returns the padding character used to represent unwritten spaces. Defaults to ' '- Returns:
- the padding character
-
setPadding
public void setPadding(char padding) Defines the padding character used to represent unwritten spaces. Defaults to ' '- Parameters:
padding
- the padding character
-
isPadding
public boolean isPadding(char padding) Identifies whether or not a given character represents a padding character- Parameters:
padding
- the character to be verified- Returns:
- true if the given character is the padding character, false otherwise
-
getConfiguration
- Specified by:
getConfiguration
in classFormat
-
clone
-
getLookupWildcard
public char getLookupWildcard()Returns the lookup wildcard character to accept any character in look-ahead or look-behind patterns defined usingFixedWidthParserSettings.addFormatForLookahead(String, FixedWidthFields)
orFixedWidthParserSettings.addFormatForLookbehind(String, FixedWidthFields)
. Defaults to'?'
- Returns:
- the wildcard character to be used in lookahead/behind patterns.
-
setLookupWildcard
public void setLookupWildcard(char lookupWildcard) Defines the lookup wildcard character to accept any character in look-ahead or look-behind patterns defined usingFixedWidthParserSettings.addFormatForLookahead(String, FixedWidthFields)
orFixedWidthParserSettings.addFormatForLookbehind(String, FixedWidthFields)
. Defaults to'?'
- Parameters:
lookupWildcard
- the wildcard character to be used in lookahead/behind patterns.
-