Class FixedLengthFieldPadding
- java.lang.Object
-
- org.beanio.internal.parser.format.FieldPadding
-
- org.beanio.internal.parser.format.fixedlength.FixedLengthFieldPadding
-
public class FixedLengthFieldPadding extends FieldPadding
FieldPaddingimplementation 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 intcalculateTextLength(java.lang.String text)voidinit()Initializes padding settings.java.lang.Stringunpad(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:FieldPaddingInitializes padding settings. This method must be invoked beforeFieldPadding.pad(String)orFieldPadding.unpad(String)is called.- Overrides:
initin classFieldPadding
-
calculateTextLength
protected int calculateTextLength(java.lang.String text)
- Overrides:
calculateTextLengthin classFieldPadding
-
unpad
public java.lang.String unpad(java.lang.String fieldText)
Description copied from class:FieldPaddingRemoves padding from the field text.- Overrides:
unpadin classFieldPadding- Parameters:
fieldText- the field text to remove padding- Returns:
- the unpadded field text
-
-