summaryrefslogtreecommitdiff
path: root/java/util/zip/InflaterInputStream.java
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2006-03-10 21:16:05 +0000
committerTom Tromey <tromey@redhat.com>2006-03-10 21:16:05 +0000
commit799643ade13f561bc7c2afac628396d83fda6ab1 (patch)
treed6892d66a6bcd676acb9bda0a13ba443a3678784 /java/util/zip/InflaterInputStream.java
parenta7ca0c2d4964f62ddd33d5db86ad756f3685f568 (diff)
downloadclasspath-799643ade13f561bc7c2afac628396d83fda6ab1.tar.gz
* java/util/zip/InflaterInputStream.java (read): Replace with libgcj
implementation. * java/util/zip/GZIPInputStream.java (readHeader): Use DEFLATED, not '8'.
Diffstat (limited to 'java/util/zip/InflaterInputStream.java')
-rw-r--r--java/util/zip/InflaterInputStream.java46
1 files changed, 25 insertions, 21 deletions
diff --git a/java/util/zip/InflaterInputStream.java b/java/util/zip/InflaterInputStream.java
index 3c3745706..a42e0361b 100644
--- a/java/util/zip/InflaterInputStream.java
+++ b/java/util/zip/InflaterInputStream.java
@@ -186,31 +186,35 @@ public class InflaterInputStream extends FilterInputStream
throw new IOException("stream closed");
if (len == 0)
return 0;
+ if (inf.finished())
+ return - 1;
int count = 0;
- for (;;)
+ while (count == 0)
{
-
- try
- {
- count = inf.inflate(b, off, len);
- }
- catch (DataFormatException dfe)
- {
- throw new ZipException(dfe.getMessage());
- }
-
- if (count > 0)
- return count;
-
- if (inf.needsDictionary()
- | inf.finished())
- return -1;
- else if (inf.needsInput())
- fill();
- else
- throw new InternalError("Don't know what to do");
+ if (inf.needsInput())
+ fill();
+
+ try
+ {
+ count = inf.inflate(b, off, len);
+ }
+ catch (DataFormatException dfe)
+ {
+ throw new ZipException(dfe.getMessage());
+ }
+ if (count == 0)
+ {
+ if (this.len == - 1)
+ {
+ // Couldn't get any more data to feed to the Inflater
+ return - 1;
+ }
+ if (inf.needsDictionary())
+ throw new ZipException("Inflater needs Dictionary");
+ }
}
+ return count;
}
/**