Debian Codegraph @

net/sf/saxon/pull/PullSource.java

raw symbols SCIP
1 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2018 Saxonica Limited.
3 // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4 // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
6 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7
8 package net.sf.saxon.pull;
9
10 import javax.xml.transform.Source;
11
12 /**
13 * A PullSource is a JAXP Source that encapsulates a PullProvider - that is, an object
14 * that supplies an XML document as a sequence of events that are read under the control
15 * of the recipient. Note that although PullSource implements the JAXP Source interface,
16 * it is not necessarily acceptable to every JAXP implementation that accepts a Source
17 * as input: Source is essentially a marker interface and users of Source objects need
18 * to understand the individual implementation.
19 */
20
21 public class PullSource implements Source {
22
23 private String systemId;
24 private PullProvider provider;
25
26 /**
27 * Create a PullSource based on a supplied PullProvider
28 *
29 * @param provider the underlying PullProvider
30 */
31
32 public PullSource(/*@NotNull*/ PullProvider provider) {
33 this.provider = provider;
34 if (provider.getSourceLocator() != null) {
35 systemId = provider.getSourceLocator().getSystemId();
36 }
37 }
38
39 /**
40 * Get the PullProvider
41 *
42 * @return the underlying PullProvider
43 */
44
45 public PullProvider getPullProvider() {
46 return provider;
47 }
48
49 /**
50 * Set the system identifier for this Source.
51 * <p>The system identifier is optional if the source does not
52 * get its data from a URL, but it may still be useful to provide one.
53 * The application can use a system identifier, for example, to resolve
54 * relative URIs and to include in error messages and warnings.</p>
55 *
56 * @param systemId The system identifier as a URL string.
57 */
58 public void setSystemId(String systemId) {
59 this.systemId = systemId;
60 }
61
62 /**
63 * Get the system identifier that was set with setSystemId.
64 *
65 * @return The system identifier that was set with setSystemId, or null
66 * if setSystemId was not called.
67 */
68 public String getSystemId() {
69 return systemId;
70 }
71 }
72