|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectfreemarker.ext.misc.WriterExceptionListener
public final class WriterExceptionListener
Adapts FM-Classic's exception events to an IO Writer class. This would
typically be either a File writer, or adapted to another output such
as System.err. By default the writer is flushed after each
message that is written.
Usage example:
// Create a writer for error messages Writer errorWriter = new OutputStreamWriter( System.err ); // Set up the template Template template = new Template(filename); // Set up the model TemplateModelRoot modelRoot = (...) // Set up the listener SimpleEventAdapter adapter = new SimpleEventAdapter( new WriterExceptionListener( errorWriter )); // Call the template template.process( modelRoot, writer, adapter );
| Constructor Summary | |
|---|---|
WriterExceptionListener(java.io.Writer writer)
Constructor that takes a Writer as the target for error messages. |
|
WriterExceptionListener(java.io.Writer writer,
boolean autoFlush)
Constructor that takes a Writer as the target for error messages, and a flag to indicate whether the flush() method should be
called after every event. |
|
| Method Summary | |
|---|---|
void |
exceptionThrown(TemplateExceptionEvent e)
This method is called whenever a TemplateExceptionEvent
is generated by a FM-Classic template. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WriterExceptionListener(java.io.Writer writer)
true by default.
writer - the Writer to which error messages will be sent
public WriterExceptionListener(java.io.Writer writer,
boolean autoFlush)
flush() method should be
called after every event.
writer - the Writer to which error messages will be sentautoFlush - should the Writer be flushed after every message| Method Detail |
|---|
public void exceptionThrown(TemplateExceptionEvent e)
throws TemplateException
TemplateExceptionEvent
is generated by a FM-Classic template. Implement this method to
decide how to respond to such events.
exceptionThrown in interface TemplateExceptionListenerTemplateException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||