Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/thermidor/xml/output/OutputHandler.java


1   package com.thermidor.xml.output;
2   import java.io.PrintWriter;
3   import java.io.IOException;
4   import com.thermidor.util.exception.GenericException;
5   /**
6    * The OutputHandler class is the base class for output handlers used by the
7    * Output class to manage stack based output.
8    * @see Output
9    */
10  public abstract class OutputHandler {
11      public class InvalidInitializationParameter extends GenericException {
12          public InvalidInitializationParameter(){super();}
13          public InvalidInitializationParameter(String message){super(message);}
14          public InvalidInitializationParameter(Throwable cause){super(cause);}
15          public InvalidInitializationParameter(String message,Throwable cause){
16              super(cause,message);
17          }
18      }
19      public static final String EMPTY = "";
20      /**
21       * The print write that will be used to handle the the output at this 
22       * point.
23       */
24      protected PrintWriter _writer;
25      /**
26       * <code>start</code> is called on the output handler to initialize it
27       * ready to start processing output.
28       * @param initializationData the initialization data.
29       * @throws InvalidInitializationParameter is raised if the initialization 
30       * data was invalid for this instance.
31       * @throws IOException is raised if there was an IO related error.
32       */
33      public abstract void start(Object initializationData) 
34          throws InvalidInitializationParameter,
35                 IOException;
36      /**
37       * Handle the provided string data .
38       * @param text the text data that is to be output.
39       * @throws IOException is raised if the handler failed to process the text.
40       */
41      public abstract void handle(String text) throws IOException;
42      /**
43       * The responsibilty of the  finish member function is to handle clean up
44       * when the output is popped from the output stack.
45       * @return any relevant string data that was collected will the handler 
46       * is in operation.
47       * @throws IOException is raised if the handler failed clean up correctly.
48       */
49      public abstract String finish() throws IOException;    
50  }