flattree.tree
Class DelimitedNode

java.lang.Object
  extended by flattree.tree.AbstractNode
      extended by flattree.tree.DelimitedNode
All Implemented Interfaces:
Node

public class DelimitedNode
extends AbstractNode

A Node which writes and reads characters bounded by a delimiter.

See Also:
setDelimiter(String)

Field Summary
static String DEFAULT_DELIMITER
          The default delimiter (if none is configured) is set to the systems default line separator.
 
Constructor Summary
DelimitedNode()
          Default constructor.
DelimitedNode(String name)
           
DelimitedNode(String name, String delimiter)
           
 
Method Summary
protected  ReadLine beforeRead(ReadLine line)
          Limits the given line to with the configured delimiter.
protected  WriteLine beforeWrite(WriteLine line)
          Limits the given line to with the configured delimiter.
 String getDelimiter()
          Get the delimiter.
 void setDelimiter(String delimiter)
          Set the delimiter.
 
Methods inherited from class flattree.tree.AbstractNode
add, add, getLeaves, getName, getNodes, read, setLeaves, setName, setNodes, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DELIMITER

public static final String DEFAULT_DELIMITER
The default delimiter (if none is configured) is set to the systems default line separator.

See Also:
getDelimiter()
Constructor Detail

DelimitedNode

public DelimitedNode()
Default constructor.


DelimitedNode

public DelimitedNode(String name)

DelimitedNode

public DelimitedNode(String name,
                     String delimiter)
Method Detail

setDelimiter

public void setDelimiter(String delimiter)
Set the delimiter.

Parameters:
delimiter - the delimiter
Throws:
IllegalArgumentException - if delimiter is empty

getDelimiter

public String getDelimiter()
Get the delimiter.

Returns:
delimiter

beforeRead

protected ReadLine beforeRead(ReadLine line)
Limits the given line to with the configured delimiter.

Overrides:
beforeRead in class AbstractNode
Parameters:
line - line to wrap before read
Returns:
line to read from
See Also:
getDelimiter()

beforeWrite

protected WriteLine beforeWrite(WriteLine line)
Limits the given line to with the configured delimiter.

Overrides:
beforeWrite in class AbstractNode
Parameters:
line - line to wrap before write
Returns:
line to write to
See Also:
getDelimiter()


Copyright © 2011. All Rights Reserved.