Acts as an holder for a transformation Source in the form of a stream of XML markup.
Note
Due to their internal use of either a Reader or InputStream instance,
StreamSource instances may only be used once.
| Modifier and Type | Field and Description |
|---|---|
| public static final String | FEATURE
If |
| private InputStream | inputStream
The byte stream for this Source, or null. |
| private String | publicId
The public identifier for this input source, or null. |
| private Reader | reader
The character stream for this Source, or null. |
| private String | systemId
The system identifier as a URL string, or null. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | StreamSource(InputStream
A valid InputStream reference to an XML stream. inputStream)Construct a StreamSource from a byte stream. |
| public | StreamSource(InputStream
A valid InputStream reference to an XML stream. inputStream, String Must be a String that conforms to the URI syntax. systemId)Construct a StreamSource from a byte stream. |
| public | StreamSource(Reader
A valid Reader reference to an XML character stream. reader)Construct a StreamSource from a character reader. |
| public | StreamSource(Reader
A valid Reader reference to an XML character stream. reader, String Must be a String that conforms to the URI syntax. systemId)Construct a StreamSource from a character reader. |
| public | StreamSource(String
Must be a String that conforms to the URI syntax. systemId)Construct a StreamSource from a URL. |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public InputStream | Returns: The byte stream that was set with setByteStream, or null if setByteStream or the ByteStream constructor was not called.Get the byte stream that was set with setByteStream. |
| public String | Returns: The public identifier that was set with setPublicId, or null if setPublicId was not called.Get the public identifier that was set with setPublicId. |
| public Reader | Returns: The character stream that was set with setReader, or null if setReader or the Reader constructor was not called.Get the character stream that was set with setReader. |
| public String | Returns: The system identifier that was set with setSystemId, or null if setSystemId was not called.Implements javax. Get the system identifier that was set with setSystemId. |
| public boolean | Returns: true if theStreamSource object is empty, false otherwiseOverrides default javax. Indicates whether the |
| private boolean | |
| public void | setInputStream(InputStream
A valid InputStream reference to an XML stream. inputStream)Set the byte stream to be used as input. |
| public void | setPublicId(String
The public identifier as a string. publicId)Set the public identifier for this Source. |
| public void | |
| public void | setSystemId(String
The system identifier as a URL string. systemId)Implements javax. Set the system identifier for this Source. |
| public void |
| FEATURE | back to summary |
|---|---|
| public static final String FEATURE If | |
| inputStream | back to summary |
|---|---|
| private InputStream inputStream The byte stream for this Source, or null. | |
| publicId | back to summary |
|---|---|
| private String publicId The public identifier for this input source, or null. | |
| reader | back to summary |
|---|---|
| private Reader reader The character stream for this Source, or null. | |
| systemId | back to summary |
|---|---|
| private String systemId The system identifier as a URL string, or null. | |
| StreamSource | back to summary |
|---|---|
| public StreamSource() Zero-argument default constructor. If this constructor is used, and
no Stream source is set using
| |
| StreamSource | back to summary |
|---|---|
| public StreamSource(InputStream inputStream) Construct a StreamSource from a byte stream. Normally, a stream should be used rather than a reader, so the XML parser can resolve character encoding specified by the XML declaration. If this constructor is used to process a stylesheet, normally setSystemId should also be called, so that relative URI references can be resolved.
| |
| StreamSource | back to summary |
|---|---|
| public StreamSource(InputStream inputStream, String systemId) Construct a StreamSource from a byte stream. Normally, a stream should be used rather than a reader, so that the XML parser can resolve character encoding specified by the XML declaration. This constructor allows the systemID to be set in addition to the input stream, which allows relative URIs to be processed.
| |
| StreamSource | back to summary |
|---|---|
| public StreamSource(Reader reader) Construct a StreamSource from a character reader. Normally, a stream should be used rather than a reader, so that the XML parser can resolve character encoding specified by the XML declaration. However, in many cases the encoding of the input stream is already resolved, as in the case of reading XML from a StringReader.
| |
| StreamSource | back to summary |
|---|---|
| public StreamSource(Reader reader, String systemId) Construct a StreamSource from a character reader. Normally, a stream should be used rather than a reader, so that the XML parser may resolve character encoding specified by the XML declaration. However, in many cases the encoding of the input stream is already resolved, as in the case of reading XML from a StringReader. | |
| StreamSource | back to summary |
|---|---|
| public StreamSource(String systemId) Construct a StreamSource from a URL.
| |
| StreamSource | back to summary |
|---|---|
| public StreamSource(File f) Construct a StreamSource from a File.
| |
| getInputStream | back to summary |
|---|---|
| public InputStream getInputStream() Get the byte stream that was set with setByteStream.
| |
| getPublicId | back to summary |
|---|---|
| public String getPublicId() Get the public identifier that was set with setPublicId.
| |
| getReader | back to summary |
|---|---|
| public Reader getReader() Get the character stream that was set with setReader.
| |
| getSystemId | back to summary |
|---|---|
| public String getSystemId() Implements javax. Get the system identifier that was set with setSystemId. | |
| isEmpty | back to summary |
|---|---|
| public boolean isEmpty() Overrides default javax. Indicates whether the
In case of error while checking the byte or character stream, the method will return false to allow the XML processor to handle the error.
| |
| isStreamEmpty | back to summary |
|---|---|
| private boolean isStreamEmpty() | |
| setInputStream | back to summary |
|---|---|
| public void setInputStream(InputStream inputStream) Set the byte stream to be used as input. Normally, a stream should be used rather than a reader, so that the XML parser can resolve character encoding specified by the XML declaration. If this Source object is used to process a stylesheet, normally setSystemId should also be called, so that relative URL references can be resolved.
| |
| setPublicId | back to summary |
|---|---|
| public void setPublicId(String publicId) Set the public identifier for this Source. The public identifier is always optional: if the application writer includes one, it will be provided as part of the location information.
| |
| setReader | back to summary |
|---|---|
| public void setReader(Reader reader) Set the input to be a character reader. Normally, a stream should be used rather than a reader, so that the XML parser can resolve character encoding specified by the XML declaration. However, in many cases the encoding of the input stream is already resolved, as in the case of reading XML from a StringReader.
| |
| setSystemId | back to summary |
|---|---|
| public void setSystemId(String systemId) Implements javax. Set the system identifier for this Source. The system identifier is optional if there is a byte stream or a character stream, but it is still useful to provide one, since the application can use it to resolve relative URIs and can include it in error messages and warnings (the parser will attempt to open a connection to the URI only if there is no byte stream or character stream specified). | |
| setSystemId | back to summary |
|---|---|
| public void setSystemId(File f) Set the system ID from a File reference.
| |