diff options
author | Tom Tromey <tromey@cygnus.com> | 2000-06-27 21:27:50 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2000-06-27 21:27:50 +0000 |
commit | 56067b0077074c026b8ad099a74292a2becd6278 (patch) | |
tree | 10aa3be4449480e01d731e82ba030309e5c473ba /libjava/java/io/PushbackReader.java | |
parent | 35e1ebee089cff8d0537f32e80c5c01ca9b6580b (diff) | |
download | gcc-56067b0077074c026b8ad099a74292a2becd6278.zip gcc-56067b0077074c026b8ad099a74292a2becd6278.tar.gz gcc-56067b0077074c026b8ad099a74292a2becd6278.tar.bz2 |
PushbackInputStream.java (read): If there are characters in the buffer, don't also call super.read().
* java/io/PushbackInputStream.java (read): If there are characters
in the buffer, don't also call super.read().
* java/io/PushbackReader.java (read): If there are characters in
the buffer, don't also call super.read().
From-SVN: r34745
Diffstat (limited to 'libjava/java/io/PushbackReader.java')
-rw-r--r-- | libjava/java/io/PushbackReader.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libjava/java/io/PushbackReader.java b/libjava/java/io/PushbackReader.java index d5d8d44..1a7523d 100644 --- a/libjava/java/io/PushbackReader.java +++ b/libjava/java/io/PushbackReader.java @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 1999 Free Software Foundation +/* Copyright (C) 1998, 1999, 2000 Free Software Foundation This file is part of libgcj. @@ -79,10 +79,14 @@ public class PushbackReader extends FilterReader throw new ArrayIndexOutOfBoundsException(); int numBytes = Math.min(buf.length - pos, len); - for (int i = 0; i < numBytes; i++) - b[off++] = buf[pos++]; - - return numBytes + super.read(b, off, len - numBytes); + if (numBytes > 0) + { + System.arraycopy (buf, pos, b, off, numBytes); + pos += numBytes; + return numBytes; + } + + return super.read(b, off, len); } } |