re PR java/14446 (GZIPInputStream: corrupted gzip file - crc mismatch)

PR libgcj/14446:
	* java/util/zip/GZIPInputStream.java (read): Avoid sign extension
	when comparing CRCs.
	* java/util/zip/InflaterInputStream.java (onebytebuffer): New
	field.
	(read()): New overload.

From-SVN: r87882
This commit is contained in:
Tom Tromey 2004-09-22 20:16:17 +00:00 committed by Tom Tromey
parent 9b270cce93
commit ecd16bf665
3 changed files with 28 additions and 1 deletions

View file

@ -70,6 +70,9 @@ public class InflaterInputStream extends FilterInputStream
*/
protected int len;
// We just use this if we are decoding one byte at a time with the
// read() call.
private byte[] onebytebuffer = new byte[1];
/**
* Create an InflaterInputStream with the default decompresseor
@ -155,6 +158,19 @@ public class InflaterInputStream extends FilterInputStream
inf.setInput(buf, 0, len);
}
/**
* Reads one byte of decompressed data.
*
* The byte is in the lower 8 bits of the int.
*/
public int read() throws IOException
{
int nread = read(onebytebuffer, 0, 1);
if (nread > 0)
return onebytebuffer[0] & 0xff;
return -1;
}
/**
* Decompresses data into the byte array
*