re PR libgcj/20389 (BufferedInputStream gets ArrayIndexOutOfBoundsExeception)

2005-03-09  David Daney  <ddaney@avtrex.com>

	PR libgcj/20389
	Merge BufferedInputStream from GNU Classpath.
	* java/io/BufferedInputStream.java (marktarget): Field removed.
	(CHUNKSIZE): Field removed.
	(bufferSize): New field.
	(BufferedInputStream): Initialize fields.
	(close): Invalidate mark and buffer indexes.
	(mark):  Rewritten.
	(read()): Move mark handling code to refill.
	(read(byte[], int, int)): Ditto.
	(skip): Ditto and simplify EOF testing.
	(refill): Rewritten.
	* java/io/InputStreamReader.java (refill): Removed mark and reset
	of internal BufferedInputStream.

From-SVN: r96217
This commit is contained in:
David Daney 2005-03-09 22:11:33 +00:00 committed by David Daney
parent 9c90a97e93
commit fc6b4aa43a
3 changed files with 46 additions and 55 deletions

View file

@ -282,11 +282,9 @@ public class InputStreamReader extends Reader
{
// We have knowledge of the internals of BufferedInputStream
// here. Eww.
in.mark (0);
// BufferedInputStream.refill() can only be called when
// `pos>=count'.
boolean r = in.pos < in.count || in.refill ();
in.reset ();
if (! r)
return -1;
converter.setInput(in.buf, in.pos, in.count);