Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.2.0)

E17493-03


oracle.ide.log
Class LogPrintStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by java.io.PrintStream
              extended by oracle.ide.log.LogPrintStream

All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable

public class LogPrintStream
extends java.io.PrintStream

This class provides a PrintStream interface to a LogPage.

Note: Because of internationalization issues, it is strongly recommended that LogPrintWriter be used whenever possible instead of LogPrintStream to prevent characters from being corrupted when displayed.


Field Summary

 

Fields inherited from class java.io.FilterOutputStream
out

 

Constructor Summary
LogPrintStream(LogPage logPage)
          Note: Because of internationalization issues, it is strongly recommended that LogPrintWriter be used whenever possible instead of LogPrintStream to prevent characters from being corrupted when displayed.

 

Method Summary
 LogPage getLogPage()
          Directly returns the underlying LogPage for this LogPrintStream.
 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 LogPrintStream uses a thread to forward messages to the underlying LogPage.

 

Methods inherited from class java.io.PrintStream
append, append, append, checkError, clearError, close, 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

 

Methods inherited from class java.io.FilterOutputStream
write

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

LogPrintStream

public LogPrintStream(LogPage logPage)
Note: Because of internationalization issues, it is strongly recommended that LogPrintWriter be used whenever possible instead of LogPrintStream to prevent characters from being corrupted when displayed.

Constructs a LogPrintStream that is wired into the specified LogPage.

If the PrintStream.close() method is called, the thread that is forwarding messages to the LogPage will be terminated. This disconnects the LogPrintStream from the LogPage.

Note that the close() method will be called automatically when the LogPrintStream 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 LogPrintStream will be configured to forward all messages to System.out instead.

Method Detail

getLogPage

public LogPage getLogPage()
Directly returns the underlying LogPage for this LogPrintStream.

getWrappedLogPage

public LogPage getWrappedLogPage()
The need for a wrapped LogPage instance arises from the fact that:
  1. 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
  2. Each LogPrintStream uses a thread to forward messages to the underlying LogPage.
Because thread scheduling in the JVM is nondeterministic, the simultaneous use of a LogPage and a corresponding LogPrintStream 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 LogPrintStream instance. The wrapped instance of LogPage returned by this method is there configured to delegate logging to this LogPrintStream 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.


Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.2.0)

E17493-03


Copyright © 1997, 2012, Oracle. All rights reserved.