Class CheckedInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
java.util.zip.CheckedInputStream
- All Implemented Interfaces:
- Closeable,- AutoCloseable
An input stream that also maintains a checksum of the data being read.
 The checksum can then be used to verify the integrity of the input data.
- Since:
- 1.1
- See Also:
- 
Field SummaryFields declared in class java.io.FilterInputStreamin
- 
Constructor SummaryConstructorsConstructorDescriptionCheckedInputStream(InputStream in, Checksum cksum) Creates an input stream using the specified Checksum.
- 
Method SummaryMethods declared in class java.io.FilterInputStreamavailable, close, mark, markSupported, read, resetMethods declared in class java.io.InputStreamnullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
- 
Constructor Details- 
CheckedInputStreamCreates an input stream using the specified Checksum.- Parameters:
- in- the input stream
- cksum- the Checksum
 
 
- 
- 
Method Details- 
readReads a byte. Will block if no input is available.- Overrides:
- readin class- FilterInputStream
- Returns:
- the byte read, or -1 if the end of the stream is reached.
- Throws:
- IOException- if an I/O error has occurred
- See Also:
 
- 
readReads into an array of bytes. Iflenis not zero, the method blocks until some input is available; otherwise, no bytes are read and0is returned.- Overrides:
- readin class- FilterInputStream
- Parameters:
- buf- the buffer into which the data is read
- off- the start offset in the destination array- b
- len- the maximum number of bytes read
- Returns:
- the actual number of bytes read, or -1 if the end of the stream is reached.
- Throws:
- NullPointerException- If- bufis- null.
- IndexOutOfBoundsException- If- offis negative,- lenis negative, or- lenis greater than- buf.length - off
- IOException- if an I/O error has occurred
- See Also:
 
- 
skipSkips specified number of bytes of input.- Overrides:
- skipin class- FilterInputStream
- Parameters:
- n- the number of bytes to skip
- Returns:
- the actual number of bytes skipped
- Throws:
- IOException- if an I/O error has occurred
- See Also:
 
- 
getChecksumReturns the Checksum for this input stream.- Returns:
- the Checksum value
 
 
-