flattree.tree
Class DelimitedLeaf
java.lang.Object
flattree.tree.AbstractLeaf
flattree.tree.ValueLeaf
flattree.tree.DelimitedLeaf
- All Implemented Interfaces:
- Leaf
- Direct Known Subclasses:
- EscapedDelimitedLeaf, QuotedDelimitedLeaf
public class DelimitedLeaf
- extends ValueLeaf
A Leaf
which writes and reads characters bounded by a delimiter. The
delimiter can be configured to be optional or required.
- See Also:
setDelimiter(char)
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_DELIMITER
public static final char DEFAULT_DELIMITER
- The default delimiter (if none is configured) is set to
ReadLine.END
.
- See Also:
getDelimiter()
,
Constant Field Values
DelimitedLeaf
public DelimitedLeaf()
DelimitedLeaf
public DelimitedLeaf(String name,
char delimiter)
DelimitedLeaf
public DelimitedLeaf(String name,
char delimiter,
boolean delimiterRequired)
getDelimiter
public char getDelimiter()
setDelimiter
public void setDelimiter(char delimiter)
- Set the delimiter.
- Parameters:
delimiter
- any character to be used as delimiter, a ReadLine.END
will not be written
getDelimiterRequired
public boolean getDelimiterRequired()
setDelimiterRequired
public void setDelimiterRequired(boolean required)
- Does reading fail if no delimiter is found.
- Parameters:
required
- is the delimiter required- See Also:
AbstractLeaf.throwOnRead(String, ReadLine)
isDelimiter
protected boolean isDelimiter(char character)
writeValue
public void writeValue(WriteLine line,
String value)
- Specified by:
writeValue
in class ValueLeaf
writeDelimiter
protected void writeDelimiter(WriteLine line)
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)
Copyright © 2011. All Rights Reserved.