diff options
| author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-09-22 20:16:17 +0000 |
|---|---|---|
| committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-09-22 20:16:17 +0000 |
| commit | 3f8eac3cd918da270d591262973877392c3dfeca (patch) | |
| tree | 2387909c6af042a5d6b9fd456ab20930ba600a61 /libjava/java/util/zip/InflaterInputStream.java | |
| parent | f212e042935f3d9edfa581cae3f63447a48efcb0 (diff) | |
| download | gcc-3f8eac3cd918da270d591262973877392c3dfeca.tar.gz | |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@87882 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/util/zip/InflaterInputStream.java')
| -rw-r--r-- | libjava/java/util/zip/InflaterInputStream.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libjava/java/util/zip/InflaterInputStream.java b/libjava/java/util/zip/InflaterInputStream.java index 27c29ff41df..3676a2cdb5d 100644 --- a/libjava/java/util/zip/InflaterInputStream.java +++ b/libjava/java/util/zip/InflaterInputStream.java @@ -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 @@ -156,6 +159,19 @@ public class InflaterInputStream extends FilterInputStream } /** + * 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 * * @param b the array to read and decompress data into |
