aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/io
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/java/io')
-rw-r--r--libjava/java/io/BufferedOutputStream.java5
-rw-r--r--libjava/java/io/BufferedReader.java4
2 files changed, 6 insertions, 3 deletions
diff --git a/libjava/java/io/BufferedOutputStream.java b/libjava/java/io/BufferedOutputStream.java
index d37ed5d..3e26592 100644
--- a/libjava/java/io/BufferedOutputStream.java
+++ b/libjava/java/io/BufferedOutputStream.java
@@ -42,6 +42,7 @@ public class BufferedOutputStream extends FilterOutputStream
public synchronized void write (int b) throws IOException
{
+ // Flush output on overflow though JDK (1.2) doc may infer to flush on fill.
if (count < buf.length)
buf[count++] = (byte) b;
else
@@ -55,8 +56,10 @@ public class BufferedOutputStream extends FilterOutputStream
public synchronized void write (byte[] b, int off, int len)
throws IOException, NullPointerException, IndexOutOfBoundsException
{
+ // Flush output on overflow though JDK (1.2) doc may infer to flush on fill.
+
// If LEN < 0 then the downstream write will fail for us.
- if (len >= 0 && count + len < buf.length)
+ if (len >= 0 && count + len <= buf.length)
{
System.arraycopy(b, off, buf, count, len);
count += len;
diff --git a/libjava/java/io/BufferedReader.java b/libjava/java/io/BufferedReader.java
index 19e371a..9e9e764 100644
--- a/libjava/java/io/BufferedReader.java
+++ b/libjava/java/io/BufferedReader.java
@@ -197,7 +197,7 @@ public class BufferedReader extends Reader
}
}
- /* Read more data into the buffer. Update pos and limit appropriatly.
+ /* Read more data into the buffer. Update pos and limit appropriately.
Assumes pos==limit initially. May invalidate the mark if read too much.
Return number of chars read (never 0), or -1 on eof. */
private int fill() throws IOException
@@ -214,7 +214,7 @@ public class BufferedReader extends Reader
if (markPos >= 0 && limit == buffer.length)
markPos = -1;
- if (markPos <= 0)
+ if (markPos < 0)
pos = limit = 0;
int count = in.read(buffer, limit, buffer.length - limit);
if (count > 0)