Class ByteArrayInputSource

  • All Implemented Interfaces:
    InputSource
    Direct Known Subclasses:
    StringInputSource

    public class ByteArrayInputSource
    extends java.lang.Object
    implements InputSource
    An input source that provides a byte array.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected byte[] buffer  
      protected int offset  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Closes the stream source.
      byte[] nextChunk()
      Reads next "chunk" from this stream.
      void open()
      Opens the stream source.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • buffer

        protected byte[] buffer
      • offset

        protected int offset
    • Constructor Detail

      • ByteArrayInputSource

        public ByteArrayInputSource​(byte[] data)
    • Method Detail

      • close

        public void close()
                   throws java.io.IOException
        Description copied from interface: InputSource
        Closes the stream source.
        Specified by:
        close in interface InputSource
        Throws:
        java.io.IOException - if an IO error occurs
      • open

        public void open()
                  throws java.io.IOException
        Description copied from interface: InputSource
        Opens the stream source.
        Specified by:
        open in interface InputSource
        Throws:
        java.io.IOException - if an IO error occurs
      • nextChunk

        public byte[] nextChunk()
                         throws java.io.IOException
        Description copied from interface: InputSource
        Reads next "chunk" from this stream.
        Specified by:
        nextChunk in interface InputSource
        Returns:
        the number of bytes read or null if there is nothing more to read.
        Throws:
        java.io.IOException - if an IO error occurs