KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > batik > transcoder > TranscoderInput


1 /*
2
3    Copyright 2001,2003 The Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16
17  */

18 package org.apache.batik.transcoder;
19
20 import java.io.InputStream JavaDoc;
21 import java.io.Reader JavaDoc;
22
23 import org.w3c.dom.Document JavaDoc;
24 import org.xml.sax.XMLReader JavaDoc;
25
26 /**
27  * This class represents a generic input of a <tt>Transcoder</tt>.
28  *
29  * @author <a HREF="mailto:Thierry.Kormann@sophia.inria.fr">Thierry Kormann</a>
30  * @version $Id: TranscoderInput.java,v 1.5 2004/08/18 07:15:41 vhardy Exp $
31  */

32 public class TranscoderInput {
33
34     /**
35      * The optional XML reader to receive SAX events.
36      */

37     protected XMLReader JavaDoc xmlReader;
38
39     /**
40      * The optional input has a byte stream.
41      */

42     protected InputStream JavaDoc istream;
43
44     /**
45      * The optional input as a character stream.
46      */

47     protected Reader JavaDoc reader;
48
49     /**
50      * The optional input as XML Document.
51      */

52     protected Document JavaDoc document;
53
54     /**
55      * The optional input as a URI.
56      */

57     protected String JavaDoc uri;
58
59     /**
60      * Constructs a new empty <tt>TranscoderInput</tt>.
61      */

62     public TranscoderInput() {
63     }
64
65     /**
66      * Constructs a new <tt>TranscoderInput</tt> with the specified
67      * XML reader.
68      * @param xmlReader the XML reader of this transcoder input
69      */

70     public TranscoderInput(XMLReader JavaDoc xmlReader) {
71         this.xmlReader = xmlReader;
72     }
73
74     /**
75      * Constructs a new <tt>TranscoderInput</tt> with the specified
76      * byte stream input.
77      * @param istream the byte stream of this transcoder input
78      */

79     public TranscoderInput(InputStream JavaDoc istream) {
80         this.istream = istream;
81     }
82
83     /**
84      * Constructs a new <tt>TranscoderInput</tt> with the specified
85      * character stream.
86      * @param reader the character stream of this transcoder input
87      */

88     public TranscoderInput(Reader JavaDoc reader) {
89         this.reader = reader;
90     }
91
92     /**
93      * Constructs a new <tt>TranscoderInput</tt> with the specified Document.
94      * @param document the Document of this transcoder input
95      */

96     public TranscoderInput(Document JavaDoc document) {
97         this.document = document;
98     }
99
100     /**
101      * Constructs a new <tt>TranscoderInput</tt> with the specified uri.
102      * @param uri the URI of this transcoder input
103      */

104     public TranscoderInput(String JavaDoc uri) {
105         this.uri = uri;
106     }
107
108     /**
109      * Sets the input of this transcoder input with the specified
110      * XML reader.
111      * @param xmlReader the XML reader of this transcoder input
112      */

113     public void setXMLReader(XMLReader JavaDoc xmlReader) {
114         this.xmlReader = xmlReader;
115     }
116
117     /**
118      * Returns the XML reader of this transcoder or null if none was
119      * supplied.
120      */

121     public XMLReader JavaDoc getXMLReader() {
122         return xmlReader;
123     }
124
125     /**
126      * Sets the input of this transcoder input with the specified
127      * byte stream.
128      * @param istream the byte stream of this transcoder input
129      */

130     public void setInputStream(InputStream JavaDoc istream) {
131         this.istream = istream;
132     }
133
134     /**
135      * Returns the input of this transcoder as a byte stream or null
136      * if none was supplied.
137      */

138     public InputStream JavaDoc getInputStream() {
139         return istream;
140     }
141
142     /**
143      * Sets the input of this transcoder input with the specified
144      * character stream.
145      * @param reader the character stream of this transcoder input
146      */

147     public void setReader(Reader JavaDoc reader) {
148         this.reader = reader;
149     }
150
151     /**
152      * Returns the input of this transcoder as a character stream or null
153      * if none was supplied.
154      */

155     public Reader JavaDoc getReader() {
156         return reader;
157     }
158
159     /**
160      * Sets the input of this transcoder input with the specified
161      * document.
162      * @param document the document of this transcoder input
163      */

164     public void setDocument(Document JavaDoc document) {
165         this.document = document;
166     }
167
168     /**
169      * Returns the input of this transcoder as a document or null if
170      * none was supplied.
171      */

172     public Document JavaDoc getDocument() {
173         return document;
174     }
175
176     /**
177      * Sets the input of this transcoder input with the specified URI.
178      * @param uri the URI of this transcoder input
179      */

180     public void setURI(String JavaDoc uri) {
181         this.uri = uri;
182     }
183
184     /**
185      * Returns the input of this transcoder as a URI or null if none
186      * was supplied.
187      */

188     public String JavaDoc getURI() {
189         return uri;
190     }
191 }
192
Popular Tags