Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jaxp/src/org/w3c/dom/ls/LSInput.java
86410 views
1
/*
2
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3
*
4
* This code is free software; you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License version 2 only, as
6
* published by the Free Software Foundation. Oracle designates this
7
* particular file as subject to the "Classpath" exception as provided
8
* by Oracle in the LICENSE file that accompanied this code.
9
*
10
* This code is distributed in the hope that it will be useful, but WITHOUT
11
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13
* version 2 for more details (a copy is included in the LICENSE file that
14
* accompanied this code).
15
*
16
* You should have received a copy of the GNU General Public License version
17
* 2 along with this work; if not, write to the Free Software Foundation,
18
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19
*
20
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21
* or visit www.oracle.com if you need additional information or have any
22
* questions.
23
*/
24
25
/*
26
* This file is available under and governed by the GNU General Public
27
* License version 2 only, as published by the Free Software Foundation.
28
* However, the following notice accompanied the original version of this
29
* file and, per its terms, should not be removed:
30
*
31
* Copyright (c) 2004 World Wide Web Consortium,
32
*
33
* (Massachusetts Institute of Technology, European Research Consortium for
34
* Informatics and Mathematics, Keio University). All Rights Reserved. This
35
* work is distributed under the W3C(r) Software License [1] in the hope that
36
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
37
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
38
*
39
* [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
40
*/
41
42
package org.w3c.dom.ls;
43
44
/**
45
* This interface represents an input source for data.
46
* <p> This interface allows an application to encapsulate information about
47
* an input source in a single object, which may include a public
48
* identifier, a system identifier, a byte stream (possibly with a specified
49
* encoding), a base URI, and/or a character stream.
50
* <p> The exact definitions of a byte stream and a character stream are
51
* binding dependent.
52
* <p> The application is expected to provide objects that implement this
53
* interface whenever such objects are needed. The application can either
54
* provide its own objects that implement this interface, or it can use the
55
* generic factory method <code>DOMImplementationLS.createLSInput()</code>
56
* to create objects that implement this interface.
57
* <p> The <code>LSParser</code> will use the <code>LSInput</code> object to
58
* determine how to read data. The <code>LSParser</code> will look at the
59
* different inputs specified in the <code>LSInput</code> in the following
60
* order to know which one to read from, the first one that is not null and
61
* not an empty string will be used:
62
* <ol>
63
* <li> <code>LSInput.characterStream</code>
64
* </li>
65
* <li>
66
* <code>LSInput.byteStream</code>
67
* </li>
68
* <li> <code>LSInput.stringData</code>
69
* </li>
70
* <li>
71
* <code>LSInput.systemId</code>
72
* </li>
73
* <li> <code>LSInput.publicId</code>
74
* </li>
75
* </ol>
76
* <p> If all inputs are null, the <code>LSParser</code> will report a
77
* <code>DOMError</code> with its <code>DOMError.type</code> set to
78
* <code>"no-input-specified"</code> and its <code>DOMError.severity</code>
79
* set to <code>DOMError.SEVERITY_FATAL_ERROR</code>.
80
* <p> <code>LSInput</code> objects belong to the application. The DOM
81
* implementation will never modify them (though it may make copies and
82
* modify the copies, if necessary).
83
* <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407'>Document Object Model (DOM) Level 3 Load
84
and Save Specification</a>.
85
*/
86
public interface LSInput {
87
/**
88
* An attribute of a language and binding dependent type that represents
89
* a stream of 16-bit units. The application must encode the stream
90
* using UTF-16 (defined in [Unicode] and in [ISO/IEC 10646]). It is not a requirement to have an XML declaration when
91
* using character streams. If an XML declaration is present, the value
92
* of the encoding attribute will be ignored.
93
*/
94
public java.io.Reader getCharacterStream();
95
/**
96
* An attribute of a language and binding dependent type that represents
97
* a stream of 16-bit units. The application must encode the stream
98
* using UTF-16 (defined in [Unicode] and in [ISO/IEC 10646]). It is not a requirement to have an XML declaration when
99
* using character streams. If an XML declaration is present, the value
100
* of the encoding attribute will be ignored.
101
*/
102
public void setCharacterStream(java.io.Reader characterStream);
103
104
/**
105
* An attribute of a language and binding dependent type that represents
106
* a stream of bytes.
107
* <br> If the application knows the character encoding of the byte
108
* stream, it should set the encoding attribute. Setting the encoding in
109
* this way will override any encoding specified in an XML declaration
110
* in the data.
111
*/
112
public java.io.InputStream getByteStream();
113
/**
114
* An attribute of a language and binding dependent type that represents
115
* a stream of bytes.
116
* <br> If the application knows the character encoding of the byte
117
* stream, it should set the encoding attribute. Setting the encoding in
118
* this way will override any encoding specified in an XML declaration
119
* in the data.
120
*/
121
public void setByteStream(java.io.InputStream byteStream);
122
123
/**
124
* String data to parse. If provided, this will always be treated as a
125
* sequence of 16-bit units (UTF-16 encoded characters). It is not a
126
* requirement to have an XML declaration when using
127
* <code>stringData</code>. If an XML declaration is present, the value
128
* of the encoding attribute will be ignored.
129
*/
130
public String getStringData();
131
/**
132
* String data to parse. If provided, this will always be treated as a
133
* sequence of 16-bit units (UTF-16 encoded characters). It is not a
134
* requirement to have an XML declaration when using
135
* <code>stringData</code>. If an XML declaration is present, the value
136
* of the encoding attribute will be ignored.
137
*/
138
public void setStringData(String stringData);
139
140
/**
141
* The system identifier, a URI reference [<a href='http://www.ietf.org/rfc/rfc2396.txt'>IETF RFC 2396</a>], for this
142
* input source. The system identifier is optional if there is a byte
143
* stream, a character stream, or string data. It is still useful to
144
* provide one, since the application will use it to resolve any
145
* relative URIs and can include it in error messages and warnings. (The
146
* LSParser will only attempt to fetch the resource identified by the
147
* URI reference if there is no other input available in the input
148
* source.)
149
* <br> If the application knows the character encoding of the object
150
* pointed to by the system identifier, it can set the encoding using
151
* the <code>encoding</code> attribute.
152
* <br> If the specified system ID is a relative URI reference (see
153
* section 5 in [<a href='http://www.ietf.org/rfc/rfc2396.txt'>IETF RFC 2396</a>]), the DOM
154
* implementation will attempt to resolve the relative URI with the
155
* <code>baseURI</code> as the base, if that fails, the behavior is
156
* implementation dependent.
157
*/
158
public String getSystemId();
159
/**
160
* The system identifier, a URI reference [<a href='http://www.ietf.org/rfc/rfc2396.txt'>IETF RFC 2396</a>], for this
161
* input source. The system identifier is optional if there is a byte
162
* stream, a character stream, or string data. It is still useful to
163
* provide one, since the application will use it to resolve any
164
* relative URIs and can include it in error messages and warnings. (The
165
* LSParser will only attempt to fetch the resource identified by the
166
* URI reference if there is no other input available in the input
167
* source.)
168
* <br> If the application knows the character encoding of the object
169
* pointed to by the system identifier, it can set the encoding using
170
* the <code>encoding</code> attribute.
171
* <br> If the specified system ID is a relative URI reference (see
172
* section 5 in [<a href='http://www.ietf.org/rfc/rfc2396.txt'>IETF RFC 2396</a>]), the DOM
173
* implementation will attempt to resolve the relative URI with the
174
* <code>baseURI</code> as the base, if that fails, the behavior is
175
* implementation dependent.
176
*/
177
public void setSystemId(String systemId);
178
179
/**
180
* The public identifier for this input source. This may be mapped to an
181
* input source using an implementation dependent mechanism (such as
182
* catalogues or other mappings). The public identifier, if specified,
183
* may also be reported as part of the location information when errors
184
* are reported.
185
*/
186
public String getPublicId();
187
/**
188
* The public identifier for this input source. This may be mapped to an
189
* input source using an implementation dependent mechanism (such as
190
* catalogues or other mappings). The public identifier, if specified,
191
* may also be reported as part of the location information when errors
192
* are reported.
193
*/
194
public void setPublicId(String publicId);
195
196
/**
197
* The base URI to be used (see section 5.1.4 in [<a href='http://www.ietf.org/rfc/rfc2396.txt'>IETF RFC 2396</a>]) for
198
* resolving a relative <code>systemId</code> to an absolute URI.
199
* <br> If, when used, the base URI is itself a relative URI, an empty
200
* string, or null, the behavior is implementation dependent.
201
*/
202
public String getBaseURI();
203
/**
204
* The base URI to be used (see section 5.1.4 in [<a href='http://www.ietf.org/rfc/rfc2396.txt'>IETF RFC 2396</a>]) for
205
* resolving a relative <code>systemId</code> to an absolute URI.
206
* <br> If, when used, the base URI is itself a relative URI, an empty
207
* string, or null, the behavior is implementation dependent.
208
*/
209
public void setBaseURI(String baseURI);
210
211
/**
212
* The character encoding, if known. The encoding must be a string
213
* acceptable for an XML encoding declaration ([<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>] section
214
* 4.3.3 "Character Encoding in Entities").
215
* <br> This attribute has no effect when the application provides a
216
* character stream or string data. For other sources of input, an
217
* encoding specified by means of this attribute will override any
218
* encoding specified in the XML declaration or the Text declaration, or
219
* an encoding obtained from a higher level protocol, such as HTTP [<a href='http://www.ietf.org/rfc/rfc2616.txt'>IETF RFC 2616</a>].
220
*/
221
public String getEncoding();
222
/**
223
* The character encoding, if known. The encoding must be a string
224
* acceptable for an XML encoding declaration ([<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>] section
225
* 4.3.3 "Character Encoding in Entities").
226
* <br> This attribute has no effect when the application provides a
227
* character stream or string data. For other sources of input, an
228
* encoding specified by means of this attribute will override any
229
* encoding specified in the XML declaration or the Text declaration, or
230
* an encoding obtained from a higher level protocol, such as HTTP [<a href='http://www.ietf.org/rfc/rfc2616.txt'>IETF RFC 2616</a>].
231
*/
232
public void setEncoding(String encoding);
233
234
/**
235
* If set to true, assume that the input is certified (see section 2.13
236
* in [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>]) when
237
* parsing [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>].
238
*/
239
public boolean getCertifiedText();
240
/**
241
* If set to true, assume that the input is certified (see section 2.13
242
* in [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>]) when
243
* parsing [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>].
244
*/
245
public void setCertifiedText(boolean certifiedText);
246
247
}
248
249