diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-06-27 20:38:10 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-06-27 20:38:10 +0000 |
commit | 0f25784615b45a02ab6e41b6d1354662f3799710 (patch) | |
tree | 4559b8284607c63eae3517638fbdf14bec92fafd /libjava/java/io/PrintStream.java | |
parent | ad8ae01eb762963f07a25de7eb2f8240c7f4032d (diff) | |
download | ppe42-gcc-0f25784615b45a02ab6e41b6d1354662f3799710.tar.gz ppe42-gcc-0f25784615b45a02ab6e41b6d1354662f3799710.zip |
* java/io/OutputStreamWriter.java (writeChars): Use a 'do' loop.
Set 'out.count' earlier.
(close): Call setFinished on converter.
(flush): Always write work buffer.
* java/io/PrintStream.java (writeChars): Do 'do' loop.
(close): Call setFinished on converter. Write a 'flush' array.
* java/lang/natString.cc (getBytes): Call setFinished on
converter.
* gnu/gcj/convert/CharsetToBytesAdaptor.java (hasBytes): New
field.
(write): Set hasBytes. Changed 'finished' logic.
(havePendingBytes): Rewrote.
(setFinished): New method.
* gnu/gcj/convert/UnicodeToBytes.java (setFinished): New method.
* testsuite/libjava.lang/RH194522.java: New file.
* testsuite/libjava.lang/RH194522.out: New file.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@115039 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/io/PrintStream.java')
-rw-r--r-- | libjava/java/io/PrintStream.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/libjava/java/io/PrintStream.java b/libjava/java/io/PrintStream.java index 4756c8c083c..dc26edafd9f 100644 --- a/libjava/java/io/PrintStream.java +++ b/libjava/java/io/PrintStream.java @@ -1,5 +1,5 @@ /* PrintStream.java -- OutputStream for printing output - Copyright (C) 1998, 1999, 2001, 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -174,6 +174,8 @@ public class PrintStream extends FilterOutputStream { try { + converter.setFinished(); + writeChars(new char[0], 0, 0); flush(); out.close(); } @@ -251,7 +253,7 @@ public class PrintStream extends FilterOutputStream private void writeChars(char[] buf, int offset, int count) throws IOException { - while (count > 0 || converter.havePendingBytes()) + do { converter.setOutput(work_bytes, 0); int converted = converter.write(buf, offset, count); @@ -259,12 +261,13 @@ public class PrintStream extends FilterOutputStream count -= converted; out.write(work_bytes, 0, converter.count); } + while (count > 0 || converter.havePendingBytes()); } private void writeChars(String str, int offset, int count) throws IOException { - while (count > 0 || converter.havePendingBytes()) + do { converter.setOutput(work_bytes, 0); int converted = converter.write(str, offset, count, work); @@ -272,6 +275,7 @@ public class PrintStream extends FilterOutputStream count -= converted; out.write(work_bytes, 0, converter.count); } + while (count > 0 || converter.havePendingBytes()); } /** |