diff options
| author | bothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-04-16 18:35:02 +0000 |
|---|---|---|
| committer | bothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-04-16 18:35:02 +0000 |
| commit | 7a99bc49d7951d74a4dbee4793a0884bac116a1d (patch) | |
| tree | d5fe22f8b6e8bfbf99f7efa65bace32141b44d8a /libjava/java/io/OutputStreamWriter.java | |
| parent | eab819ff4c13c432f46313dd15872aa6cfd95638 (diff) | |
| download | gcc-7a99bc49d7951d74a4dbee4793a0884bac116a1d.tar.gz | |
�
* java/io/InputStreamReader.java (<init>): Set super.in correctly.
* java/io/OutputStreamWriter.java (<init>): Set super.in correctly.
(writeChars): Don't be quite so eager to flush.
* java/io/PrintStream.java: Rewrite. Now more similar to
OutputStreamWriter, using explicit UnicodeToBytes converter.
Also, autoflush does not need to flush so often.
* java/lang/natString.cc (getBytes): More efficient algorithm.
(init(jbyteArray,jint,jint,jstring)): More efficient.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@26509 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/io/OutputStreamWriter.java')
| -rw-r--r-- | libjava/java/io/OutputStreamWriter.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/libjava/java/io/OutputStreamWriter.java b/libjava/java/io/OutputStreamWriter.java index e529474875c..88841d9c1b4 100644 --- a/libjava/java/io/OutputStreamWriter.java +++ b/libjava/java/io/OutputStreamWriter.java @@ -32,9 +32,9 @@ public class OutputStreamWriter extends Writer private OutputStreamWriter(OutputStream out, UnicodeToBytes encoder) { - super(out); - this.out = out instanceof BufferedOutputStream ? (BufferedOutputStream) out - : new BufferedOutputStream(out, 2048); + super((this.out = (out instanceof BufferedOutputStream + ? (BufferedOutputStream) out + : new BufferedOutputStream(out, 250)))); this.converter = encoder; } @@ -90,12 +90,17 @@ public class OutputStreamWriter extends Writer } } + /** Writes characters through to the inferior BufferedOutputStream. + * Ignores wcount and the work buffer. */ private void writeChars(char[] buf, int offset, int count) throws IOException { while (count > 0) { - if (out.count != 0) + // We must flush if out.count == out.buf.length. + // It is probably a good idea to flush if out.buf is almost full. + // This test is an approximation for "almost full". + if (out.count + count >= out.buf.length) { out.flush(); if (out.count != 0) |
