Class RewritableLinkTransformer

Direct Known Subclasses:
Concatenator, RecordTransformer

public class RewritableLinkTransformer
extends LinkTransformer

Transformer that remaps URLs in links in such a way that if the URL mapping changes during (or after) some HTML has been transformed, the HTML can be fixed up after the fact. This class is used by Concatenator and Mirror, since in those operations, the URL mapping function changes as each page is written to the concatenation or mirror.

Field Summary
Fields inherited from class websphinx.LinkTransformer
base, map
Constructor Summary
RewritableLinkTransformer(java.lang.String filename)
          Make a RewritableLinkTransformer.
Method Summary
 void close()
          Close the transformer.
protected  void handleLink(Link link)
          Handle a Link's transformation.
 void rewrite()
          Rewrite the file, remapping all the URLs according to their current values from lookup().
Methods inherited from class websphinx.LinkTransformer
getBase, getEmitBaseElement, handleBase, handleElement, isMapped, lookup, map, map, setBase, setEmitBaseElement, writePage
Methods inherited from class websphinx.HTMLTransformer
emit, emit, finalize, flush, getFilePointer, getOutputStream, getOutputWriter, getRandomAccessFile, seek, setOutput, setRandomAccessFile, transformContents, transformElement, write, write
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public RewritableLinkTransformer(java.lang.String filename)
                          throws java.io.IOException
Make a RewritableLinkTransformer.

filename - Filename to write to
Method Detail


public void close()
           throws java.io.IOException
Description copied from class: HTMLTransformer
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.

close in class HTMLTransformer


protected void handleLink(Link link)
                   throws java.io.IOException
Description copied from class: LinkTransformer
Handle a Link's transformation. Default implementation replaces the link's URL with lookup(URL).

handleLink in class LinkTransformer
Following copied from class: websphinx.LinkTransformer
link - Link to transform


public void rewrite()
             throws java.io.IOException
Rewrite the file, remapping all the URLs according to their current values from lookup().