Class Stax2ByteArraySource

  • All Implemented Interfaces:
    javax.xml.transform.Source

    public class Stax2ByteArraySource
    extends Stax2BlockSource
    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 Detail

      • DEFAULT_ENCODING

        private static final java.lang.String DEFAULT_ENCODING
        See Also:
        Constant Field Values
      • mBuffer

        final byte[] mBuffer
      • mStart

        final int mStart
      • mLength

        final int mLength
    • Constructor Detail

      • Stax2ByteArraySource

        public Stax2ByteArraySource​(byte[] buf,
                                    int start,
                                    int len)
    • Method Detail

      • constructReader

        public java.io.Reader constructReader()
                                       throws java.io.IOException
        Note: if encoding is not explicitly defined, UTF-8 is assumed.
        Specified by:
        constructReader in class Stax2BlockSource
        Throws:
        java.io.IOException
      • constructInputStream

        public 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 Stax2BlockSource
        Throws:
        java.io.IOException
      • getBuffer

        public byte[] getBuffer()
      • getBufferStart

        public int getBufferStart()
      • getBufferLength

        public int getBufferLength()
      • getBufferEnd

        public int getBufferEnd()