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,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);
}
}