Top Description Fields Constructors Methods
org.codehaus.stax2.io

public abstract Class Stax2Source

extends Object
implements Source
Class Inheritance
All Implemented Interfaces
javax.xml.transform.Source
Known Direct Subclasses
org.codehaus.stax2.io.Stax2BlockSource, org.codehaus.stax2.io.Stax2ReferentialSource
Imports
java.io.InputStream, .IOException, .Reader, java.net.URL, javax.xml.transform.Source

This is the base class for additional input sources (implementations of javax.xml.transform.Source) that Stax2 org.codehaus.stax2.XMLInputFactory2 implementations should support.

Note about usage by the parser factory implementations: the expectation is that at least one of methods constructReader and constructInputStream will succeed, but not necessarily both. This generally depends on type of resource being represented: for example, if the source is a String or character array, it is most naturally represent via Reader. For a byte array, on the other hand, an InputStream is the most natural access method.

Other things to note about using result Readers and InputStreams:

Field Summary

Modifier and TypeField and Description
protected String
protected String
protected String

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public abstract InputStream
constructInputStream()

This method creates an InputStream via which underlying input source can be accessed.

public abstract Reader
constructReader()

This method creates a Reader via which underlying input source can be accessed.

public String
public String
public abstract URL

Returns:

URL that can be used to resolve references originating from the content read via this source; may be null if not known (which is the case for most non-referential sources)
getReference
()

public String
getSystemId()

Implements javax.xml.transform.Source.getSystemId.

Get the system identifier that was set with setSystemId.
public void
public void
public void
setSystemId(String
The system identifier as a URL string.
id
)

Implements javax.xml.transform.Source.setSystemId.

Set the system identifier for this Source.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

mEncodingback to summary
protected String mEncoding
mPublicIdback to summary
protected String mPublicId
mSystemIdback to summary
protected String mSystemId

Constructor Detail

Stax2Sourceback to summary
protected Stax2Source()

Method Detail

constructInputStreamback to summary
public abstract InputStream constructInputStream() throws IOException

This method creates an InputStream via which underlying input source can be accessed. Note that caller is responsible for closing that InputSource when it is done reading it

constructReaderback to summary
public abstract Reader constructReader() throws IOException

This method creates a Reader via which underlying input source can be accessed. Note that caller is responsible for closing that Reader when it is done reading it.

getEncodingback to summary
public String getEncoding()
getPublicIdback to summary
public String getPublicId()
getReferenceback to summary
public abstract URL getReference()
Returns:URL

URL that can be used to resolve references originating from the content read via this source; may be null if not known (which is the case for most non-referential sources)

getSystemIdback to summary
public String getSystemId()

Implements javax.xml.transform.Source.getSystemId.

Doc from javax.xml.transform.Source.getSystemId.

Get the system identifier that was set with setSystemId.

Returns:String

The system identifier that was set with setSystemId, or null if setSystemId was not called.

Annotations
@Override
setEncodingback to summary
public void setEncoding(String enc)
setPublicIdback to summary
public void setPublicId(String id)
setSystemIdback to summary
public void setSystemId(String id)

Implements javax.xml.transform.Source.setSystemId.

Doc from javax.xml.transform.Source.setSystemId.

Set the system identifier for this Source.

The system identifier is optional if the source does not get its data from a URL, but it may still be useful to provide one. The application can use a system identifier, for example, to resolve relative URIs and to include in error messages and warnings.

Parameters
id:String

The system identifier as a URL string.

Annotations
@Override