Class BoundedInputStream

java.lang.Object
java.io.InputStream
org.apache.commons.compress.utils.BoundedInputStream
All Implemented Interfaces:
Closeable, AutoCloseable

public class BoundedInputStream extends InputStream
A stream that limits reading from a wrapped stream to a given number of bytes.
Since:
1.6
  • Field Details

    • in

      private final InputStream in
    • bytesRemaining

      private long bytesRemaining
  • Constructor Details

    • BoundedInputStream

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