org.opencms.report
Class CmsPrintStreamReport

java.lang.Object
  extended by org.opencms.report.A_CmsReport
      extended by org.opencms.report.CmsHtmlReport
          extended by org.opencms.report.CmsPrintStreamReport
All Implemented Interfaces:
I_CmsReport
Direct Known Subclasses:
CmsPublishReport, CmsShellReport

public class CmsPrintStreamReport
extends CmsHtmlReport

Stream report where the output is streamed to the given print stream instance.

Keep in mind that you are resposible for closing the stream calling the close() method when the report is no longer used.

Since:
6.5.5
Version:
$Revision: 1.9 $
Author:
Michael Moossen

Field Summary
 
Fields inherited from class org.opencms.report.CmsHtmlReport
LINEBREAK, LINEBREAK_TRADITIONAL
 
Fields inherited from interface org.opencms.report.I_CmsReport
FORMAT_DEFAULT, FORMAT_ERROR, FORMAT_HEADLINE, FORMAT_NOTE, FORMAT_OK, FORMAT_WARNING, REPORT_TYPE_EXTENDED, REPORT_TYPE_SIMPLE
 
Constructor Summary
CmsPrintStreamReport(java.io.PrintStream printStream, java.util.Locale locale, boolean writeHtml)
          Constructs a new report using the provided locale for the output language.
 
Method Summary
 void close()
          Closes the print stream.
 void finish()
          Finishes the report, closing the stream.
protected  java.lang.String getLineBreak()
          Returns the correct line break notation depending on the output style of this report.
 java.lang.String getReportUpdate()
          Updates this report, this processes all new output added since the last call to this method.
 void print(java.lang.String value, int format)
          Prints a String to the report, using the indicated formatting.
 void println()
          Adds a line break to the report.
 void println(java.lang.Throwable t)
          Adds an Exception to the report, ensuring that the Exception content is processed to generate a valid output esp. for HTML pages.
 void start()
          Starts the report.
 
Methods inherited from class org.opencms.report.CmsHtmlReport
isWriteHtml
 
Methods inherited from class org.opencms.report.A_CmsReport
addError, addWarning, formatRuntime, getErrors, getLastEntryTime, getLocale, getMessages, getRuntime, getSiteRoot, getWarnings, hasError, hasWarning, init, print, print, print, println, println, println, println, printMessageWithParam, printMessageWithParam, removeSiteRoot, resetRuntime, setLastEntryTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CmsPrintStreamReport

public CmsPrintStreamReport(java.io.PrintStream printStream,
                            java.util.Locale locale,
                            boolean writeHtml)
Constructs a new report using the provided locale for the output language.

Parameters:
printStream - the print stream to write the output to
locale - the locale to use for the output language
writeHtml - decides if the report should write clear text or html code
Method Detail

close

public void close()
Closes the print stream.

Has to be called after the report has finished.


finish

public void finish()
Finishes the report, closing the stream.


getReportUpdate

public java.lang.String getReportUpdate()
Description copied from interface: I_CmsReport
Updates this report, this processes all new output added since the last call to this method.

This is only required in case the output is written to a HTML page, if the shell output is used, this will just return an empty String.

Specified by:
getReportUpdate in interface I_CmsReport
Overrides:
getReportUpdate in class CmsHtmlReport
Returns:
new elements that have been added to the report and not yet processed.
See Also:
I_CmsReport.getReportUpdate()

print

public void print(java.lang.String value,
                  int format)
Description copied from class: A_CmsReport
Prints a String to the report, using the indicated formatting.

Use the contants starting with FORMAT from this interface to indicate which formatting to use.

Overrides:
print in class CmsHtmlReport
Parameters:
value - the message container to add
format - the formatting to use for the output
See Also:
A_CmsReport.print(java.lang.String, int)

println

public void println()
Description copied from interface: I_CmsReport
Adds a line break to the report.

Specified by:
println in interface I_CmsReport
Overrides:
println in class CmsHtmlReport
See Also:
I_CmsReport.println()

println

public void println(java.lang.Throwable t)
Description copied from interface: I_CmsReport
Adds an Exception to the report, ensuring that the Exception content is processed to generate a valid output esp. for HTML pages.

The exception will be stored and the output will later be processed in a special way.

Specified by:
println in interface I_CmsReport
Overrides:
println in class CmsHtmlReport
Parameters:
t - the exception to add
See Also:
I_CmsReport.println(java.lang.Throwable)

start

public void start()
Starts the report.


getLineBreak

protected java.lang.String getLineBreak()
Description copied from class: CmsHtmlReport
Returns the correct line break notation depending on the output style of this report.

Overrides:
getLineBreak in class CmsHtmlReport
Returns:
the correct line break notation
See Also:
CmsHtmlReport.getLineBreak()