KickJava   Java API By Example, From Geeks To Geeks.

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


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.OutputStream JavaDoc;
21 import java.io.Writer JavaDoc;
22
23 import org.w3c.dom.Document JavaDoc;
24 import org.xml.sax.XMLFilter JavaDoc;
25
26 /**
27  * This class represents a single output for a <tt>Transcoder</tt>.
28  *
29  * @author <a HREF="mailto:Thierry.Kormann@sophia.inria.fr">Thierry Kormann</a>
30  * @version $Id: TranscoderOutput.java,v 1.6 2004/08/18 07:15:41 vhardy Exp $
31  */

32 public class TranscoderOutput {
33
34     /**
35      * The optional XML filter where to send SAX events.
36      */

37     protected XMLFilter JavaDoc xmlFilter;
38
39     /**
40      * The optional output has a byte stream.
41      */

42     protected OutputStream JavaDoc ostream;
43
44     /**
45      * The optional output as a character stream.
46      */

47     protected Writer JavaDoc writer;
48
49     /**
50      * The optional output as XML Document.
51      */

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

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

62     public TranscoderOutput() {
63     }
64
65     /**
66      * Constructs a new <tt>TranscoderOutput</tt> with the specified
67      * XML filter.
68      * @param xmlFilter the XML filter of this transcoder output
69      */

70     public TranscoderOutput(XMLFilter JavaDoc xmlFilter) {
71         this.xmlFilter = xmlFilter;
72     }
73
74     /**
75      * Constructs a new <tt>TranscoderOutput</tt> with the specified
76      * byte stream output.
77      * @param ostream the byte stream of this transcoder output
78      */

79     public TranscoderOutput(OutputStream JavaDoc ostream) {
80         this.ostream = ostream;
81     }
82
83     /**
84      * Constructs a new <tt>TranscoderOutput</tt> with the specified
85      * character stream.
86      * @param writer the character stream of this transcoder output
87      */

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

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

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

113     public void setXMLFilter(XMLFilter JavaDoc xmlFilter) {
114         this.xmlFilter = xmlFilter;
115     }
116
117     /**
118      * Returns the output of this transcoder as a XML filter or null
119      * if none was supplied.
120      */

121     public XMLFilter JavaDoc getXMLFilter() {
122         return xmlFilter;
123     }
124
125
126     /**
127      * Sets the output of this transcoder output with the specified
128      * byte stream.
129      * @param ostream the byte stream of this transcoder output
130      */

131     public void setOutputStream(OutputStream JavaDoc ostream) {
132         this.ostream = ostream;
133     }
134
135     /**
136      * Returns the output of this transcoder as a byte stream or null
137      * if none was supplied.
138      */

139     public OutputStream JavaDoc getOutputStream() {
140         return ostream;
141     }
142
143     /**
144      * Sets the output of this transcoder output with the specified
145      * character stream.
146      * @param writer the character stream of this transcoder output
147      */

148     public void setWriter(Writer JavaDoc writer) {
149         this.writer = writer;
150     }
151
152     /**
153      * Returns the output of this transcoder as a character stream or null
154      * if none was supplied.
155      */

156     public Writer JavaDoc getWriter() {
157         return writer;
158     }
159
160     /**
161      * Sets the output of this transcoder output with the specified
162      * document.
163      * @param document the document of this transcoder output
164      */

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

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

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

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