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
This commit is contained in:
Tom Tromey 2000-06-27 21:27:50 +00:00 committed by Tom Tromey
parent 35e1ebee08
commit 56067b0077
3 changed files with 21 additions and 10 deletions

View File

@ -1,5 +1,10 @@
2000-06-27 Tom Tromey <tromey@cygnus.com>
* 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().
* java/lang/Double.java (valueOf): Call parseDouble().
2000-06-26 Warren Levy <warrenl@cygnus.com>

View File

@ -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.
@ -70,12 +70,14 @@ public class PushbackInputStream extends FilterInputStream
throw new ArrayIndexOutOfBoundsException();
int numBytes = Math.min(buf.length - pos, len);
for (int i = 0; i < numBytes; i++)
b[off++] = buf[pos++];
if (numBytes > 0)
{
System.arraycopy (buf, pos, b, off, numBytes);
pos += numBytes;
return numBytes;
}
// `off' was just incremented to include `numBytes', so we can
// just pass ithere.
return numBytes + super.read(b, off, len - numBytes);
return super.read(b, off, len);
}
public void unread(int b) throws IOException

View File

@ -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++];
if (numBytes > 0)
{
System.arraycopy (buf, pos, b, off, numBytes);
pos += numBytes;
return numBytes;
}
return numBytes + super.read(b, off, len - numBytes);
return super.read(b, off, len);
}
}