23.07.2013 Views

Java IO.pdf - Nguyen Dang Binh

Java IO.pdf - Nguyen Dang Binh

Java IO.pdf - Nguyen Dang Binh

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Java</strong> I/O<br />

After each successful call to update(), you can clone the digest and invoke the digest()<br />

method on the clone. This lets you inspect the digest without interfering with the data that still<br />

needs to be processed. This might be useful if you have an exceptionally large amount of data<br />

read from a slow connection, and you don't want to wait for the end of the stream before<br />

checking whether or not the data is corrupt. Of course, you would need the intermediate<br />

digests for the original data, in addition to the digests for the data you're checking.<br />

10.2.9 toString( )<br />

For completeness' sake, I'll note that MessageDigest overrides toString():<br />

public String toString()<br />

This returns a string in the form "algorithm Message Digest from provider,<br />

" or "

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!