flattree.tree
Class FixedLengthLeaf
java.lang.Object
flattree.tree.AbstractLeaf
flattree.tree.ValueLeaf
flattree.tree.FixedLengthLeaf
- All Implemented Interfaces:
- Leaf
- Direct Known Subclasses:
- PaddedFixedLengthLeaf
public class FixedLengthLeaf
- extends ValueLeaf
An Leaf
which writes and reads characters bounded by a fixed length.
- See Also:
setLength(int)
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FixedLengthLeaf
public FixedLengthLeaf()
FixedLengthLeaf
public FixedLengthLeaf(String name,
int length)
FixedLengthLeaf
public FixedLengthLeaf(String name,
int length,
boolean lengthRequired)
getLength
public int getLength()
setLength
public void setLength(int length)
- Set the length.
- Parameters:
length
- length
- Throws:
IllegalArgumentException
- if length is less than 0
getLengthRequired
public boolean getLengthRequired()
setLengthRequired
public void setLengthRequired(boolean required)
writeValue
public void writeValue(WriteLine line,
String value)
- Specified by:
writeValue
in class ValueLeaf
readValue
public String readValue(ReadLine line)
- Description copied from class:
ValueLeaf
- Read this leaf's value from the given line.
- Specified by:
readValue
in class ValueLeaf
- Parameters:
line
- line to read from
- Returns:
- value or
null
if this leaf cannot be read from the
given line - See Also:
AbstractLeaf.setThrowOnRead(boolean)
read
protected String read(StringBuilder builder)
Copyright © 2011. All Rights Reserved.