diff options
Diffstat (limited to 'libjava/classpath/java/util')
-rw-r--r-- | libjava/classpath/java/util/zip/InflaterInputStream.java | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/libjava/classpath/java/util/zip/InflaterInputStream.java b/libjava/classpath/java/util/zip/InflaterInputStream.java index 3c37457..08c1fd7 100644 --- a/libjava/classpath/java/util/zip/InflaterInputStream.java +++ b/libjava/classpath/java/util/zip/InflaterInputStream.java @@ -1,5 +1,5 @@ /* InflaterInputStream.java - Input stream filter for decompressing - Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 + Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -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) { + if (inf.needsInput()) + fill(); try { count = inf.inflate(b, off, len); + 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"); + } } 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"); } + return count; } /** |