net.sourceforge.rssowl.util.document
Class ExtendedHtmlWriter

java.lang.Object
  extended bycom.lowagie.text.DocWriter
      extended bycom.lowagie.text.html.HtmlWriter
          extended bynet.sourceforge.rssowl.util.document.ExtendedHtmlWriter
All Implemented Interfaces:
com.lowagie.text.DocListener, com.lowagie.text.ElementListener, EventListener

public class ExtendedHtmlWriter
extends com.lowagie.text.html.HtmlWriter

This class extends the HtmlWriter of iText and will prevent the write() Method to encode the written String and escape HTML tags.

Version:
1.1.3
Author:
Benjamin Pasero

Field Summary
 
Fields inherited from class com.lowagie.text.html.HtmlWriter
BEGINCOMMENT, currentfont, ENDCOMMENT, footer, header, imagepath, NBSP, pageN, standardfont
 
Fields inherited from class com.lowagie.text.DocWriter
closeStream, document, EQUALS, FORWARD, GT, LT, NEWLINE, open, os, pageSize, pause, QUOTE, SPACE, TAB
 
Constructor Summary
protected ExtendedHtmlWriter(com.lowagie.text.Document doc, OutputStream os)
          Constructs a HtmlWriter.
 
Method Summary
static com.lowagie.text.html.HtmlWriter getInstance(com.lowagie.text.Document document, OutputStream os)
          Gets an instance of the ExtendedHtmlWriter
 void setBase(String url)
          Writes a base reference in the header.
private  String simpleHtmlEncode(String str)
          Since the ExtendedHtmlWriter is not calling the HtmlEncoder.encode() Method we have to offer our own implementation.
protected  void write(com.lowagie.text.Element element, int indent)
          Writes the HTML representation of an element.
 
Methods inherited from class com.lowagie.text.html.HtmlWriter
add, add, close, initFooter, initHeader, isOtherFont, newPage, open, resetImagepath, setFooter, setHeader, setImagepath, setStandardFont, write, writeComment, writeCssProperty, writeHeader, writeJavaScript, writeLink, writeSection
 
Methods inherited from class com.lowagie.text.DocWriter
add, addTabs, clearTextWrap, flush, getISOBytes, hasMarkupAttributes, isCloseStream, pause, removeWatermark, resetFooter, resetHeader, resetPageCount, resume, setCloseStream, setMargins, setPageCount, setPageSize, write, write, writeEnd, writeEnd, writeMarkupAttributes, writeStart
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.lowagie.text.DocListener
add, clearTextWrap, removeWatermark, resetFooter, resetHeader, resetPageCount, setMargins, setPageCount, setPageSize
 

Constructor Detail

ExtendedHtmlWriter

protected ExtendedHtmlWriter(com.lowagie.text.Document doc,
                             OutputStream os)
Constructs a HtmlWriter.

Parameters:
doc - The Document that has to be written as HTML
os - The OutputStream the writer has to write to.
Method Detail

getInstance

public static com.lowagie.text.html.HtmlWriter getInstance(com.lowagie.text.Document document,
                                                           OutputStream os)
Gets an instance of the ExtendedHtmlWriter

Parameters:
document - The Document that has to be written
os - The OutputStream the writer has to write to.
Returns:
a new HtmlWriter

setBase

public void setBase(String url)
Writes a base reference in the header.

Parameters:
url - The URL of the BASE reference

simpleHtmlEncode

private String simpleHtmlEncode(String str)
Since the ExtendedHtmlWriter is not calling the HtmlEncoder.encode() Method we have to offer our own implementation. This is required, because newlines have to be replaced with the HTML break tag BR.

Parameters:
str - The String to encode
Returns:
String the Encoded String

write

protected void write(com.lowagie.text.Element element,
                     int indent)
              throws IOException
Writes the HTML representation of an element. The case "Chunk" is extended and the call to HtmlEncoder.encode() was removed in order to avoid having HTML escaped.

Parameters:
element - the element
indent - the indentation
Throws:
IOException


RSSOwl - RSS / RDF / Atom Newsreader

SourceForge.net Logo