Class SeekableInputStream

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected long contentLength  
    • Constructor Summary

      Constructors 
      Constructor Description
      SeekableInputStream​(long contentLength, long maxSkipDistance)  
    • Field Detail

      • contentLength

        protected long contentLength
    • Constructor Detail

      • SeekableInputStream

        public SeekableInputStream​(long contentLength,
                                   long maxSkipDistance)
        Parameters:
        contentLength - Total stream length
        maxSkipDistance - Maximum distance that should be skipped by reading and discarding
    • Method Detail

      • getContentLength

        public long getContentLength()
        Returns:
        Length of the stream
      • getMaxSkipDistance

        public long getMaxSkipDistance()
        Returns:
        Maximum distance that this stream will skip without doing a direct seek on the underlying resource.
      • getPosition

        public abstract long getPosition()
        Returns:
        Current position in the stream
      • seekHard

        protected abstract void seekHard​(long position)
                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • canSeekHard

        public abstract boolean canSeekHard()
        Returns:
        true if it is possible to seek to an arbitrary position in this stream, even when it is behind the current position.
      • skipFully

        public void skipFully​(long distance)
                       throws java.io.IOException
        Skip the specified number of bytes in the stream. The result is either that the requested number of bytes were skipped or an EOFException was thrown.
        Parameters:
        distance - The number of bytes to skip
        Throws:
        java.io.IOException - On IO error
      • seek

        public void seek​(long position)
                  throws java.io.IOException
        Seek to the specified position
        Parameters:
        position - The position to seek to
        Throws:
        java.io.IOException - On a read error or if the position is beyond EOF