Class SeekableReadOnlyInputStream

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Close this channel.
      long getPosition()  
      int read()
      Read a single byte of data.
      int read​(byte[] buffer, int off, int count)
      Read up to count bytes to the specified buffer.
      int readFully​(byte[] buffer, int count)
      Read exactly count bytes to the specified buffer.
      void setPosition​(long pos)  
      • Methods inherited from class java.lang.Object

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

      • SeekableReadOnlyInputStream

        public SeekableReadOnlyInputStream​(java.io.InputStream is)
        Create new instance.
        Parameters:
        is - The input stream to wrap.
    • Method Detail

      • getPosition

        public long getPosition()
                         throws java.io.IOException
        Specified by:
        getPosition in interface SeekableReadOnlyByteChannel
        Returns:
        the current position in the channel
        Throws:
        java.io.IOException - .
      • setPosition

        public void setPosition​(long pos)
                         throws java.io.IOException
        Specified by:
        setPosition in interface SeekableReadOnlyByteChannel
        Parameters:
        pos - the position in the channel
        Throws:
        java.io.IOException - .
      • read

        public int read​(byte[] buffer,
                        int off,
                        int count)
                 throws java.io.IOException
        Description copied from interface: SeekableReadOnlyByteChannel
        Read up to count bytes to the specified buffer.
        Specified by:
        read in interface SeekableReadOnlyByteChannel
        Parameters:
        buffer - .
        off - .
        count - .
        Returns:
        read read
        Throws:
        java.io.IOException - .
      • readFully

        public int readFully​(byte[] buffer,
                             int count)
                      throws java.io.IOException
        Description copied from interface: SeekableReadOnlyByteChannel
        Read exactly count bytes to the specified buffer.
        Specified by:
        readFully in interface SeekableReadOnlyByteChannel
        Parameters:
        buffer - where to store the read data
        count - how many bytes to read
        Returns:
        bytes read || -1 if IO problem
        Throws:
        java.io.IOException - .