1.1 Changes: Package

The package has been extended with character streams, which are like byte streams except that they read and write 16-bit Unicode characters rather than eight-bit bytes. Character streams make it easy to write programs that are not dependent upon a specific character encoding, and are therefore easy to internationalize. Nearly all of the functionality available for byte streams is also available for character streams.

You should use character streams when you're working with, well, characters. If you're constructing Strings, or comparing to character literals, then you're working with characters. There are, of course, exceptions. Many network protocols, for example, are defined in terms of bytes containing 7-bit ASCII characters, so comparing bytes from a byte stream to character literals can make sense.

Byte streams are the primitive means by which Java does I/O, whether to files or on the network. They are still useful for many things: Storing and retrieving images and sounds, serializing and deserializing objects, writing binary data files for use by other programs, and implementing network protocols (there are many more).

In most cases, however, it is best to use character streams.

The new classes are:

The new interfaces are:

For information about the new character stream classes and interfaces see the Character Streams in JDK 1.1 paper.