Class CharColumn
java.lang.Object
io.github.kelsoncm.fwf.columns.AbstractColumn
io.github.kelsoncm.fwf.columns.CharColumn
- Direct Known Subclasses:
RightCharColumn
Character column representing a left-aligned, space-padded string.
-
Field Summary
Fields inherited from class AbstractColumn
description, name, size, start -
Constructor Summary
ConstructorsConstructorDescriptionCharColumn(String name, int size) Constructs a newCharColumnwith a name and size.CharColumn(String name, int size, String description) Constructs a newCharColumnwith a name, size, and description. -
Method Summary
Methods inherited from class AbstractColumn
getDescription, getEnd, getName, getSize, getStart, setStart, validateToStrSize
-
Constructor Details
-
CharColumn
-
CharColumn
Constructs a newCharColumnwith a name and size.- Parameters:
name- the column namesize- the column size in characters
-
-
Method Details
-
toValue
Converts a raw fixed-width string slice into a trimmed string value.- Overrides:
toValuein classAbstractColumn- Parameters:
slice- raw fixed-width substring- Returns:
- trimmed string value
-
toStr
Formats a String or null into a left-aligned, space-padded string of exact column size.- Specified by:
toStrin classAbstractColumn- Parameters:
value- String or null to format- Returns:
- space-padded string of size
AbstractColumn.getSize() - Throws:
IllegalArgumentException- ifvalueis not a String or exceeds column size
-