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