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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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

Note how little we had to change. I simply imported two more packages and added a<br />

command-line switch and about a dozen lines of code (which could easily have been half that)<br />

to build a Cipher object and add a cipher input stream to the chain. Other encryption<br />

schemes, like password-based encryption, would not be hard to support either. The main<br />

difficulty lies in deciding exactly how the key would be entered, since not all schemes have<br />

keys that map to passwords in a straightforward way. That's left as an exercise for the reader.<br />

235

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

Saved successfully!

Ooh no, something went wrong!