Class Stax2BlockSource

java.lang.Object
org.codehaus.stax2.io.Stax2Source
org.codehaus.stax2.io.Stax2BlockSource
All Implemented Interfaces:
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.
  • Constructor Details

    • Stax2BlockSource

      protected Stax2BlockSource()
  • Method Details

    • getReference

      public 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 Reader constructReader() throws 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:
      IOException
    • constructInputStream

      public abstract InputStream constructInputStream() throws 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:
      IOException