Class RangedInputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class RangedInputStream
    extends CountingInputStream
    • Constructor Summary

      Constructors 
      Constructor Description
      RangedInputStream​(java.io.InputStream in, long length)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      int read()
      Reads the next byte of data from this input stream.
      int read​(byte[] b)
      Reads up to byte.length bytes of data from this input stream into an array of bytes.
      int read​(byte[] b, int off, int len)
      Reads up to len bytes of data from this input stream into an array of bytes.
      long skip​(long n)
      Skips over and discards n bytes of data from the input stream.
      • Methods inherited from class java.io.FilterInputStream

        available, mark, markSupported, reset
      • Methods inherited from class java.io.InputStream

        nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
      • Methods inherited from class java.lang.Object

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

      • RangedInputStream

        public RangedInputStream​(java.io.InputStream in,
                                 long length)
        Parameters:
        in -
    • Method Detail

      • read

        public int read()
                 throws java.io.IOException
        Description copied from class: CountingInputStream
        Reads the next byte of data from this input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.
        Overrides:
        read in class CountingInputStream
        Returns:
        the next byte of data or -1 if the end of stream is reached
        Throws:
        java.io.IOException - if an I/O error occurs
      • read

        public int read​(byte[] b,
                        int off,
                        int len)
                 throws java.io.IOException
        Description copied from class: CountingInputStream
        Reads up to len bytes of data from this input stream into an array of bytes. This method blocks until some input is available.
        Overrides:
        read in class CountingInputStream
        Parameters:
        b - the buffer into which the data is read
        off - the start offset in the buffer to write the data
        len - the maximum number of bytes to read
        Returns:
        the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
        Throws:
        java.io.IOException - if an I/O error occurs
      • read

        public int read​(byte[] b)
                 throws java.io.IOException
        Description copied from class: CountingInputStream
        Reads up to byte.length bytes of data from this input stream into an array of bytes. This method blocks until some input is available.
        Overrides:
        read in class CountingInputStream
        Returns:
        the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
        Throws:
        java.io.IOException - if an I/O error occurs
      • skip

        public long skip​(long n)
                  throws java.io.IOException
        Description copied from class: CountingInputStream
        Skips over and discards n bytes of data from the input stream. The skip method may, for a variety of reasons, end up skipping over some smaller number of bytes, possibly 0. The actual number of bytes skipped is returned.
        Overrides:
        skip in class CountingInputStream
        Parameters:
        n - the number of bytes to be skipped
        Returns:
        the actual number of bytes skipped
        Throws:
        java.io.IOException - if an I/O error occurs
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.FilterInputStream
        Throws:
        java.io.IOException