Package org.codehaus.stax2.io
Class Stax2ByteArraySource
java.lang.Object
org.codehaus.stax2.io.Stax2Source
org.codehaus.stax2.io.Stax2BlockSource
org.codehaus.stax2.io.Stax2ByteArraySource
- All Implemented Interfaces:
Source
Simple implementation of
Stax2BlockSource
that encapsulates
a byte array.
Note that no copy is made of the passed-in array, and that further there are direct access methods. Thus, although callers are not to modify contents of returned array, this can not be guaranteed; and as such if this would be a problem (security problem for example), caller has to make a copy of the array and pass that copy to the constructor.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
(package private) final byte[]
(package private) final int
(package private) final int
Fields inherited from class org.codehaus.stax2.io.Stax2Source
mEncoding, mPublicId, mSystemId
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThis method creates anInputStream
via which underlying input source can be accessed.Note: if encoding is not explicitly defined, UTF-8 is assumed.byte[]
int
int
int
Methods inherited from class org.codehaus.stax2.io.Stax2BlockSource
getReference
Methods inherited from class org.codehaus.stax2.io.Stax2Source
getEncoding, getPublicId, getSystemId, setEncoding, setPublicId, setSystemId
-
Field Details
-
DEFAULT_ENCODING
- See Also:
-
mBuffer
final byte[] mBuffer -
mStart
final int mStart -
mLength
final int mLength
-
-
Constructor Details
-
Stax2ByteArraySource
public Stax2ByteArraySource(byte[] buf, int start, int len)
-
-
Method Details
-
constructReader
Note: if encoding is not explicitly defined, UTF-8 is assumed.- Specified by:
constructReader
in classStax2BlockSource
- Throws:
IOException
-
constructInputStream
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 classStax2BlockSource
- Throws:
IOException
-
getBuffer
public byte[] getBuffer() -
getBufferStart
public int getBufferStart() -
getBufferLength
public int getBufferLength() -
getBufferEnd
public int getBufferEnd()
-