aspose file tools
The moose likes Java in General and the fly likes CheckedInputStream - java.util.zip Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "CheckedInputStream - java.util.zip" Watch "CheckedInputStream - java.util.zip" New topic
Author

CheckedInputStream - java.util.zip

Nijeesh Balan
Ranch Hand

Joined: Oct 09, 2000
Posts: 116
Hi All,
As per jdk 1.4 documentation, Class CheckedInputStream is supposed to return
"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."

I was expecting it to print the CheckSum value of the input file, rather it prints the value "0" always(irrespective of the i/p argument).
When i went thru the src code for CheckedInputStream, I noticed that the constructor does nothing other than assigning the passed in checksum value to it's instance variable.
Is this is an expected result? or am I missing something?
Please clarify.


Thanks & Regards,<br />Nijeesh.
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18652
CheckedInputStream extends FilterInputStream; the idea is that you read another stream through the CheckedInputStream, and then afterwards get the checksum for all the bytes that have been read. In this case, you haven't read any bytes yet; the checksum is zero.


"I'm not back." - Bill Harding, Twister
 
IntelliJ Java IDE
 
subject: CheckedInputStream - java.util.zip
 
Threads others viewed
ZipInputStream problem
Comparing war files
CRC32 check for zip
try / catch / finally
Read files and replace Strings
IntelliJ Java IDE