diff options
author | daney <daney@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-03-15 16:46:51 +0000 |
---|---|---|
committer | daney <daney@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-03-15 16:46:51 +0000 |
commit | 9b3bbe093b1ed8105de77bfe4d07079c7a7412aa (patch) | |
tree | 91fdc7ab4a90e289342eb60ae6b642f5dfe516af /libjava/java | |
parent | 51bc0b4e997fc60bd2cadf608ba9cb33d7086bd2 (diff) | |
download | gcc-9b3bbe093b1ed8105de77bfe4d07079c7a7412aa.tar.gz |
2005-03-15 David Daney <ddaney@avtrex.com>
* gnu/java/net/natPlainSocketImplPosix.cc (read_helper): Handle
count == 0 case.
2005-03-15 David Daney <ddaney@avtrex.com>
* java/io/BufferedInputStream.java (available): Use 'in' instead
of 'super' for underlying stream access.
(close): Ditto.
(read(byte[], int, int)): Ditto.
(refill): Ditto.
(skip): Call skip on underlying stream when possible.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@96516 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java')
-rw-r--r-- | libjava/java/io/BufferedInputStream.java | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/libjava/java/io/BufferedInputStream.java b/libjava/java/io/BufferedInputStream.java index bbb38c43719..ce166b337f4 100644 --- a/libjava/java/io/BufferedInputStream.java +++ b/libjava/java/io/BufferedInputStream.java @@ -158,7 +158,7 @@ public class BufferedInputStream extends FilterInputStream */ public synchronized int available() throws IOException { - return count - pos + super.available(); + return count - pos + in.available(); } /** @@ -173,7 +173,7 @@ public class BufferedInputStream extends FilterInputStream buf = null; pos = count = 0; markpos = -1; - super.close(); + in.close(); } /** @@ -273,7 +273,7 @@ public class BufferedInputStream extends FilterInputStream off += totalBytesRead; len -= totalBytesRead; - while (len > 0 && super.available() > 0 && refill()) + while (len > 0 && in.available() > 0 && refill()) { int remain = Math.min(count - pos, len); System.arraycopy(buf, pos, b, off, remain); @@ -327,8 +327,18 @@ public class BufferedInputStream extends FilterInputStream while (n > 0L) { - if (pos >= count && !refill()) - break; + if (pos >= count) + { + if (markpos == -1) + { + // Buffer is empty and no mark is set, skip on the + // underlying stream. + n -= in.skip(n); + break; + } + else if (!refill()) + break; + } int numread = (int) Math.min((long) (count - pos), n); pos += numread; @@ -369,7 +379,7 @@ public class BufferedInputStream extends FilterInputStream markpos = 0; } - int numread = super.read(buf, count, bufferSize); + int numread = in.read(buf, count, bufferSize); if (numread <= 0) // EOF return false; |