]> gcc.gnu.org Git - gcc.git/commitdiff
2004-07-30 Michael Koch <konqueror@gmx.de>
authorMichael Koch <konqueror@gmx.de>
Fri, 30 Jul 2004 17:00:34 +0000 (17:00 +0000)
committerMichael Koch <mkoch@gcc.gnu.org>
Fri, 30 Jul 2004 17:00:34 +0000 (17:00 +0000)
* java/util/zip/GZIPInputStream.java
(GZIPInputStream): Increase buffer size to 4k.
* java/util/zip/GZIPOutputStream.java
(GZIPOutputStream): Likewise.
* java/util/zip/Inflater.java
(setInput): Merged formating with GNU classpath.
* java/util/zip/InflaterInputStream.java
(InflaterInputStream): Increase buffer size to 4k.
(fill): Throw exception if stream ends early.
(read): Merged endless-loop with GNU classpath.
(skip): Increase buffer size to 2k.

From-SVN: r85340

libjava/ChangeLog
libjava/java/util/zip/GZIPInputStream.java
libjava/java/util/zip/GZIPOutputStream.java
libjava/java/util/zip/Inflater.java
libjava/java/util/zip/InflaterInputStream.java

index db17ad758e2c987a548c9e763302679a5ddf526c..213dbcf3998d4eb1c40496415515b38df7cc5d7c 100644 (file)
@@ -1,3 +1,17 @@
+2004-07-30  Michael Koch  <konqueror@gmx.de>
+
+       * java/util/zip/GZIPInputStream.java
+       (GZIPInputStream): Increase buffer size to 4k.
+       * java/util/zip/GZIPOutputStream.java
+       (GZIPOutputStream): Likewise.
+       * java/util/zip/Inflater.java
+       (setInput): Merged formating with GNU classpath.
+       * java/util/zip/InflaterInputStream.java
+       (InflaterInputStream): Increase buffer size to 4k.
+       (fill): Throw exception if stream ends early.
+       (read): Merged endless-loop with GNU classpath.
+       (skip): Increase buffer size to 2k.
+
 2004-07-30  Michael Koch  <konqueror@gmx.de>
 
        * gnu/java/awt/EmbeddedWindow.java
index ec4613f153c2be1bdc967634ea8650d8873e9127..9eef73eb9453ac025f5b119a2baef51708f63365 100644 (file)
@@ -104,7 +104,7 @@ public class GZIPInputStream
   public GZIPInputStream(InputStream in)
     throws IOException
   {
-    this(in, 512);
+    this(in, 4096);
   }
 
   /**
index 70339a022d02bc540b76ab4cb26e2649565b9e1d..4ec6cb1a6b8e92f992398ce87063fda1e41d80cd 100644 (file)
@@ -69,7 +69,7 @@ public class GZIPOutputStream extends DeflaterOutputStream
    */
   public GZIPOutputStream(OutputStream out) throws IOException
   {
-    this(out, 512);
+    this(out, 4096);
   }
 
   /**
index 28e89ea4449a3afb5639d5d794867324f1aab349..5b6921a70299590e4b1bc7659a073fdc2bf78d6a 100644 (file)
@@ -251,7 +251,7 @@ public class Inflater
    * @param buffer the input.
    * @exception IllegalStateException if no input is needed.
    */
-  public void setInput (byte[] buf)
+  public void setInput (byte[] buf) 
   {
     setInput (buf, 0, buf.length);
   }
index 60442e474afabf3e19be5b8f0f5f1ecf61d4e938..27c29ff41dfd4dac0a70330ebf76a1ce0c68811c 100644 (file)
@@ -79,7 +79,7 @@ public class InflaterInputStream extends FilterInputStream
    */
   public InflaterInputStream(InputStream in) 
   {
-    this(in, new Inflater(), 512);
+    this(in, new Inflater(), 4096);
   }
 
   /**
@@ -91,7 +91,7 @@ public class InflaterInputStream extends FilterInputStream
    */
   public InflaterInputStream(InputStream in, Inflater inf) 
   {
-    this(in, inf, 512);
+    this(in, inf, 4096);
   }
 
   /**
@@ -149,8 +149,10 @@ public class InflaterInputStream extends FilterInputStream
     
     len = in.read(buf, 0, buf.length);
 
-    if (len != -1)
-      inf.setInput(buf, 0, len);
+    if (len < 0)
+      throw new ZipException("Deflated stream ends early.");
+    
+    inf.setInput(buf, 0, len);
   }
 
   /**
@@ -170,7 +172,7 @@ public class InflaterInputStream extends FilterInputStream
       return -1;
 
     int count = 0;
-    while (count == 0)
+    for (;;)
       {
        if (inf.needsInput())
          fill();
@@ -193,8 +195,10 @@ public class InflaterInputStream extends FilterInputStream
          {
            throw new ZipException(dfe.getMessage());
          }
+
+       if (count > 0)
+         return count;
       }
-    return count;
   }
 
   /**
@@ -212,18 +216,18 @@ public class InflaterInputStream extends FilterInputStream
     if (n == 0)
       return 0;
 
-    int buflen = (int) Math.min(n, 1024);
+    int buflen = (int) Math.min(n, 2048);
     byte[] tmpbuf = new byte[buflen];
 
     long skipped = 0L;
     while (n > 0L)
       {
        int numread = read(tmpbuf, 0, buflen);
-       if (numread == -1)
+       if (numread <= 0)
          break;
        n -= numread;
        skipped += numread;
-       buflen = (int) Math.min(n, 1024);
+       buflen = (int) Math.min(n, 2048);
       }
 
     return skipped;
This page took 0.095365 seconds and 5 git commands to generate.