Changes to java.io after JDK 1.1 beta2

The class java.lang.Throwable now supports a printStackTrace method that takes a PrintWriter object rather than a PrintStream object.

Two convenience constructors, which take OutputStream objects rather than Writer objects, have been added to the PrintWriter class:

   PrintWriter(OutputStream out)
   PrintWriter(OutputStream out, boolean autoFlush)

These constructors are intended to ease the transition from the PrintStream class to the new PrintWriter class.

The ByteArrayInputStream class now supports the mark and reset methods.

The ByteToCharConverter and CharToByteConverter classes are no longer part of the public API. They have been moved to the sun.io package, along with the related classes ConversionBufferFullException, MalformedInputException, and UnknownCharacterException. An improved interface for access to low-level character conversion facilities is planned for a future release.

Since the converter classes are no longer public, a number of constructors and methods that previously took converter arguments now accept names of character encodings. They are:

byte[]   String.getBytes(String enc)
   String(byte[] buf, String enc)
   String(byte[] buf, int off, int len, String enc)
   OutputStreamWriter(OutputStream out, String enc)
   InputStreamReader(InputStream in, String enc)
String   ByteArrayOutputStream.toString(String enc)

The InputStreamReader and OutputStreamWriter classes no longer commit to buffering the underlying byte stream. Hence the constructors that allow the byte-buffer size to be specified have been removed. The getCharacterEncoding method of these classes has been renamed to getEncoding.

The StreamTokenizer(InputStream) constructor had been changed to use the default character encoding rather than assume ASCII. This turned out to break binary compatibility, so the original behavior has been restored and the constructor has been deprecated.


Comments to: java-io@java.sun.com Mark Reinhold / 4 February 1997