public class LogPrintWriter
extends java.io.PrintWriter
PrintWriter
interface to a LogPage
.Constructor and Description |
---|
LogPrintWriter(LogPage logPage)
Constructs a
LogPrintWriter that is wired into the specified LogPage . |
Modifier and Type | Method and Description |
---|---|
void |
close() |
LogPage |
getLogPage()
Directly returns the underlying
LogPage for this LogPrintWriter . |
LogPage |
getWrappedLogPage()
The need for a wrapped
LogPage instance arises from the fact that: A typical LogPage implementation uses a thread to forward messages to the UI components (to avoid deadlocks in the IDE caused by the automatic showing of the log window or changing log pages in the log window), and Each LogPrintWriter uses a thread to forward messages to the underlying LogPage . |
void |
printQuietly(java.lang.String msg)
Prints the supplied string to the log page as silently as possible, that is, it does not force the log window to be displayed and does not highlight the tab to indicate it's content has changed.
|
void |
write(char[] buf, int off, int len) |
void |
write(java.lang.String s, int off, int len) |
append, append, append, checkError, clearError, flush, format, format, print, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, println, setError, write, write, write
public LogPrintWriter(LogPage logPage)
LogPrintWriter
that is wired into the specified LogPage
.
If the close()
method is called, the thread that is forwarding messages to the LogPage
will be terminated. This disconnects the LogPrintWriter
from the LogPage
.
Note that the close()
method will be called automatically when the LogPrintWriter
is garbage collected, so an explicit call to close()
is not required.
If creation of a pipe to the specified LogPage
fails for some reason, the LogPrintWriter
will be configured to forward all messages to System.out
instead.
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.PrintWriter
public LogPage getLogPage()
LogPage
for this LogPrintWriter
.public LogPage getWrappedLogPage()
LogPage
instance arises from the fact that:
LogPage
implementation uses a thread to forward messages to the UI components (to avoid deadlocks in the IDE caused by the automatic showing of the log window or changing log pages in the log window), andLogPrintWriter
uses a thread to forward messages to the underlying LogPage
.LogPage
and a corresponding LogPrintWriter
instance can lead to an undesirable reordering of messages. In order to preserve the temporal ordering of messages, all messages must be queued through the same LogPrintWriter
instance. The wrapped instance of LogPage
returned by this method is there configured to delegate logging to this LogPrintWriter
instance.
The main disadvantage of using getWrappedLogPage()
is that the returned LogPage
cannot be downcast to a specific LogPage
implementation to use special implementation-specific APIs.
public void printQuietly(java.lang.String msg)
msg
- the message to add to the displaypublic void write(char[] buf, int off, int len)
write
in class java.io.PrintWriter
public void write(java.lang.String s, int off, int len)
write
in class java.io.PrintWriter