Class FixedLengthFieldPadding
- java.lang.Object
-
- org.beanio.internal.parser.format.FieldPadding
-
- org.beanio.internal.parser.format.fixedlength.FixedLengthFieldPadding
-
public class FixedLengthFieldPadding extends FieldPadding
FieldPadding
implementation for a fixed length field.Fixed length padding differs from other field padding in that a completely blank optional field (i.e. all spaces) is formatted as the empty string regardless of the filler character, thus allowing for optional numeric fields.
- Since:
- 2.0
-
-
Field Summary
-
Fields inherited from class org.beanio.internal.parser.format.FieldPadding
LEFT, RIGHT
-
-
Constructor Summary
Constructors Constructor Description FixedLengthFieldPadding()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
calculateTextLength(java.lang.String text)
void
init()
Initializes padding settings.java.lang.String
unpad(java.lang.String fieldText)
Removes padding from the field text.-
Methods inherited from class org.beanio.internal.parser.format.FieldPadding
getFiller, getJustify, getLength, getPropertyType, isOptional, pad, setFiller, setJustify, setLength, setOptional, setPaddedNull, setPropertyType
-
-
-
-
Method Detail
-
init
public void init()
Description copied from class:FieldPadding
Initializes padding settings. This method must be invoked beforeFieldPadding.pad(String)
orFieldPadding.unpad(String)
is called.- Overrides:
init
in classFieldPadding
-
calculateTextLength
protected int calculateTextLength(java.lang.String text)
- Overrides:
calculateTextLength
in classFieldPadding
-
unpad
public java.lang.String unpad(java.lang.String fieldText)
Description copied from class:FieldPadding
Removes padding from the field text.- Overrides:
unpad
in classFieldPadding
- Parameters:
fieldText
- the field text to remove padding- Returns:
- the unpadded field text
-
-