All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class websphinx.HTMLTransformer

java.lang.Object
   |
   +----websphinx.HTMLTransformer

public class HTMLTransformer
extends Object

Constructor Index

 o HTMLTransformer(HTMLTransformer)
Make an HTMLTransformer that writes pages to a downstream HTMLTransformer.
 o HTMLTransformer(OutputStream)
Make an HTMLTransformer that writes pages to a stream.
 o HTMLTransformer(String)
Make an HTMLTransformer that writes pages to a file.
 o HTMLTransformer(String, boolean)
Make an HTMLTransformer that writes pages to a file.
 o HTMLTransformer(Writer)
Make an HTMLTransformer that writes pages to a stream.

Method Index

 o close()
Close the transformer.
 o emit(Region)
Emit a region on the transformer chain's final output.
 o emit(String)
Emit a string on the transformer chain's final output.
 o finalize()
Finalizes the transformer (calling close()).
 o flush()
Flushes transformer to its destination stream.
 o getFilePointer()
Get the file pointer.
 o getOutput()
 o getRandomAccessFile()
 o handleElement(Element)
Handle the transformation of an HTML element.
 o seek(long)
Seek to a file position.
 o setOutput(OutputStream)
 o setOutput(Writer)
 o setRandomAccessFile(RandomAccessFile)
 o transformContents(Element)
Transform the contents of an element.
 o transformElement(Element)
Transform an element by passing it through the entire filter chain.
 o write(Region)
Writes a chunk of HTML through the HTML transformer.
 o write(String)
Writes a literal string through the HTML transformer (without parsing it or transforming it).
 o writePage(Page)
Writes a page through the HTML transformer.

Constructors

 o HTMLTransformer
 public HTMLTransformer(OutputStream out)
Make an HTMLTransformer that writes pages to a stream.

Parameters:
out - Stream to receive HTML output
 o HTMLTransformer
 public HTMLTransformer(String filename) throws IOException
Make an HTMLTransformer that writes pages to a file.

Parameters:
filename - Name of file to receive HTML output
Throws: IOException
if file cannot be opened
 o HTMLTransformer
 public HTMLTransformer(String filename,
                        boolean seekable) throws IOException
Make an HTMLTransformer that writes pages to a file.

Parameters:
filename - Name of file to receive HTML output
seekable - True if file should be opened for random access
 o HTMLTransformer
 public HTMLTransformer(Writer stream)
Make an HTMLTransformer that writes pages to a stream.

Parameters:
stream - Stream to receive HTML output
 o HTMLTransformer
 public HTMLTransformer(HTMLTransformer next)
Make an HTMLTransformer that writes pages to a downstream HTMLTransformer. Use this constructor to chain together several HTMLTransformers.

Parameters:
next - HTMLTransformer to receive HTML output

Methods

 o setOutput
 public void setOutput(OutputStream out)
 o setOutput
 public void setOutput(Writer out)
 o getOutput
 public Writer getOutput()
 o setRandomAccessFile
 public void setRandomAccessFile(RandomAccessFile raf)
 o getRandomAccessFile
 public RandomAccessFile getRandomAccessFile()
 o write
 public synchronized void write(String string) throws IOException
Writes a literal string through the HTML transformer (without parsing it or transforming it).

Parameters:
string - String to write
 o write
 public synchronized void write(Region region) throws IOException
Writes a chunk of HTML through the HTML transformer.

Parameters:
region - Region to write
 o writePage
 public synchronized void writePage(Page page) throws IOException
Writes a page through the HTML transformer.

Parameters:
page - Page to write
 o flush
 public synchronized void flush() throws IOException
Flushes transformer to its destination stream. Empties any buffers in the transformer chain.

 o close
 public synchronized void close() throws IOException
Close the transformer. Flushes all buffered data to disk by calling flush(). This call may be time-consuming! Don't use the transformer again after closing it.

Throws: IOException
if an I/O error occurs
 o finalize
 protected void finalize() throws Throwable
Finalizes the transformer (calling close()).

Overrides:
finalize in class Object
 o getFilePointer
 public long getFilePointer() throws IOException
Get the file pointer.

Returns:
current file pointer
Throws: IOException
if this transformer not opened for random access
 o seek
 public void seek(long pos) throws IOException
Seek to a file position.

Parameters:
pos - file position to seek
Throws: IOException
if this transformer not opened for random access
 o transformElement
 protected void transformElement(Element elem) throws IOException
Transform an element by passing it through the entire filter chain.

Parameters:
elem - Element to be transformed
 o transformContents
 protected void transformContents(Element elem) throws IOException
Transform the contents of an element. Passes the child elements through the filter chain and emits the text between them.

Parameters:
elem - Element whose contents should be transformed
 o handleElement
 protected void handleElement(Element elem) throws IOException
Handle the transformation of an HTML element. Override this method to modify the HTML as it is written.

Parameters:
elem - Element to transform
 o emit
 protected void emit(Region r) throws IOException
Emit a region on the transformer chain's final output. (The region isn't passed through the chain.)

Parameters:
r - Region to emit
 o emit
 protected void emit(String string) throws IOException
Emit a string on the transformer chain's final output.

Parameters:
string - String to emit

All Packages  Class Hierarchy  This Package  Previous  Next  Index