org.millscript.millscript.render
Class AbstractRenderer

java.lang.Object
  extended by org.millscript.millscript.render.AbstractRenderer
All Implemented Interfaces:
Renderer
Direct Known Subclasses:
DatafileRenderer, HTMLRenderer, LinesRenderer, PropertiesRenderer, TXTRenderer, XML10Renderer

public abstract class AbstractRenderer
extends java.lang.Object
implements Renderer

This abstract renderer provides the core functionality required by most renderer implementations.


Field Summary
protected  CharacterEntity availableEntities
          The set of character entities that are available to this renderer.
protected  Configuration config
          The configuration for this renderer.
protected  java.nio.charset.Charset outputCharset
          The character set this renderer is using for output.
protected  java.nio.charset.CharsetEncoder outputEncoder
          The character set encoder this renderer is using for output.
protected  org.millscript.commons.vfs.VFile outputVFile
          The virtual file we are rendering to.
protected  java.io.Writer outputWriter
          The writer we are rendering into.
 
Constructor Summary
AbstractRenderer(CharacterEntity ce, Configuration conf, java.nio.charset.Charset cs, org.millscript.commons.vfs.VFile file)
          Constructs a new abstract renderer, to render to the specified file, with the given set of character entities and output character set.
AbstractRenderer(Configuration conf, java.nio.charset.Charset cs, org.millscript.commons.vfs.VFile file)
          Constructs a new abstract renderer, to render to the specified file, with the no character entities and output character set.
AbstractRenderer(Configuration conf, org.millscript.commons.vfs.VFile file)
          Constructs a new abstract renderer, to render to the specified file, with the no character entities and output character set.
 
Method Summary
 void append(java.lang.CharSequence cs)
          Appends the specified character sequence, allowing any the sequences characters to be escaped as appropriate for this renderer.
 void appendNoEscape(java.lang.CharSequence cs)
          Appends the specified character sequence, without escaping any characters in the sequence.
 boolean canEncode(char ch)
          Checks if the specified character can be encoded by this renderer.
 void render(java.lang.Object o)
          Renders the specified object with this renderer.
 void renderAsDocument(java.lang.Object o)
          Renders the specified object to the output file and then closes it.
 void renderAsFragment(org.millscript.commons.util.IList<?> l)
          Renders the specified object to the output file as a fragment of a complete document.
 void renderCDATA(CDATA c)
          Renders the specified CDATA object using this renderer.
 void renderXMLComment(XmlComment c)
          Renders the specified XML comment using this renderer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.millscript.millscript.render.Renderer
append, appendEscapeFor, appendNoEscape, renderDocumentFooter, renderDocumentHeader, renderObject, renderXMLElement
 

Field Detail

availableEntities

protected final CharacterEntity availableEntities
The set of character entities that are available to this renderer.


config

protected final Configuration config
The configuration for this renderer.


outputCharset

protected final java.nio.charset.Charset outputCharset
The character set this renderer is using for output.


outputEncoder

protected final java.nio.charset.CharsetEncoder outputEncoder
The character set encoder this renderer is using for output.


outputWriter

protected final java.io.Writer outputWriter
The writer we are rendering into.


outputVFile

protected final org.millscript.commons.vfs.VFile outputVFile
The virtual file we are rendering to.

Constructor Detail

AbstractRenderer

public AbstractRenderer(CharacterEntity ce,
                        Configuration conf,
                        java.nio.charset.Charset cs,
                        org.millscript.commons.vfs.VFile file)
Constructs a new abstract renderer, to render to the specified file, with the given set of character entities and output character set.

Parameters:
ce - the set of character entities to render with
conf - the configuration for this renderer
cs - the output character set
file - the virtual output file

AbstractRenderer

public AbstractRenderer(Configuration conf,
                        org.millscript.commons.vfs.VFile file)
Constructs a new abstract renderer, to render to the specified file, with the no character entities and output character set.

Parameters:
conf - the configuration for this renderer
file - the virtual output file

AbstractRenderer

public AbstractRenderer(Configuration conf,
                        java.nio.charset.Charset cs,
                        org.millscript.commons.vfs.VFile file)
Constructs a new abstract renderer, to render to the specified file, with the no character entities and output character set.

Parameters:
cs - the output character set
file - the virtual output file
Method Detail

append

public void append(java.lang.CharSequence cs)
            throws java.io.IOException
Description copied from interface: Renderer
Appends the specified character sequence, allowing any the sequences characters to be escaped as appropriate for this renderer.

Specified by:
append in interface Renderer
Throws:
java.io.IOException - thrown if an IO problem occurs
See Also:
Renderer.append(java.lang.CharSequence)

appendNoEscape

public void appendNoEscape(java.lang.CharSequence cs)
                    throws java.io.IOException
Description copied from interface: Renderer
Appends the specified character sequence, without escaping any characters in the sequence. This method will raise an alert if any of the characters cannot be appended without an escape sequence.

Specified by:
appendNoEscape in interface Renderer
Throws:
java.io.IOException - thrown if an IO problem occurs
See Also:
Renderer.appendNoEscape(java.lang.CharSequence)

canEncode

public final boolean canEncode(char ch)
Checks if the specified character can be encoded by this renderer.

Specified by:
canEncode in interface Renderer
Parameters:
ch - the character to check
Returns:
true if the character can be encoded by this renderer

render

public void render(java.lang.Object o)
            throws java.io.IOException
Description copied from interface: Renderer
Renders the specified object with this renderer.

Specified by:
render in interface Renderer
Parameters:
o - the object to render
Throws:
java.io.IOException - thrown if an IO problem occurs
See Also:
Renderer.render(java.lang.Object)

renderAsDocument

public final void renderAsDocument(java.lang.Object o)
Description copied from interface: Renderer
Renders the specified object to the output file and then closes it. A document will have a DOCTYPE relevant to the specific type of file being rendered.

Specified by:
renderAsDocument in interface Renderer
Parameters:
o - the object to render to the file
See Also:
Renderer.renderAsDocument(java.lang.Object)

renderAsFragment

public final void renderAsFragment(org.millscript.commons.util.IList<?> l)
Description copied from interface: Renderer
Renders the specified object to the output file as a fragment of a complete document. A fragment will not have a DOCTYPE, just the incomplete fragment of a complete document.

Specified by:
renderAsFragment in interface Renderer
Parameters:
l - the list of objects to write to the file
See Also:
Renderer.renderAsFragment(org.millscript.commons.util.IList)

renderCDATA

public void renderCDATA(CDATA c)
                 throws java.io.IOException
Description copied from interface: Renderer
Renders the specified CDATA object using this renderer.

Specified by:
renderCDATA in interface Renderer
Parameters:
c - the CDATA object to render
Throws:
java.io.IOException - thrown if an IO problem occurs
See Also:
Renderer.renderCDATA(org.millscript.millscript.datatypes.CDATA)

renderXMLComment

public void renderXMLComment(XmlComment c)
                      throws java.io.IOException
Description copied from interface: Renderer
Renders the specified XML comment using this renderer.

Specified by:
renderXMLComment in interface Renderer
Parameters:
c - the XML comment to render
Throws:
java.io.IOException - thrown if an IO problem occurs
See Also:
Renderer.renderXMLComment(org.millscript.millscript.datatypes.XmlComment)


Copyright © 2001-2007 Open World Ltd. All Rights Reserved.