com.jrefinery.report.targets.table.html
Class StreamHtmlFilesystem

java.lang.Object
  |
  +--com.jrefinery.report.targets.table.html.StreamHtmlFilesystem
All Implemented Interfaces:
HtmlFilesystem

public class StreamHtmlFilesystem
extends java.lang.Object
implements HtmlFilesystem

The StreamHtmlFilesystem is an Implementation for streamed HTML output.

The generated content is a single Html-Stream, without any external generated data. The generated HTML Stream has an inline style sheet definition and supports external images. The external images must be loaded from HTTP, HTTPS or FTP sources, generated images or images loaded from the local filesystem are not supported.

Author:
Thomas Morgner

Constructor Summary
StreamHtmlFilesystem(java.io.OutputStream root)
          Creates a new StreamHtmlFilesystem for the given output stream.
 
Method Summary
 void close()
          Close the Filesystem and write any buffered content.
 HtmlReferenceData createCSSReference(java.lang.String styleSheet)
          Returns an inline stylesheet reference.
 HtmlReferenceData createImageReference(ImageReference reference)
          Creates a HtmlReference for ImageData.
 java.io.OutputStream getRootStream()
          The root stream is used to write the main HTML-File.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamHtmlFilesystem

public StreamHtmlFilesystem(java.io.OutputStream root)
Creates a new StreamHtmlFilesystem for the given output stream.

Parameters:
root - the output stream for the main file.
Method Detail

getRootStream

public java.io.OutputStream getRootStream()
                                   throws java.io.IOException
The root stream is used to write the main HTML-File. Any external content is referenced from this file.

Specified by:
getRootStream in interface HtmlFilesystem
Returns:
the output stream of the main HTML file.
Throws:
java.io.IOException - if an IO error occured, while providing the root stream.

createImageReference

public HtmlReferenceData createImageReference(ImageReference reference)
                                       throws java.io.IOException
Creates a HtmlReference for ImageData. If the target filesystem does not support this reference type, return an empty content reference, but never null.

This implementation returns the external reference for all image references which are loaded from an HTTP, HTTPS or FTP source.

Specified by:
createImageReference in interface HtmlFilesystem
Parameters:
reference - the image reference containing the data.
Returns:
the generated HtmlReference, never null.
Throws:
java.io.IOException - if there is an I/O problem.

createCSSReference

public HtmlReferenceData createCSSReference(java.lang.String styleSheet)
                                     throws java.io.IOException
Returns an inline stylesheet reference.

Specified by:
createCSSReference in interface HtmlFilesystem
Parameters:
styleSheet - the stylesheet data, which should be referenced.
Returns:
an InternalCSSReferenceData for the given stylesheet.
Throws:
java.io.IOException - if there is an I/O problem.

close

public void close()
           throws java.io.IOException
Close the Filesystem and write any buffered content. The used stream is flushed, but not closed.

Specified by:
close in interface HtmlFilesystem
Throws:
java.io.IOException - if the close operation failed.