Class SizeLimitedInputStream

java.lang.Object
java.io.InputStream
java.io.FilterInputStream
net.shibboleth.shared.io.SizeLimitedInputStream
All Implemented Interfaces:
Closeable, AutoCloseable

public class SizeLimitedInputStream extends FilterInputStream
An specialization of FilterInputStream which restricts the size of the stream to a specified number of bytes.
  • Field Details

    • maxSize

      private final long maxSize
      The max size allowed.
    • totalRead

      private long totalRead
      Tracker of number of bytes read.
  • Constructor Details

    • SizeLimitedInputStream

      public SizeLimitedInputStream(@Nonnull InputStream in, long maxAllowedSize)
      Constructor.
      Parameters:
      in - the wrapped input stream
      maxAllowedSize - the max allowed size in bytes
  • Method Details