Corrections to Chapter 4 of Java Network Programming, Java I/O

p. 88: In the first sentence of the second paragraph, "servers as a buffer" should be "serves as a buffer".

p. 92: In the 5th paragraph, 2nd sentence; change "However, bytes pushed from the same array will be returned..." to ."However, bytes popped from the same array will be returned...". That is, change "pushed" to "popped".

p. 99: In the first complete sentence on this page, the comma is misplaced. It should read, "The sender can calculate the digest as it sends data, while the receiver calculates the digest as it receives data."

p. 99: In line 7, "Alternativly" should be "Alternatively".

p. 99: In the last line of code on the page the CipherOutputStream constructor signature is wrong. It should read:

public CipherOutputStream(OutputStream out, Cipher c);

p. 101: A couple of words got left out of the first sentence of the Readers and Writers section. This should read, "Most programmers have a bad habit of writing code as if all text were ASCII, or at the least in the native encoding of the platform."

p. 108: The SafeBufferedReader class has a nasty bug that loses track of the last line of a file that doesn't end in a carriage return or a line feed. To fix it, replace these lines:

      if (c == -1) { // end of stream
        return null;

with these lines:

      if (c == -1) { // end of stream
        if (sb.equals("")) return null;
        return sb.toString();

[ Java Network Programming Corrections | Java Network Programming Home Page | Table of Contents | Examples | Order from Amazon ] ]

Copyright 2000-2003 Elliotte Rusty Harold
Last Modified January 4, 2003