|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.io.InputStream
|
+--java.io.FilterInputStream
|
+--java.util.zip.CheckedInputStream
|
+--sam.io.ChecksumCheckerInputStream
Class for automatically matching the Checksum of an InputStream
against a predefined value.
This allows for transparent checksum-checking like in:
CheckedOutputStream output = new CheckOutputStream( new FileOutputStream("foo") ); ... Checksum expectedChecksum = output.getChecksum(); InputStream input = new ChecksumCheckerInputStream( new FileInputStream("bar"), expectedChecksum); ...
| Nested Class Summary | |
class |
ChecksumCheckerInputStream.MismatchingChecksumException
Deprecated. Exception thrown whenver checksums do not match |
| Field Summary |
| Fields inherited from class java.io.FilterInputStream |
in |
| Constructor Summary | |
ChecksumCheckerInputStream(java.io.InputStream delegee,
java.util.zip.CRC32 requiredChecksum)
Deprecated. Builds a new CheksumCheckerInputStream |
|
| Method Summary | |
void |
check()
Deprecated. Checks the computed checksum. |
void |
close()
Deprecated. Closes the underlying stream and checks the checksums. |
protected void |
finalize()
Deprecated. Makes sure the checksums are checked on exit. |
| Methods inherited from class java.util.zip.CheckedInputStream |
getChecksum, read, read, skip |
| Methods inherited from class java.io.FilterInputStream |
available, mark, markSupported, read, reset |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public ChecksumCheckerInputStream(java.io.InputStream delegee,
java.util.zip.CRC32 requiredChecksum)
CheksumCheckerInputStream
delegee - the underlying input streamrequiredChecksum - the required checksum to compare to
Note that the current implementation is limitated to CRC32 checksums.
| Method Detail |
public void check()
throws ChecksumCheckerInputStream.MismatchingChecksumException
ChecksumCheckerInputStream.MismatchingChecksumException - if the current checksum does not match the required one.
ChecksumCheckerInputStream.MismatchingChecksumException
public void close()
throws java.io.IOException
close in class java.io.FilterInputStreamjava.io.IOExceptioncheck()
protected void finalize()
throws java.io.IOException
Please understand that throwing a MismatchingChecksumException inside the
Garbage Collector's thread might not be so desirable ...
finalize in class java.lang.Objectjava.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||