org.codehaus.stax2.io
Class Stax2BlockSource

java.lang.Object
  extended by org.codehaus.stax2.io.Stax2Source
      extended by org.codehaus.stax2.io.Stax2BlockSource
All Implemented Interfaces:
javax.xml.transform.Source
Direct Known Subclasses:
Stax2ByteArraySource, Stax2CharArraySource, Stax2StringSource

public abstract class Stax2BlockSource
extends Stax2Source

This is the mid-level abstract base class for Stax2Sources that an be used to access fixed-length in-memory data sources, such as byte and char arrays, Strings, StringBuffers and so forth. The main reason for using such a source object (instead of constructing wrapper Readers or InputStreams) is that concrete implementations usually also allow more direct access to the underlying data, so that stream reader implementations may be able to do more optimal access.


Field Summary
 
Fields inherited from class org.codehaus.stax2.io.Stax2Source
mEncoding, mPublicId, mSystemId
 
Constructor Summary
protected Stax2BlockSource()
           
 
Method Summary
abstract  java.io.InputStream constructInputStream()
          This method creates an InputStream via which underlying input source can be accessed.
abstract  java.io.Reader constructReader()
          This method creates a Reader via which underlying input source can be accessed.
 java.net.URL getReference()
          Usually there is no way to refer to the underlying data source, since they are in-memory data structures.
 
Methods inherited from class org.codehaus.stax2.io.Stax2Source
getEncoding, getPublicId, getSystemId, setEncoding, setPublicId, setSystemId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Stax2BlockSource

protected Stax2BlockSource()
Method Detail

getReference

public java.net.URL getReference()
Usually there is no way to refer to the underlying data source, since they are in-memory data structures. Because of this, the base implementation just returns null.

Specified by:
getReference in class Stax2Source
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)

constructReader

public abstract java.io.Reader constructReader()
                                        throws java.io.IOException
Description copied from class: Stax2Source
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.

Specified by:
constructReader in class Stax2Source
Throws:
java.io.IOException

constructInputStream

public abstract java.io.InputStream constructInputStream()
                                                  throws java.io.IOException
Description copied from class: Stax2Source
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

Specified by:
constructInputStream in class Stax2Source
Throws:
java.io.IOException