Commit 56067b00 by Tom Tromey Committed by Tom Tromey

PushbackInputStream.java (read): If there are characters in the buffer, don't…

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
parent 35e1ebee
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>
......
/* 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
......
/* 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);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment