uPortal 2.4.1
API Documentation

org.jasig.portal.serialize
Class CachingHTMLSerializer

java.lang.Object
  extended byorg.jasig.portal.serialize.BaseMarkupSerializer
      extended byorg.jasig.portal.serialize.HTMLSerializer
          extended byorg.jasig.portal.serialize.CachingHTMLSerializer
All Implemented Interfaces:
CachingSerializer, org.xml.sax.ContentHandler, org.xml.sax.ext.DeclHandler, org.xml.sax.DocumentHandler, DOMSerializer, org.xml.sax.DTDHandler, IAnchoringSerializer, org.xml.sax.ext.LexicalHandler, Serializer

public final class CachingHTMLSerializer
extends HTMLSerializer
implements CachingSerializer

Caching version of the HTML serializer

Author:
Peter Kharchenko, Assaf Arkin
See Also:
Serializer

Field Summary
 
Fields inherited from class org.jasig.portal.serialize.HTMLSerializer
XHTMLNamespace
 
Constructor Summary
CachingHTMLSerializer()
          Constructs a new serializer.
CachingHTMLSerializer(OutputFormat format)
          Constructs a new serializer.
CachingHTMLSerializer(java.io.OutputStream output, OutputFormat format)
          Constructs a new serializer that writes to the specified output stream using the specified output format.
CachingHTMLSerializer(java.io.Writer writer, OutputFormat format)
          Constructs a new serializer that writes to the specified writer using the specified output format.
 
Method Summary
 void flush()
          Flushes all the buffers
 java.lang.String getCache()
          Asks serializer for an accumulated cache content.
 void printRawCharacters(java.lang.String text)
          Allows one to print a String of characters directly to the output stream.
 void setDocumentStarted(boolean setting)
          Let the serializer know if the document has already been started.
 void setOutputByteStream(java.io.OutputStream output)
          Specifies an output stream to which the document should be serialized.
 void setOutputCharStream(java.io.Writer writer)
          Specifies a writer to which the document should be serialized.
 void setOutputFormat(OutputFormat format)
          Specifies an output format for this serializer.
 boolean startCaching()
          Commands serializer to start caching.
 boolean stopCaching()
          Commands serializer to stop caching.
 
Methods inherited from class org.jasig.portal.serialize.HTMLSerializer
characters, endElement, endElement, endElementIO, startAnchoring, startElement, startElement, stopAnchoring
 
Methods inherited from class org.jasig.portal.serialize.BaseMarkupSerializer
asContentHandler, asDocumentHandler, asDOMSerializer, attributeDecl, comment, comment, elementDecl, endCDATA, endDocument, endDTD, endEntity, endNonEscaping, endPrefixMapping, endPreserving, externalEntityDecl, ignorableWhitespace, internalEntityDecl, notationDecl, processingInstruction, processingInstructionIO, reset, serialize, serialize, serialize, setDocumentLocator, skippedEntity, startCDATA, startDocument, startDTD, startEntity, startNonEscaping, startPrefixMapping, startPreserving, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingHTMLSerializer

public CachingHTMLSerializer()
Constructs a new serializer. The serializer cannot be used without calling setOutputCharStream(java.io.Writer) or setOutputByteStream(java.io.OutputStream) first.


CachingHTMLSerializer

public CachingHTMLSerializer(OutputFormat format)
Constructs a new serializer. The serializer cannot be used without calling setOutputCharStream(java.io.Writer) or setOutputByteStream(java.io.OutputStream) first.


CachingHTMLSerializer

public CachingHTMLSerializer(java.io.Writer writer,
                             OutputFormat format)
Constructs a new serializer that writes to the specified writer using the specified output format. If format is null, will use a default output format.

Parameters:
writer - The writer to use
format - The output format to use, null for the default

CachingHTMLSerializer

public CachingHTMLSerializer(java.io.OutputStream output,
                             OutputFormat format)
Constructs a new serializer that writes to the specified output stream using the specified output format. If format is null, will use a default output format.

Parameters:
output - The output stream to use
format - The output format to use, null for the default
Method Detail

setOutputCharStream

public void setOutputCharStream(java.io.Writer writer)
Description copied from interface: Serializer
Specifies a writer to which the document should be serialized. This method should not be called while the serializer is in the process of serializing a document.

Specified by:
setOutputCharStream in interface Serializer
Overrides:
setOutputCharStream in class BaseMarkupSerializer

setOutputByteStream

public void setOutputByteStream(java.io.OutputStream output)
Description copied from interface: Serializer
Specifies an output stream to which the document should be serialized. This method should not be called while the serializer is in the process of serializing a document.

Specified by:
setOutputByteStream in interface Serializer
Overrides:
setOutputByteStream in class BaseMarkupSerializer

setOutputFormat

public void setOutputFormat(OutputFormat format)
Description copied from interface: Serializer
Specifies an output format for this serializer. It the serializer has already been associated with an output format, it will switch to the new format. This method should not be called while the serializer is in the process of serializing a document.

Specified by:
setOutputFormat in interface Serializer
Overrides:
setOutputFormat in class HTMLSerializer

startCaching

public boolean startCaching()
                     throws java.io.IOException
Description copied from interface: CachingSerializer
Commands serializer to start caching.

Specified by:
startCaching in interface CachingSerializer
Returns:
false if the serializer is already caching.
Throws:
java.io.IOException

stopCaching

public boolean stopCaching()
                    throws java.io.IOException
Description copied from interface: CachingSerializer
Commands serializer to stop caching.

Specified by:
stopCaching in interface CachingSerializer
Returns:
false if the serializer was NOT caching.
Throws:
java.io.IOException

getCache

public java.lang.String getCache()
                          throws java.io.UnsupportedEncodingException,
                                 java.io.IOException
Description copied from interface: CachingSerializer
Asks serializer for an accumulated cache content.

Specified by:
getCache in interface CachingSerializer
Returns:
a String cache.
Throws:
java.io.UnsupportedEncodingException - if the OutputFormat specified unsupported encoding
java.io.IOException

printRawCharacters

public void printRawCharacters(java.lang.String text)
                        throws java.io.IOException
Allows one to print a String of characters directly to the output stream.

Specified by:
printRawCharacters in interface CachingSerializer
Parameters:
text - a String value
Throws:
java.io.IOException

setDocumentStarted

public void setDocumentStarted(boolean setting)
Let the serializer know if the document has already been started.

Specified by:
setDocumentStarted in interface CachingSerializer
Parameters:
setting - a boolean value

flush

public void flush()
           throws java.io.IOException
Description copied from interface: CachingSerializer
Flushes all the buffers

Specified by:
flush in interface CachingSerializer
Throws:
java.io.IOException - if an error occurs

uPortal 2.4.1
API Documentation