~ubuntu-branches/ubuntu/karmic/batik/karmic

« back to all changes in this revision

Viewing changes to sources/org/w3c/css/sac/InputSource.java

  • Committer: Bazaar Package Importer
  • Author(s): Matvey Kozhev, Onkar Shinde, Matvey Kozhev
  • Date: 2008-07-19 01:03:05 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20080719010305-0b24skqy185kdsb9
Tags: 1.7.dfsg-0ubuntu1
[ Onkar Shinde ]
* New upstream version (LP: #147818)
* debian/control
  - Add Sun JDK 1.5 as build dependency. Fixes FTBFS on buildd. (LP: #150484)
    Also add Sun JRE as runtime dependencies.
  - Add ant-optional as build dependency.
  - Add libxml-commons-external-java and libxmlgraphics-commons-java as
    build and runtime dependencies.
  - Add 'Homepage' field and correct the url.
  - Change standards version to 3.8.0.
  - Modify Maintainer value to match the DebianMaintainerField
    specification.
* debian/rules
  - Change JAVA_HOME_DIRS for Sun JDK.
  - Add jar file names to DEB_JARS to match new build requirements.
  - Extract version from changelog.
  - Delete bundled jar files in clean target.
  - Don't use hardcoded version in install target.
  - Add get-orig-source target.
* debian/README.Debian-source
  - Change the fo tag name to the one used for this version.
* debian/watch
  - Change expression to match src distribution.
* debian/patches/
  - 01_build_xml.patch, 02_fix_jar_target.patch - Refresh for current source.
  - 03_fix_lib_dirs.patch - Fix the library and classpath references needed
    for pdf transcoder build.
  - 04_fix_transcoder_pkg.patch - Fix transcoder-pkg target to not copy
    files from other jar files.

[ Matvey Kozhev ]
* debian/changelog:
  - Added ".dfsg" to version.
* debian/control, debian/rules:
  - Build with openjdk-6-jdk, depend on openjdk-6-jre.
  - Added java-6-sun as an alternate build JAVA_HOME directory.
  - Fixed get-orig-source to not include debian/ and delete the source dir,
    and made it delete jars from lib/, as done in the current batik package.
* debian/wrappers.sh:
  - Changed java-7-icedtea reference to java-6-openjdk, as the former has been
    removed back in Hardy.
  - Added newline.
* debian/libbatik-java.install:
  - Added newline.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (c) 1999 World Wide Web Consortium
3
 
 * (Massachusetts Institute of Technology, Institut National de Recherche
4
 
 *  en Informatique et en Automatique, Keio University).
5
 
 * All Rights Reserved. http://www.w3.org/Consortium/Legal/
6
 
 *
7
 
 * The original version of this interface comes from SAX :
8
 
 * http://www.megginson.com/SAX/
9
 
 *
10
 
 * $Id: InputSource.java,v 1.2 2000/11/10 17:14:20 hillion Exp $
11
 
 */
12
 
package org.w3c.css.sac;
13
 
 
14
 
import java.io.InputStream;
15
 
import java.io.Reader;
16
 
 
17
 
/**
18
 
 * A single input source for a CSS source.
19
 
 *
20
 
 * <p>This class allows a CSS application to encapsulate information about an
21
 
 * input source in a single object, which may include a URI, a byte stream
22
 
 * (possibly with a specified encoding), and/or a character stream.</p>
23
 
 *
24
 
 * <p>The CSS parser will use the InputSource object to determine how
25
 
 * to read CSS input.  If there is a character stream available, the
26
 
 * parser will read that stream directly; if not, the parser will use
27
 
 * a byte stream, if available; if neither a character stream nor a
28
 
 * byte stream is available, the parser will attempt to open a URI
29
 
 * connection to the resource identified by the URI.</p>
30
 
 *
31
 
 * <p>An InputSource object belongs to the application: the CSS parser
32
 
 * shall never modify it in any way (it may modify a copy if 
33
 
 * necessary).</p>
34
 
 *
35
 
 * @version $Revision: 1.2 $
36
 
 * @author Philippe Le Hegaret 
37
 
 */
38
 
public class InputSource {
39
 
    
40
 
    private String      uri;
41
 
    private InputStream byteStream;
42
 
    private String      encoding;
43
 
    private Reader      characterStream;
44
 
    private String      title;
45
 
    private String      media;
46
 
    
47
 
    /**
48
 
     * Zero-argument default constructor.
49
 
     *
50
 
     * @see #setURI
51
 
     * @see #setByteStream
52
 
     * @see #setCharacterStream
53
 
     * @see #setEncoding
54
 
     */
55
 
    public InputSource() {
56
 
    }
57
 
    
58
 
    /**
59
 
     * Create a new input source with a URI.
60
 
     *
61
 
     * <p>The URI must be full resolved.</p>
62
 
     *
63
 
     * @param uri The URI.
64
 
     * @see #setURI
65
 
     * @see #setByteStream
66
 
     * @see #setEncoding
67
 
     * @see #setCharacterStream
68
 
     */
69
 
    public InputSource(String uri) {
70
 
        setURI(uri);
71
 
    }
72
 
    
73
 
    /**
74
 
     * Create a new input source with a character stream.
75
 
     *
76
 
     * <p>Application writers may use setURI() to provide a base 
77
 
     * for resolving relative URIs, and setPublicId to include a 
78
 
     * public identifier.</p>
79
 
     *
80
 
     * <p>The character stream shall not include a byte order mark.</p>
81
 
     *
82
 
     * @see #setURI
83
 
     * @see #setByteStream
84
 
     * @see #setCharacterStream
85
 
     */
86
 
    public InputSource(Reader characterStream) {
87
 
        setCharacterStream(characterStream);
88
 
    }
89
 
    
90
 
    /**
91
 
     * Set the URI for this input source.
92
 
     *
93
 
     * <p>The URI is optional if there is a byte stream or a character stream,
94
 
     * but it is still useful to provide one, since the application can use it
95
 
     * to resolve relative URIs and can include it in error messages and
96
 
     * warnings (the parser will attempt to open a connection to the URI only
97
 
     * if there is no byte stream or character stream specified).</p>
98
 
     *
99
 
     * <p>If the application knows the character encoding of the
100
 
     * object pointed to by the URI, it can register
101
 
     * the encoding using the setEncoding method.</p>
102
 
     *
103
 
     * <p>The URI must be fully resolved.</p>
104
 
     *
105
 
     * @param uri The URI as a string.
106
 
     * @see #setEncoding
107
 
     * @see #getURI
108
 
     * @see Locator#getURI
109
 
     * @see CSSParseException#getURI 
110
 
     */
111
 
    public void setURI(String uri) {
112
 
        this.uri = uri;
113
 
    }
114
 
    
115
 
    /**
116
 
     * Get the URI for this input source.
117
 
     *
118
 
     * <p>The getEncoding method will return the character encoding
119
 
     * of the object pointed to, or null if unknown.</p>
120
 
     *
121
 
     * <p>The URI will be fully resolved.</p>
122
 
     *
123
 
     * @return The URI.
124
 
     * @see #setURI
125
 
     * @see #getEncoding
126
 
     */
127
 
    public String getURI() {
128
 
        return uri;
129
 
    }
130
 
    
131
 
    /**
132
 
     * Set the byte stream for this input source.
133
 
     *
134
 
     * <p>The SAX parser will ignore this if there is also a character
135
 
     * stream specified, but it will use a byte stream in preference
136
 
     * to opening a URI connection itself.</p>
137
 
     *
138
 
     * <p>If the application knows the character encoding of the
139
 
     * byte stream, it should set it with the setEncoding method.</p>
140
 
     *
141
 
     * @param byteStream A byte stream containing an CSS document or
142
 
     *        other entity.
143
 
     * @see #setEncoding
144
 
     * @see #getByteStream
145
 
     * @see #getEncoding
146
 
     */
147
 
    public void setByteStream(InputStream byteStream) {
148
 
        this.byteStream = byteStream;
149
 
    }
150
 
    
151
 
    /**
152
 
     * Get the byte stream for this input source.
153
 
     *
154
 
     * <p>The getEncoding method will return the character
155
 
     * encoding for this byte stream, or null if unknown.</p>
156
 
     *
157
 
     * @return The byte stream, or null if none was supplied.
158
 
     * @see #getEncoding
159
 
     * @see #setByteStream
160
 
     */
161
 
    public InputStream getByteStream() {
162
 
        return byteStream;
163
 
    }
164
 
    
165
 
    /** 
166
 
     * Set the character encoding, if known.
167
 
     *
168
 
     * <p>The encoding must be a string acceptable for an
169
 
     * CHARSET encoding declaration (see section 4.4 of the CSS
170
 
     * recommendation Level 2).</p>
171
 
     *
172
 
     * <p>This method has no effect when the application provides a
173
 
     * character stream.</p>
174
 
     *
175
 
     * @param encoding A string describing the character encoding.
176
 
     * @see #setURI
177
 
     * @see #setByteStream
178
 
     * @see #getEncoding
179
 
     */
180
 
    public void setEncoding(String encoding) {
181
 
        this.encoding = encoding;
182
 
    }
183
 
    
184
 
    /**
185
 
     * Get the character encoding for a byte stream or URI.
186
 
     *
187
 
     * @return The encoding, or null if none was supplied.
188
 
     * @see #setByteStream
189
 
     * @see #getURI
190
 
     * @see #getByteStream
191
 
     */
192
 
    public String getEncoding() {
193
 
        return encoding;
194
 
    }
195
 
    
196
 
    /**
197
 
     * Set the character stream for this input source.
198
 
     *
199
 
     * <p>If there is a character stream specified, the SAX parser
200
 
     * will ignore any byte stream and will not attempt to open
201
 
     * a URI connection to the URI.</p>
202
 
     *
203
 
     * @param characterStream The character stream containing the
204
 
     *        CSS document or other entity.
205
 
     * @see #getCharacterStream
206
 
     */
207
 
    public void setCharacterStream(Reader characterStream) {
208
 
        this.characterStream = characterStream;
209
 
    }
210
 
    
211
 
    /**
212
 
     * Get the character stream for this input source.
213
 
     *
214
 
     * @return The character stream, or null if none was supplied.
215
 
     * @see #setCharacterStream
216
 
     */
217
 
    public Reader getCharacterStream() {
218
 
        return characterStream;
219
 
    }
220
 
 
221
 
    /**
222
 
     * Set the title for this input source.
223
 
     * @param title The advisory title. See the title attribute definition
224
 
     *        for the <a href="http://www.w3.org/TR/REC-html40/struct/links.html#edef-LINK">LINK</A>
225
 
     *        element in HTML 4.0, and the title pseudo-attribute for the XML
226
 
     *        style sheet processing instruction.
227
 
     */
228
 
    public void setTitle(String title) {
229
 
        this.title = title;
230
 
    }
231
 
 
232
 
    /**
233
 
     * Returns the title for this input source.
234
 
     */    
235
 
    public String getTitle() {
236
 
        return title;
237
 
    }
238
 
 
239
 
    /**
240
 
     * Set the media for this input source.
241
 
     * @param media A comma separated list with all media.
242
 
     */    
243
 
    public void setMedia(String media) {
244
 
        this.media = media;
245
 
    }
246
 
 
247
 
    /**
248
 
     * Returns the media associated to the input source or <code>null</code>
249
 
     * if media are currently unknown.
250
 
     * @return the media associated to this input source.
251
 
     */    
252
 
    public String getMedia() {
253
 
        if (media == null) {
254
 
            return "all";
255
 
        }
256
 
        return media;
257
 
    }
258
 
}