public static class CLI.SysProtocol extends Object implements Protocol
Protocol
that prints messages to System.out
and warnings to System.err
and additionally hold a log of all messages in a local StringBuffer
that may be, e.g., stored to a file later.Constructor and Description |
---|
SysProtocol()
Creates a new, empty protocol.
|
Modifier and Type | Method and Description |
---|---|
void |
append(String str)
Appends a general message to the protocol
|
void |
appendHeading(String heading)
Appends a heading to the protocol, which is generally highlighted in some appropriate way.
|
void |
appendThrowable(Throwable th)
Appends a
Throwable to the protocol. |
void |
appendVerbatim(String verbatim)
Appends some verbatim text (i.e., text that is displayed "as is" regardless of default formatting) to the protocol.
|
void |
appendWarning(String warning)
Appends a warning to the protocol, which is generally highlighted in some appropriate way.
|
void |
flush() |
StringBuffer |
getLog()
Returns the
StringBuffer containing all messages since the creation of this
object. |
public void append(String str)
Protocol
public void appendHeading(String heading)
Protocol
appendHeading
in interface Protocol
heading
- the headingpublic void appendWarning(String warning)
Protocol
appendWarning
in interface Protocol
warning
- the warningpublic StringBuffer getLog()
StringBuffer
containing all messages since the creation of this
object.public void appendThrowable(Throwable th)
Protocol
Throwable
to the protocol. The message of the protocol is generally highlighted in some appropriate way.
Depending on the implementation, the stack trace of the Throwable
may also be displayed.appendThrowable
in interface Protocol
th
- the Throwable
Throwable.printStackTrace()
public void appendVerbatim(String verbatim)
Protocol
appendVerbatim
in interface Protocol
verbatim
- the verbatim text