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