KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > org > apache > xml > internal > serializer > WriterChain


1 /*
2  * Copyright 2004 The Apache Software Foundation.
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 /*
17  * $Id: WriterChain.java,v 1.1.4.1 2005/09/08 10:58:44 suresh_emailid Exp $
18  */

19 package com.sun.org.apache.xml.internal.serializer;
20
21 import java.io.IOException JavaDoc;
22
23 /**
24  * It is unfortunate that java.io.Writer is a class rather than an interface.
25  * The serializer has a number of classes that extend java.io.Writer
26  * and which send their ouput to a yet another wrapped Writer or OutputStream.
27  *
28  * The purpose of this interface is to force such classes to over-ride all of
29  * the important methods defined on the java.io.Writer class, namely these:
30  * <code>
31  * write(int val)
32  * write(char[] chars)
33  * write(char[] chars, int start, int count)
34  * write(String chars)
35  * write(String chars, int start, int count)
36  * flush()
37  * close()
38  * </code>
39  * In this manner nothing will accidentally go directly to
40  * the base class rather than to the wrapped Writer or OutputStream.
41  *
42  * The purpose of this class is to have a uniform way of chaining the output of one writer to
43  * the next writer in the chain. In addition there are methods to obtain the Writer or
44  * OutputStream that this object sends its output to.
45  *
46  * This interface is only for internal use withing the serializer.
47  * @xsl.usage internal
48  */

49 interface WriterChain
50 {
51     /** This method forces us to over-ride the method defined in java.io.Writer */
52     public void write(int val) throws IOException JavaDoc;
53     /** This method forces us to over-ride the method defined in java.io.Writer */
54     public void write(char[] chars) throws IOException JavaDoc;
55     /** This method forces us to over-ride the method defined in java.io.Writer */
56     public void write(char[] chars, int start, int count) throws IOException JavaDoc;
57     /** This method forces us to over-ride the method defined in java.io.Writer */
58     public void write(String JavaDoc chars) throws IOException JavaDoc;
59     /** This method forces us to over-ride the method defined in java.io.Writer */
60     public void write(String JavaDoc chars, int start, int count) throws IOException JavaDoc;
61     /** This method forces us to over-ride the method defined in java.io.Writer */
62     public void flush() throws IOException JavaDoc;
63     /** This method forces us to over-ride the method defined in java.io.Writer */
64     public void close() throws IOException JavaDoc;
65
66     /**
67      * If this method returns null, getOutputStream() must return non-null.
68      * Get the writer that this writer sends its output to.
69      *
70      * It is possible that the Writer returned by this method does not
71      * implement the WriterChain interface.
72      */

73     public java.io.Writer JavaDoc getWriter();
74     
75     /**
76      * If this method returns null, getWriter() must return non-null.
77      * Get the OutputStream that this writer sends its output to.
78      */

79     public java.io.OutputStream JavaDoc getOutputStream();
80 }
81
Popular Tags