001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements. See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership. The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the "License");
007 * you may not use this file except in compliance with the License.
008 * You may obtain a copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018 /*
019 * $Id: Serializer.java 468642 2006-10-28 06:55:10Z minchau $
020 */
021 package org.apache.xalan.serialize;
022
023 import java.io.IOException;
024 import java.io.OutputStream;
025 import java.io.Writer;
026 import java.util.Properties;
027
028 import org.xml.sax.ContentHandler;
029
030 /**
031 * The Serializer interface is implemented by Serializers to publish methods
032 * to get and set streams and writers, to set the output properties, and
033 * get the Serializer as a ContentHandler or DOMSerializer.
034 * @deprecated Use org.apache.xml.serializer.Serializer
035 */
036 public interface Serializer
037 {
038
039 /**
040 * Specifies an output stream to which the document should be
041 * serialized. This method should not be called while the
042 * serializer is in the process of serializing a document.
043 * <p>
044 * The encoding specified in the output {@link Properties} is used, or
045 * if no encoding was specified, the default for the selected
046 * output method.
047 *
048 * @param output The output stream
049 *
050 * @deprecated Use org.apache.xml.serializer.Serializer
051 */
052 public void setOutputStream(OutputStream output);
053
054 /**
055 * Get the output stream where the events will be serialized to.
056 *
057 * @return reference to the result stream, or null of only a writer was
058 * set.
059 * @deprecated Use org.apache.xml.serializer.Serializer
060 */
061 public OutputStream getOutputStream();
062
063 /**
064 * Specifies a writer to which the document should be serialized.
065 * This method should not be called while the serializer is in
066 * the process of serializing a document.
067 * <p>
068 * The encoding specified for the output {@link Properties} must be
069 * identical to the output format used with the writer.
070 *
071 * @param writer The output writer stream
072 *
073 * @deprecated Use org.apache.xml.serializer.Serializer
074 */
075 public void setWriter(Writer writer);
076
077 /**
078 * Get the character stream where the events will be serialized to.
079 *
080 * @return Reference to the result Writer, or null.
081 * @deprecated Use org.apache.xml.serializer.Serializer
082 */
083 public Writer getWriter();
084
085 /**
086 * Specifies an output format for this serializer. It the
087 * serializer has already been associated with an output format,
088 * it will switch to the new format. This method should not be
089 * called while the serializer is in the process of serializing
090 * a document.
091 *
092 * @param format The output format to use
093 *
094 * @deprecated Use org.apache.xml.serializer.Serializer
095 */
096 public void setOutputFormat(Properties format);
097
098 /**
099 * Returns the output format for this serializer.
100 *
101 * @return The output format in use
102 * @deprecated Use org.apache.xml.serializer.Serializer
103 */
104 public Properties getOutputFormat();
105
106 /**
107 * Return a {@link ContentHandler} interface into this serializer.
108 * If the serializer does not support the {@link ContentHandler}
109 * interface, it should return null.
110 *
111 * @return A {@link ContentHandler} interface into this serializer,
112 * or null if the serializer is not SAX 2 capable
113 * @throws IOException An I/O exception occured
114 * @deprecated Use org.apache.xml.serializer.Serializer
115 */
116 public ContentHandler asContentHandler() throws IOException;
117
118 /**
119 * Return a {@link DOMSerializer} interface into this serializer.
120 * If the serializer does not support the {@link DOMSerializer}
121 * interface, it should return null.
122 *
123 * @return A {@link DOMSerializer} interface into this serializer,
124 * or null if the serializer is not DOM capable
125 * @throws IOException An I/O exception occured
126 * @deprecated Use org.apache.xml.serializer.Serializer
127 */
128 public DOMSerializer asDOMSerializer() throws IOException;
129
130 /**
131 * Resets the serializer. If this method returns true, the
132 * serializer may be used for subsequent serialization of new
133 * documents. It is possible to change the output format and
134 * output stream prior to serializing, or to use the existing
135 * output format and output stream.
136 *
137 * @return True if serializer has been reset and can be reused
138 *
139 * @deprecated Use org.apache.xml.serializer.Serializer
140 */
141 public boolean reset();
142 }