public class ColumnFormatter extends Object
PrintWriter
object. Handles escaping of the column data so that the resulting output is
unambiguous and reasonably safe and machine parsable.Constructor and Description |
---|
ColumnFormatter(PrintWriter out,
char columnSeparator) |
Modifier and Type | Method and Description |
---|---|
void |
addColumn(String content)
Adds a text string as a new column in the current line of output, taking care of escaping as
necessary.
|
void |
finish()
Finishes the output by flushing the current line and takes care of any other cleanup action.
|
void |
nextLine()
Flushes the current line of output and makes the formatter ready to start receiving new column
data for a new line (or end-of-file).
|
public ColumnFormatter(PrintWriter out, char columnSeparator)
out
- The writer to which output should be sent.columnSeparator
- A character that should serve as the separator token between columns of
output. As only non-printable characters in the column text are ever escaped, the column
separator must be a non-printable character if the output needs to be unambiguously parsed.public void addColumn(String content)
content
- the string to add.public void finish()
public void nextLine()
addColumn(java.lang.String)
will be
squashed.