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)
Protocolpublic void appendHeading(String heading)
ProtocolappendHeading in interface Protocolheading - the headingpublic void appendWarning(String warning)
ProtocolappendWarning in interface Protocolwarning - the warningpublic StringBuffer getLog()
StringBuffer containing all messages since the creation of this
object.public void appendThrowable(Throwable th)
ProtocolThrowable 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 Protocolth - the ThrowableThrowable.printStackTrace()public void appendVerbatim(String verbatim)
ProtocolappendVerbatim in interface Protocolverbatim - the verbatim text