Corrections to Chapter 12 of Java I/O, Working with Files

p. 306: The first three sentences of the first paragraph after the note should be a little more precise about the requirements of a Macintosh file name. Change them to read as follows:

Read me before you run this program or your hard drive will get trashed is not a valid Macintosh file name because Mac file and directory names cannot be longer than 31 bytes. Volume names cannot be longer than 27 bytes. However, there's no fixed length to a full path name. The exact number of characters allowed in a name depends on the number of bytes per character used by the local encoding. Read me or your HD will be trashed only contains 27 bytes in most encodings and is thus a valid Macintosh file, directory, and volume name.

p. 312: Macintosh file creators and types are stored in the volume catalog, not the resource fork of the file.

p. 313: Macintosh file names are limited to 31 bytes in length, not 32 characters in length. (I think I was remembering that Mac file names are stored as a Pascal Str32 type, but I was forgetting that one of those 32 bytes is used for the Pascal length byte.) Directory names can also be 31 bytes long (not 27 characters as erroneously stated in the text). However volume (drive) names are limited to 27 bytes.

p. 318: In the mini-table in the middle of the page, on the line for the MacOS change "html:index.html" to ":html:index.html"

p. 319: The examples on p. 319 confuse a file name with a class name, but the overall point is still valid. However rather than trying to run a particular file (as I would do if this were a compiled program) I should be setting the classpath like this:

% java -classpath /home/users/bfrank Trivia

The second command line with the relative path should be

% java -classpath ../bfrank Trivia

The third example on the page is correct.

p. 327: In the second to last paragraph, delete the space in "%202.0% 20Early%20Access"; that is, change it to "%202.0%20Early%20Access"

p. 338: In the middle of the page, change the sentence "If the directory cannot be created for any other reason, mkdir() returns false." to "If the directory cannot be created for any other reason, including that the directory already existed before mkdir() was called, mkdir() returns false." That is, add the phrase, "including that the directory already existed before mkdir() was called".

p. 338: mkdirs() returns true only if it actually creates a directory. It returns false if all the directories already exist. Thus the second to last paragraph on the page should read

mkdirs() returns true if some directory in this path did not already exist and was created, and false if none of them are created. If mkdirs() returns false, you should first test to see if the path exists (because it may have existed before you ever called mkdirs()). If it doesn't exist, then you have to explicitly test for each directory in the path because the invocation could have been partially successful.

p. 343: In the second paragraph, change to "using the HTMLFilter of Example 12-5" to "using the HTMLFilter of Example 12-6".

RandomAccessFile raf = new RandomAccessFile("29.html", "w");

[ Java I/O Corrections | Java I/O Home Page | Table of Contents | Examples | Order from Amazon ] ]

Copyright 1999, 2000 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified April 23, 2000