Documentation Contents

# Minor changes to `java.io` in Java SE 1.2

The following changes to package `java.io` were introduced in Java SE 1.2. Minor changes to this package were:

- The `out` field of the `PrintWriter` class is now protected rather than private, so that subclasses may access it
- The `RandomAccessFile` class supports a new `setLength` method; and
- The `StringWriter(int)` constructor is now public.

The following constructors check for `null` input parameters:

- The constructors `PrintStream(OutputStream out)` and `PrintStream(OutputStream out, boolean autoFlush)` will throw a `NullPointerException` if the parameter `out` is `null`.
- The constructors `InputStreamReader(InputStream in)` and `InputStreamReader(InputStream in, String enc)` will throw a `NullPointerException` if the `in` parameter is `null`.
- The constructors `OutputStreamWriter(OutputStream out)` and `OutputStreamWriter(OutputStream out, String enc)` will throw a `NullPointerException` if the `out` parameter is `null`.
- The protected constructors `Reader(Object lock)` and `Writer(Object lock)` now throw `NullPointerException` if the `lock` parameter is `null`.

Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved.
Contact Us