Package 

Class BoundedInputStream

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

    
    public class BoundedInputStream
    extends InputStream
                        

    A stream that limits reading from a wrapped stream to a given number of bytes.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private long bytesRemaining
    • Constructor Summary

      Constructors 
      Constructor Description
      BoundedInputStream(InputStream in, long size) Creates the stream that will at most read the given amount ofbytes from the given stream.
    • Method Summary

      Modifier and Type Method Description
      long getBytesRemaining()
      void close()
      int read()
      int read(Array<byte> b, int off, int len)
      long skip(long n)
      • Methods inherited from class java.io.InputStream

        available, close, mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
      • Methods inherited from class java.lang.Object

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

      • BoundedInputStream

        BoundedInputStream(InputStream in, long size)
        Creates the stream that will at most read the given amount ofbytes from the given stream.
        Parameters:
        in - the stream to read from
        size - the maximum amount of bytes to read