Errata

Java I/O

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
Printed Page 15
bottom half

PI is not "3.1415929". Just a silly mistake i presume.

Anonymous   
Printed Page 26
2nd paragraph

[Java I/0, First printing 6/99]

The third sentence states that "For example, the FileOutputStream class
overrides all five methods with native methods..."

However, as I look at the Sun's Java class documentations for both Java 2
v1.2 and v1.3:

http://java.sun.com/j2se/1.3/docs/api/java/io/FileOutputStream.html
http://java.sun.com/j2se/1.3/docs/api/java/io/FileOutputStream.html

as well as the source code of the FileOutputStream class, I figured out
that it actually overrides only the four methods of the OutputStream class,
which is listed above the paragraph. The FileOutputStream class overrides
the following methods of the OutputStream class:

public abstract void write(int b) throws IOException
public void write(byte[] data) throws IOException
public void write(byte[] data, int offset, int length) throws IOException
public void close() throws IOException

The FileOutputStream class inherits the flush() method from the
OutputStream class instead of overriding it.

Anonymous   
Printed Page 39
last paragraph

The book states that the method skip of an InputStream returns -1 if the
end of the stream is encountered. This is the case for read, but it isn't
mentioned anywhere in the documentation of skip.


Anonymous   
Printed Page 43
Example 3-3

There is no instance of the class StreamCopier in the main method used to
test StreamCopier. In fact, there is nothing but an empty try block:

as it appears:

public static void main(String[] args) {
try {

}
catch (IOException e) {System.err.println(e);}
}

...

I changed main to the following:

public static void main(String[] args) {
StreamCopier sc = new StreamCopier();

try {
sc.copy(System.in, System.out);
}
catch (IOException e) {System.err.println(e);}

}

Note that this is a brand new (01/2001) copy of the book from Amazon.com
but it is labeled as March 1999 First Edition (ISBN: 1-56592-485-1) So I
expected that the correction would already be hear in the Errata but, it is
not.

Anonymous   
Printed Page 68
1st paragraph

The SocketTyper example uses the URL http://www.oreilly.com/. I think it
would be helpful to readers to point out the the trailing "/" is required
for this and similar URLs. Without it (and I think most people are used to
omitting it in web browsers) the example returns a "Bad Request" HTTP
response. The getFile() method of the URL class returns an empty string,
and a bad header is sent, e.g. "GET HTTP/1.0" instead of "GET / HTTP/1.0".

Anonymous   
Printed Page 121
1st paragraph

First of all the Javadoc specification on DataInputStream.skipBytes() is
very unclear (as stated in several bug reports). And from the bug 4321952
it is clear that the method does NOT skip over all the bytes, it does, just
like InputStream, return the number of bytes skipped over. I suggest
reading the bug report.

Anonymous   
Printed Page 128
2nd paragraph

"The mask 0xFF has one bit in the low-order eight bits and zero bits
everywhere else." I took this to mean that one of the bits in the
low-order bits is one instead of all of the eight low-order bits are
set to one. Just a nit-pick.

Anonymous   
Printed Page 210
5th paragraph

As you with most URLConnection subclasses, you don't instantiate
JarURLConnection directly.

As you can with most? As you can see with most? As you can read with most?
As you can write with most?

Anonymous   
Printed Page 363, 375
code examples

I don't know for sure, but I think that there's no "font.encoding" property in the
System.getProperty() method. This appears twice in the book. The first appearance is
in Example 15.1. UnicodeTable in (15.2 The OutputStreamWriter Class) and the second
appearance is in Example 15.4. BufferedUnicodeTable in (15.8 Buffered Readers and
Writers)

Anonymous   
Printed Page 440
Example 15-7 SourceReader

I got already the corrected SourceReader example, but I think the corrected example
still not take care all possible unicode escaped characters.

According to the "The Java Language Specification" second edition, page 14 :
UnicodeMarker ::= u | <UnicodeMarker> u

Which means, unicode like uuuu1234 is valid unicode character; and compiler does not
have problem to compile it.

The corrected SourceReader can only read one and only one "u" between "" and first
digit.
According to the java grammar, we can put any number (but at least one) of "u"
between "" and first digit.

Anonymous