|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
edu.harvard.hul.ois.jhove.ChecksumInputStream
public class ChecksumInputStream
A ChecksumInputStream is a FilterInputStream with the added functionality of calculating checksums as it goes. The idea of replacing this with java.util.zip.CheckedInputStream looks very tempting, but we need the byte count, which CheckedInputStream doesn't provide.
Field Summary |
---|
Fields inherited from class java.io.FilterInputStream |
---|
in |
Constructor Summary | |
---|---|
ChecksumInputStream(java.io.InputStream stream,
Checksummer cksummer)
Constructor. |
Method Summary | |
---|---|
void |
close()
Closes the subsumed stream. |
Checksummer |
getChecksummer()
Returns the Checksummer object. |
long |
getNBytes()
Returns the byte count to date on the stream. |
int |
read()
Reads a byte from the subsumed stream, updating the byte count and the checksums. |
int |
read(byte[] b)
Reads some number of bytes from the input stream and stores them into the buffer array b. |
int |
read(byte[] b,
int off,
int len)
Reads up to len bytes of data from the input stream into an array of bytes. |
long |
skip(long n)
Skips n bytes. |
Methods inherited from class java.io.FilterInputStream |
---|
available, mark, markSupported, reset |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ChecksumInputStream(java.io.InputStream stream, Checksummer cksummer)
stream
- Stream to be filteredcksummer
- Object to calculate checksum on the bytes
as they are readMethod Detail |
---|
public int read() throws java.io.IOException
read
in class java.io.FilterInputStream
java.io.IOException
public int read(byte[] b) throws java.io.IOException
read
in class java.io.FilterInputStream
java.io.IOException
public int read(byte[] b, int off, int len) throws java.io.IOException
read
in class java.io.FilterInputStream
java.io.IOException
public long skip(long n) throws java.io.IOException
skip
in class java.io.FilterInputStream
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.FilterInputStream
java.io.IOException
public long getNBytes()
public Checksummer getChecksummer()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |