Top Description Fields Constructors Methods
org.glassfish.jaxb.runtime.v2.util

public final Class DataSourceSource

extends StreamSource
Class Inheritance
Imports
jakarta.activation.DataHandler, .DataSource, .MimeType, .MimeTypeParseException, javax.xml.transform.Source, javax.xml.transform.stream.StreamSource, java.io.IOException, .InputStream, .InputStreamReader, .Reader

Source implementation backed by DataHandler.

This implementation allows the same Source to be used mutliple times.

Source isn't really pluggable. As a consequence, this implementation is clunky --- weak against unexpected usage of the class.

Author
Kohsuke Kawaguchi

Field Summary

Modifier and TypeField and Description
private final String
charset

If null, default to the encoding declaration

private InputStream
private Reader
r

private final DataSource
Inherited from javax.xml.transform.stream.StreamSource:
FEATURE

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public DataSource
public InputStream
getInputStream()

Overrides javax.xml.transform.stream.StreamSource.getInputStream.

Get the byte stream that was set with setByteStream.

public Reader
getReader()

Overrides javax.xml.transform.stream.StreamSource.getReader.

Get the character stream that was set with setReader.

public void
setInputStream(InputStream inputStream)

Overrides javax.xml.transform.stream.StreamSource.setInputStream.

Set the byte stream to be used as input.

public void
setReader(Reader reader)

Overrides javax.xml.transform.stream.StreamSource.setReader.

Set the input to be a character reader.

Inherited from javax.xml.transform.stream.StreamSource:
getPublicIdgetSystemIdisEmptysetPublicIdsetSystemIdsetSystemId

Field Detail

charsetback to summary
private final String charset

If null, default to the encoding declaration

isback to summary
private InputStream is
rback to summary
private Reader r
sourceback to summary
private final DataSource source

Constructor Detail

DataSourceSourceback to summary
public DataSourceSource(DataHandler dh) throws MimeTypeParseException
DataSourceSourceback to summary
public DataSourceSource(DataSource source) throws MimeTypeParseException

Method Detail

getDataSourceback to summary
public DataSource getDataSource()
getInputStreamback to summary
public InputStream getInputStream()

Overrides javax.xml.transform.stream.StreamSource.getInputStream.

Doc from javax.xml.transform.stream.StreamSource.getInputStream.

Get the byte stream that was set with setByteStream.

Annotations
@Override
getReaderback to summary
public Reader getReader()

Overrides javax.xml.transform.stream.StreamSource.getReader.

Doc from javax.xml.transform.stream.StreamSource.getReader.

Get the character stream that was set with setReader.

Annotations
@Override
setInputStreamback to summary
public void setInputStream(InputStream inputStream)

Overrides javax.xml.transform.stream.StreamSource.setInputStream.

Doc from javax.xml.transform.stream.StreamSource.setInputStream.

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.

Annotations
@Override
setReaderback to summary
public void setReader(Reader reader)

Overrides javax.xml.transform.stream.StreamSource.setReader.

Doc from javax.xml.transform.stream.StreamSource.setReader.

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.

Annotations
@Override