summaryrefslogtreecommitdiffstats
path: root/libjava/java/util/zip/InflaterInputStream.java
diff options
context:
space:
mode:
authorbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>2000-11-29 10:06:03 +0000
committerbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>2000-11-29 10:06:03 +0000
commite42b522040644e919e4da4c9a10edcec01ae847e (patch)
tree2faa9e8f99525720284bd59f9288fb1d62c941dc /libjava/java/util/zip/InflaterInputStream.java
parentba7f47dc6a3c0112f74a36bc4aeb3e317d1d2bca (diff)
downloadppe42-gcc-e42b522040644e919e4da4c9a10edcec01ae847e.tar.gz
ppe42-gcc-e42b522040644e919e4da4c9a10edcec01ae847e.zip
* java/util/zip/InflaterInputStream (read): Don't return -1 unless
the infate() call didn't deliver any output. Throw a ZipException if the needsDictionary() call returns true. * java/io/ByteArrayInputStream (read): Remove redundant bounds checks. * java/io/InputStreamReader: Use the default buffer size for the contained BufferedInputStream. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37846 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/util/zip/InflaterInputStream.java')
-rw-r--r--libjava/java/util/zip/InflaterInputStream.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/libjava/java/util/zip/InflaterInputStream.java b/libjava/java/util/zip/InflaterInputStream.java
index 005c82179d1..d7459eb100d 100644
--- a/libjava/java/util/zip/InflaterInputStream.java
+++ b/libjava/java/util/zip/InflaterInputStream.java
@@ -44,8 +44,6 @@ public class InflaterInputStream extends FilterInputStream
{
protected void fill () throws IOException
{
- if (inf == null)
- throw new IOException ("stream closed");
len = in.read(buf, 0, buf.length);
if (len != -1)
inf.setInput(buf, 0, len);
@@ -85,18 +83,23 @@ public class InflaterInputStream extends FilterInputStream
return -1;
if (inf.needsInput())
fill ();
- if (this.len == -1)
- return -1; // Couldn't get any more data to feed to the Inflater
- if (inf.needsDictionary())
- return -1;
+ int count;
try
{
- return inf.inflate(buf, off, len);
+ count = inf.inflate(buf, off, len);
+ if (count == 0)
+ {
+ if (len == -1)
+ return -1; // Couldn't get any more data to feed to the Inflater
+ if (inf.needsDictionary())
+ throw new ZipException ("Inflater needs Dictionary");
+ }
}
catch (DataFormatException dfe)
{
throw new ZipException (dfe.getMessage());
}
+ return count;
}
public void close () throws IOException
OpenPOWER on IntegriCloud