Class BoundedInputStream

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class BoundedInputStream
    extends InputStream
    Very slight modification of Commons' BoundedInputStream so that we can figure out if this hit the bound or not.
    • Constructor Detail

      • BoundedInputStream

        public BoundedInputStream​(long max,
                                  InputStream in)
    • Method Detail

      • read

        public int read​(byte[] b)
                 throws IOException
        Invokes the delegate's read(byte[]) method.
        Overrides:
        read in class InputStream
        Parameters:
        b - the buffer to read the bytes into
        Returns:
        the number of bytes read or -1 if the end of stream or the limit has been reached.
        Throws:
        IOException - if an I/O error occurs
      • read

        public int read​(byte[] b,
                        int off,
                        int len)
                 throws IOException
        Invokes the delegate's read(byte[], int, int) method.
        Overrides:
        read in class InputStream
        Parameters:
        b - the buffer to read the bytes into
        off - The start offset
        len - The number of bytes to read
        Returns:
        the number of bytes read or -1 if the end of stream or the limit has been reached.
        Throws:
        IOException - if an I/O error occurs
      • skip

        public long skip​(long n)
                  throws IOException
        Invokes the delegate's skip(long) method.
        Overrides:
        skip in class InputStream
        Parameters:
        n - the number of bytes to skip
        Returns:
        the actual number of bytes skipped
        Throws:
        IOException - if an I/O error occurs
      • mark

        public void mark​(int readLimit)
        Overrides:
        mark in class InputStream
      • hasHitBound

        public boolean hasHitBound()