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