Package org.codehaus.stax2.io
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 forStax2Source
s 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
Constructors Modifier Constructor Description protected
Stax2BlockSource()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract InputStream
constructInputStream()
This method creates anInputStream
via which underlying input source can be accessed.abstract Reader
constructReader()
This method creates aReader
via which underlying input source can be accessed.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
-
-
-
-
Method Detail
-
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 classStax2Source
- 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 aReader
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 classStax2Source
- Throws:
IOException
-
constructInputStream
public abstract InputStream constructInputStream() throws IOException
Description copied from class:Stax2Source
This method creates anInputStream
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 classStax2Source
- Throws:
IOException
-
-