Exercises

  1. Measure the difference between buffered and non-buffered I/O operating with 10K 1-byte writes and one 10KB write, repeated 10,000 times in a loop. Draw a graph to illustrate your results. How do the results change with a buffer size of 128KB, 256KB, 512KB?

  2. Modify the program that does a hex dump of a file so that it also outputs any printable bytes in a set of columns to the right of the hex dump on each line. Print the character if it has a printable form, and print a “.” if it does not. This ensures that lines are the same length and columns line up.

  3. Write a Java program whose output at run-time is an exact duplicate of the program's source code. Now that we have printf, the shortest Java program to do this is well under a page of code.

  4. Write a program that prints a table of printable ISO 8859-1 characters and their bit patterns.

  5. Rewrite the hex dumper utility to use one or more Filter classes. The first filter can turn binary bytes into the equivalent printable hex characters. The second filter can insert the addresses and newlines at appropriate points.

  6. Rewrite the deCSS utility (see ome Light Relief—The Illegal Prime Number!) in Java. For extra credit, look up the algorithms on the web to actually carry out the decryption of an encoded DVD stream, and write Java code to do that. Does it run quickly enough to decode and play in real time? Explain why or why not.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.80.34