1/*
2 * reserved comment block
3 * DO NOT REMOVE OR ALTER!
4 */
5/*
6 * Licensed to the Apache Software Foundation (ASF) under one or more
7 * contributor license agreements.  See the NOTICE file distributed with
8 * this work for additional information regarding copyright ownership.
9 * The ASF licenses this file to You under the Apache License, Version 2.0
10 * (the "License"); you may not use this file except in compliance with
11 * the License.  You may obtain a copy of the License at
12 *
13 *      http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 */
21
22package com.sun.org.apache.xml.internal.serializer;
23
24import java.io.IOException;
25
26/**
27 * It is unfortunate that java.io.Writer is a class rather than an interface.
28 * The serializer has a number of classes that extend java.io.Writer
29 * and which send their ouput to a yet another wrapped Writer or OutputStream.
30 *
31 * The purpose of this interface is to force such classes to over-ride all of
32 * the important methods defined on the java.io.Writer class, namely these:
33 * <code>
34 * write(int val)
35 * write(char[] chars)
36 * write(char[] chars, int start, int count)
37 * write(String chars)
38 * write(String chars, int start, int count)
39 * flush()
40 * close()
41 * </code>
42 * In this manner nothing will accidentally go directly to
43 * the base class rather than to the wrapped Writer or OutputStream.
44 *
45 * The purpose of this class is to have a uniform way of chaining the output of one writer to
46 * the next writer in the chain. In addition there are methods to obtain the Writer or
47 * OutputStream that this object sends its output to.
48 *
49 * This interface is only for internal use withing the serializer.
50 * @xsl.usage internal
51 */
52interface WriterChain
53{
54    /** This method forces us to over-ride the method defined in java.io.Writer */
55    public void write(int val) throws IOException;
56    /** This method forces us to over-ride the method defined in java.io.Writer */
57    public void write(char[] chars) throws IOException;
58    /** This method forces us to over-ride the method defined in java.io.Writer */
59    public void write(char[] chars, int start, int count) throws IOException;
60    /** This method forces us to over-ride the method defined in java.io.Writer */
61    public void write(String chars) throws IOException;
62    /** This method forces us to over-ride the method defined in java.io.Writer */
63    public void write(String chars, int start, int count) throws IOException;
64    /** This method forces us to over-ride the method defined in java.io.Writer */
65    public void flush() throws IOException;
66    /** This method forces us to over-ride the method defined in java.io.Writer */
67    public void close() throws IOException;
68
69    /**
70     * If this method returns null, getOutputStream() must return non-null.
71     * Get the writer that this writer sends its output to.
72     *
73     * It is possible that the Writer returned by this method does not
74     * implement the WriterChain interface.
75     */
76    public java.io.Writer getWriter();
77
78    /**
79     * If this method returns null, getWriter() must return non-null.
80     * Get the OutputStream that this writer sends its output to.
81     */
82    public java.io.OutputStream getOutputStream();
83}
84