OutputString
should be OutputStream
. The correct figure should look something like this:
p. 157: Step 7 should read "go back to step 5", not "go back to step 4"
p. 165: Write before the Inflating Data section, the line
System.out.println((1.0 - def.getTotalOut()/def.getTotalIn())*100.0 + '% saved')
should be
System.out.println((1.0 - def.getTotalOut()/def.getTotalIn())*100.0 + "% saved")
That is, the single quotes around % saved
should be double quotes.
p. 165: In Step 6 "go back to step 4" should be "go back to step 2"
p. 167: At the end of the fourth paragraph change "insert more uncompressed input data" to "insert more compressed input data". In the fifth paragraph change "feed in more uncompressed input data" to "feed in more compressed input data"
p. 183: Example 9-9, FancyZipLister
, doesn't calculate the savings correctly.
due to integer (as opposed to floating point)
division. The corrected lines look like this:
else if (method == ZipEntry.DEFLATED) {
System.out.println(name + " was deflated at " + lastModified);
System.out.println("from " + uncompressedSize + " bytes to "
+ compressedSize + " bytes, a savings of "
+ (100.0 - 100.0*compressedSize/uncompressedSize)
+ "%");
}
else {
System.out.println(name
+ " was compressed using an unrecognized method at "
+ lastModified);
System.out.println("from " + uncompressedSize + " bytes to "
+ compressedSize + " bytes, a savings of "
+ (100.0 - 100.0*compressedSize/uncompressedSize)
+ "%");
}
p. 186: At the start of the first non-list paragraph, "Steps 4 and 6"
should be "Steps 4 and 8".
p. 194: change "the byte 3 (binary 00000011)" to "the byte 7 (binary 00000111)". Although 3 is an odd number, it actually does have an even number of one bits.
p. 201: In the last paragraph, "as well the programs" should be "as well as the programs".
p. 206: Example 9-14, JarLister
has the same bug as problem as FancyZipLister
. The fix is the same too. The corrected lines look like this:
else if (method == ZipEntry.DEFLATED) {
System.out.println(name + " was deflated at " + lastModified);
System.out.println("from " + uncompressedSize + " bytes to "
+ compressedSize + " bytes, a savings of "
+ (100.0 - 100.0*compressedSize/uncompressedSize)
+ "%");
}
else {
System.out.println(name
+ " was compressed using an unrecognized method at "
+ lastModified);
System.out.println("from " + uncompressedSize + " bytes to "
+ compressedSize + " bytes, a savings of "
+ (100.0 - 100.0*compressedSize/uncompressedSize)
+ "%");
}
p. 208: getEntries()
returns a HashMap
in Java2 so "beta4"
isn't needed in the second paragraph.
p. 210: In the 5th paragraph, "using a the string form" should be "using the string form"
p. 213: In Example 9-15:
"Usage: java FileDumper2 [-ahdsilfx] [-little] [-gzip|-deflated] file1...");
should be
"Usage: java FileDumper4 [-ahdsilfx] [-little] [-gzip|-deflated] file1...");