OutputStreamWriter.java (writeChars): Use a 'do' loop.

* 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.

From-SVN: r115039
This commit is contained in:
Tom Tromey 2006-06-27 20:38:10 +00:00 committed by Tom Tromey
parent 80cd0e33d9
commit 9e01bff779
8 changed files with 85 additions and 23 deletions

View file

@ -615,6 +615,8 @@ java::lang::String::getBytes (jstring enc)
while (todo > 0 || converter->havePendingBytes())
{
converter->setOutput(buffer, bufpos);
// We only really need to do a single write.
converter->setFinished();
int converted = converter->write(this, offset, todo, NULL);
bufpos = converter->count;
if (converted == 0 && bufpos == converter->count)