Package org.apache.commons.io.input
Class ChecksumInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- org.apache.commons.io.input.ProxyInputStream
-
- org.apache.commons.io.input.CountingInputStream
-
- org.apache.commons.io.input.ChecksumInputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public final class ChecksumInputStream extends CountingInputStream
Automatically verifies aChecksum
value once the stream is exhausted or the count threshold is reached.If the
Checksum
does not meet the expected value when exhausted, then the input stream throws anIOException
.If you do not need the verification or threshold feature, then use a plain
CheckedInputStream
.To build an instance, use
ChecksumInputStream.Builder
.- Since:
- 2.16.0
- See Also:
ChecksumInputStream.Builder
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ChecksumInputStream.Builder
Builds a newChecksumInputStream
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ChecksumInputStream.Builder
builder()
Constructs a newChecksumInputStream.Builder
.long
getRemaining()
Gets the byte count remaining to read.-
Methods inherited from class org.apache.commons.io.input.CountingInputStream
getByteCount, getCount, resetByteCount, resetCount, skip
-
Methods inherited from class org.apache.commons.io.input.ProxyInputStream
available, close, mark, markSupported, read, read, read, reset, unwrap
-
-
-
-
Method Detail
-
builder
public static ChecksumInputStream.Builder builder()
Constructs a newChecksumInputStream.Builder
.- Returns:
- a new
ChecksumInputStream.Builder
.
-
getRemaining
public long getRemaining()
Gets the byte count remaining to read.- Returns:
- bytes remaining to read, a negative number means the threshold is unbound.
-
-