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:
- Closeable,- AutoCloseable
Automatically verifies a 
Checksum 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 an
 IOException.
 
 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:
- 
Nested Class SummaryNested ClassesNested classes/interfaces inherited from class org.apache.commons.io.input.ProxyInputStreamProxyInputStream.AbstractBuilder<T,B extends AbstractStreamBuilder<T, B>> 
- 
Field SummaryFields inherited from class java.io.FilterInputStreamin
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidafterRead(int n) Adds the number of read bytes to the count.static ChecksumInputStream.Builderbuilder()Constructs a newChecksumInputStream.Builder.longGets the byte count remaining to read.Methods inherited from class org.apache.commons.io.input.CountingInputStreamgetByteCount, getCount, resetByteCount, resetCount, skipMethods inherited from class org.apache.commons.io.input.ProxyInputStreamavailable, beforeRead, close, handleIOException, mark, markSupported, read, read, read, reset, setReference, unwrap
- 
Method Details- 
builderConstructs a newChecksumInputStream.Builder.- Returns:
- a new ChecksumInputStream.Builder.
 
- 
afterReadDescription copied from class:CountingInputStreamAdds the number of read bytes to the count.- Overrides:
- afterReadin class- CountingInputStream
- Parameters:
- n- number of bytes read, or -1 if no more bytes are available
- Throws:
- IOException- Not thrown here but subclasses may throw.
 
- 
getRemainingGets the byte count remaining to read.- Returns:
- bytes remaining to read, a negative number means the threshold is unbound.
 
 
-