net.larsan.urd.ant.website
Class Compiler

java.lang.Object
  |
  +--net.larsan.urd.ant.website.Compiler

public class Compiler
extends java.lang.Object

A simple page compiler for the Urd website. The compiler is linear and must be reset between uses. It takes a source template on creation it then accepts any number of Substitution objects, the result it then printed to a stream.

Version:
Alpha-0.1 / 2002-10-06 21:37
Author:
Lars J. Nilsson
See Also:
WebsiteCompiler

Method Summary
 void add(Substitution sub)
          Add substitution object to compiler.
 void compile(DocBody body, java.io.File out)
          Take an input stream and transform it using the current compiler state.
 void compile(DocBody body, java.io.OutputStream out)
          Take an input stream and transform it using the current compiler state.
static Compiler getInstance(java.io.File in)
          Get a reference to the compiler which will read it's template from an file.
static Compiler getInstance(java.io.InputStream in)
          Get a reference to the compiler which will read it's template from an input stream.
 void remove(Substitution sub)
          Remove substitution filter from compiler
 void reset()
          Reset compiler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static Compiler getInstance(java.io.InputStream in)
                            throws java.io.IOException
Get a reference to the compiler which will read it's template from an input stream.

Parameters:
in - Input stream to read the template from
Returns:
A compiler object
Throws:
java.io.IOException - On I/O errors

getInstance

public static Compiler getInstance(java.io.File in)
                            throws java.io.IOException
Get a reference to the compiler which will read it's template from an file.

Parameters:
in - File to read the template from
Returns:
A compiler object
Throws:
java.io.IOException - On I/O errors

reset

public void reset()
Reset compiler.


add

public void add(Substitution sub)
Add substitution object to compiler.


remove

public void remove(Substitution sub)
Remove substitution filter from compiler


compile

public void compile(DocBody body,
                    java.io.OutputStream out)
             throws CompilerException
Take an input stream and transform it using the current compiler state. Print the result to the output stream

Parameters:
body - Template body to compile into template
out - Output stream to compile to
Throws:
java.io.IOException - On I/O errors
XMLException - On XML related errors
CompilerException

compile

public void compile(DocBody body,
                    java.io.File out)
             throws CompilerException
Take an input stream and transform it using the current compiler state. Print the result to the file

Parameters:
body - Template body to compile into template
out - File to compile to
Throws:
java.io.IOException - On I/O errors
XMLException - On XML related errors
CompilerException