View Javadoc
1   /*
2    * Copyright 2005 Werner Guttmann
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5    * in compliance with the License. You may obtain a copy of the License at
6    *
7    * http://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software distributed under the License
10   * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11   * or implied. See the License for the specific language governing permissions and limitations under
12   * the License.
13   */
14  package org.exolab.castor.xml;
15  
16  import java.io.IOException;
17  import java.io.OutputStream;
18  import java.io.Writer;
19  
20  import org.xml.sax.DocumentHandler;
21  
22  /**
23   * Interface contract for XML serialization business.
24   * 
25   * @author Werner Guttmann
26   */
27  public interface Serializer {
28  
29    /**
30     * Sets the OutputCharStream to use.
31     * 
32     * @param out the OutputCharStream to use.
33     */
34    void setOutputCharStream(Writer out);
35  
36    /**
37     * Returns the {@link DocumentHandler} to use for serialization.
38     * 
39     * @return the DocumentHandler to use for serialization.
40     * @throws IOException
41     */
42    DocumentHandler asDocumentHandler() throws IOException;
43  
44    /**
45     * Sets the {@link OutputFormat} to use during serialization.
46     * 
47     * @param format The output format to use.
48     */
49    void setOutputFormat(OutputFormat format);
50  
51    /**
52     * Sets the {@link OutputStream} to use.
53     * 
54     * @param output the OutputStream to use
55     */
56    void setOutputByteStream(OutputStream output);
57  }