Package net.shibboleth.shared.io
Class SizeLimitedInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
net.shibboleth.shared.io.SizeLimitedInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
An specialization of
FilterInputStream which restricts
the size of the stream to a specified number of bytes.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final longThe max size allowed.private longTracker of number of bytes read.Fields inherited from class java.io.FilterInputStream
in -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, read, reset, skipMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Field Details
-
maxSize
private final long maxSizeThe max size allowed. -
totalRead
private long totalReadTracker of number of bytes read.
-
-
Constructor Details
-
SizeLimitedInputStream
Constructor.- Parameters:
in- the wrapped input streammaxAllowedSize- the max allowed size in bytes
-
-
Method Details
-
read
- Overrides:
readin classFilterInputStream- Throws:
IOException
-
read
- Overrides:
readin classFilterInputStream- Throws:
IOException
-