diff options
author | Tom Tromey <tromey@redhat.com> | 2001-02-20 19:01:55 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2001-02-20 19:01:55 +0000 |
commit | 39f90b7ce07ffa09df609ec724a22fe18606a668 (patch) | |
tree | bea0be04a6a6d1d16e61e97edbf76650ad68223a /libjava/java/io/OutputStreamWriter.java | |
parent | c9407e4c671efb42c76dbb80a13ecf0c5dc09f05 (diff) | |
download | gcc-39f90b7ce07ffa09df609ec724a22fe18606a668.zip gcc-39f90b7ce07ffa09df609ec724a22fe18606a668.tar.gz gcc-39f90b7ce07ffa09df609ec724a22fe18606a668.tar.bz2 |
PipedWriter.java (flush): Throw exception if stream closed.
* java/io/PipedWriter.java (flush): Throw exception if stream
closed.
* java/io/OutputStreamWriter.java (write): Throw exception if
stream closed.
(writeChars): Don't throw exception if stream closed.
* java/io/CharArrayWriter.java (closed): New field.
(close): Set it.
(flush): Throw exception if stream closed.
(reset): Synchronize on correct lock. Allow stream to be
reopened.
(toCharArray, toString, writeTo): Synchronize.
(write): Throwe exception if stream closed.
* java/io/BufferedWriter.java (close): Clear `buffer'.
(flush): Throw IOException if stream is closed.
(write): Likewise.
From-SVN: r39927
Diffstat (limited to 'libjava/java/io/OutputStreamWriter.java')
-rw-r--r-- | libjava/java/io/OutputStreamWriter.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/libjava/java/io/OutputStreamWriter.java b/libjava/java/io/OutputStreamWriter.java index 4127598..527ff75 100644 --- a/libjava/java/io/OutputStreamWriter.java +++ b/libjava/java/io/OutputStreamWriter.java @@ -86,6 +86,9 @@ public class OutputStreamWriter extends Writer { synchronized (lock) { + if (out == null) + throw new IOException("Stream closed"); + if (wcount > 0) { writeChars(work, 0, wcount); @@ -100,9 +103,6 @@ public class OutputStreamWriter extends Writer private void writeChars(char[] buf, int offset, int count) throws IOException { - if (out == null) - throw new IOException("Stream closed"); - while (count > 0) { // We must flush if out.count == out.buf.length. @@ -127,6 +127,9 @@ public class OutputStreamWriter extends Writer { synchronized (lock) { + if (out == null) + throw new IOException("Stream closed"); + if (work == null) work = new char[100]; int wlength = work.length; @@ -155,6 +158,9 @@ public class OutputStreamWriter extends Writer { synchronized (lock) { + if (out == null) + throw new IOException("Stream closed"); + if (work == null) work = new char[100]; if (wcount >= work.length) |