Recent articles:
Popular archives:
Java: A platform for platforms
Sun's reorg may seem promising to shareholders but it's also a scramble for position. The question now is whether Sun can,
or wants to, maintain its hold on Java technology. Especially with enterprise leaders like SpringSource and RedHat investing
heavily in Java's future as a platform for platforms
Also see:
Discuss: Tim Bray on 'What Sun Should Do'
The two types of streams are organized into two separate class hierarchies, one consisting entirely of the byte-oriented stream
classes, and the other consisting entirely of character-oriented stream classes. The classes within the two hierarchies are
named consistently, except for their suffix. The byte-oriented stream classes end in either InputStream or OutputStream, while the character-oriented stream classes end in either Reader or Writer. The two hierarchies are functionally almost identical, and they contain most of the same subclass specializations (for example,
one contains LineNumberInputStream and the other contains LineNumberReader).
Prior to version 1.1, the Java class library provided only byte-oriented streams. This setup reflected the reality imposed by the operating systems on which Java was developed -- they were hopelessly byte-oriented, and Java was initially tailored with that environment in mind. The byte-oriented stream classes, however, were flawed in one area -- support for Java's highly regarded Unicode character encoding. As you will soon learn, these classes provided little or no support for converting between bytes and characters.
Unicode is an international multi-language character encoding standard. Most operating systems we are familiar with use ASCII (American Standard Code for Information Interchange) encoding. ASCII (with a 7-bit, 128-character set) doesn't do a very good job supporting characters from languages similar to ours (Danish, for example), much less the character sets for languages such as Japanese or Thai. By basing its character encoding on Unicode (with a 16-bit, 65,536-character set) instead of ASCII, Java supposedly solved that problem -- or did it?
PrintStream, a byte-oriented subclass of OutputStream, and the class from which the objects System.out and System.err are constructed.The PrintStream class provides a bevy of methods for printing Java primitive data types and objects to an output stream. These are the two
most obvious:
public void println(char [] rgc); public void println(String str);
Here are their implementations:
Reader class for Java 1.1 http://www.javasoft.com/products/jdk/1.1/docs/api/java.io.Reader.html
Writer class for Java 1.1 http://www.javasoft.com/products/jdk/1.1/docs/api/java.io.Writer.html