net.sourceforge.rssowl.util.document
Class HTMLExporter

java.lang.Object
  extended by net.sourceforge.rssowl.util.document.HTMLExporter

public class HTMLExporter
extends java.lang.Object

The HTMLExporter is using some of the Methods of iText in order to export all Items of a Channel into HTML.

Note: Some parts copied from iText are licensed under the Mozilla Public License.

Version:
1.2.4
Author:
Benjamin Pasero

Field Summary
private  Channel channel
           
private static java.lang.String DOCTYPE
          Doctype to be used for the generated HTML
private static byte NEWLINE
          This is some byte that is often used.
private  java.util.ArrayList newsOrder
           
private  java.io.BufferedOutputStream out
           
private static byte TAB
          This is some byte that is often used.
private static java.lang.String XML_DECLARATION
          XML Declaration to be used for the generated HTML
 
Constructor Summary
HTMLExporter(Channel channel, java.util.ArrayList newsOrder, java.io.OutputStream os)
          Instantiate a new HTMLExporter to generate a HTML Document out of the given Channel into the given Stream.
 
Method Summary
private  void addTabs(int indent)
          Writes a number of tabs.
private  void close()
          Closes the Outputstream.
(package private)  void create()
          Create the HTML Document.
private static byte[] getISOBytes(java.lang.String text)
          Converts a String into a Byte array according to the ISO-8859-1 codepage.
private  void write(java.lang.String string)
          Writes a String to the OutputStream.
private  void writeBase()
          Writes the BASE HTML Tag to resolve relative Links.
private  void writeBody()
          Write the BODY of the HTML Document containing all Items.
private  void writeFont(FontData fontData)
          Write the given FontData as CSS to the HTML Document.
private  void writeHead()
          Write the HEAD of the HTML Document containing Title and CSS Definition.
private  void writeItemBody(NewsItem item)
          Write the Contents of an Item into the body Paragraph.
private  void writeLink(java.lang.String href, java.lang.String name, java.lang.String clazz)
          Write a Link.
private  void writeNews(NewsItem item)
          Write the given NewsItem into the Body of the HTML Document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DOCTYPE

private static final java.lang.String DOCTYPE
Doctype to be used for the generated HTML

See Also:
Constant Field Values

NEWLINE

private static final byte NEWLINE
This is some byte that is often used.

See Also:
Constant Field Values

TAB

private static final byte TAB
This is some byte that is often used.

See Also:
Constant Field Values

XML_DECLARATION

private static final java.lang.String XML_DECLARATION
XML Declaration to be used for the generated HTML

See Also:
Constant Field Values

channel

private Channel channel

newsOrder

private java.util.ArrayList newsOrder

out

private java.io.BufferedOutputStream out
Constructor Detail

HTMLExporter

public HTMLExporter(Channel channel,
                    java.util.ArrayList newsOrder,
                    java.io.OutputStream os)
Instantiate a new HTMLExporter to generate a HTML Document out of the given Channel into the given Stream.

Parameters:
channel - The Channel containing NewsItems to export.
newsOrder - The Order and Number of Items to export.
os - A Stream to write the HTML into.
Method Detail

getISOBytes

private static byte[] getISOBytes(java.lang.String text)
Converts a String into a Byte array according to the ISO-8859-1 codepage.

Parameters:
text - the text to be converted
Returns:
the conversion result
See Also:
DocWriter.getISOBytes(java.lang.String)

addTabs

private void addTabs(int indent)
              throws java.io.IOException
Writes a number of tabs.

Parameters:
indent - the number of tabs to add
Throws:
java.io.IOException - In case of an Error.

close

private void close()
            throws java.io.IOException
Closes the Outputstream.

Throws:
java.io.IOException - In case of an Error.

write

private void write(java.lang.String string)
            throws java.io.IOException
Writes a String to the OutputStream.

Parameters:
string - the String to write
Throws:
java.io.IOException - In case of an Error.

writeBase

private void writeBase()
                throws java.io.IOException
Writes the BASE HTML Tag to resolve relative Links.

Throws:
java.io.IOException - In case of an Error.

writeBody

private void writeBody()
                throws java.io.IOException
Write the BODY of the HTML Document containing all Items.

Throws:
java.io.IOException - In case of an Error.

writeFont

private void writeFont(FontData fontData)
                throws java.io.IOException
Write the given FontData as CSS to the HTML Document.

Parameters:
fontData - The FontData defining the Font.
Throws:
java.io.IOException - In case of an Error.

writeHead

private void writeHead()
                throws java.io.IOException
Write the HEAD of the HTML Document containing Title and CSS Definition.

Throws:
java.io.IOException - In case of an Error.

writeItemBody

private void writeItemBody(NewsItem item)
                    throws java.io.IOException
Write the Contents of an Item into the body Paragraph.

Parameters:
item - The Item to add to the body Paragraph.
Throws:
java.io.IOException - In case of an Error.

writeLink

private void writeLink(java.lang.String href,
                       java.lang.String name,
                       java.lang.String clazz)
                throws java.io.IOException
Write a Link.

Parameters:
href - The URL Target of the Link.
name - The Name of the Link.
clazz - The CSS Class of the Link.
Throws:
java.io.IOException - In case of an Error.

writeNews

private void writeNews(NewsItem item)
                throws java.io.IOException
Write the given NewsItem into the Body of the HTML Document.

Parameters:
item - The NewsItem to write into the Body of the HTML Document.
Throws:
java.io.IOException - In case of an Error.

create

void create()
      throws java.io.IOException
Create the HTML Document.

Throws:
java.io.IOException - In case of an Error.


RSSOwl - RSS / RDF / Atom Newsreader

SourceForge.net Logo