[kaffe] CVS kaffe (dalibor): Resynced with GNU Classpath: java/util/zip/InflaterInputStream skip unified with

Kaffe CVS cvs-commits at kaffe.org
Sat May 1 10:50:03 PDT 2004


PatchSet 4712 
Date: 2004/05/01 16:52:48
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: java/util/zip/InflaterInputStream skip unified with java.io

2004-05-01  Dalibor Topic  <robilad at kaffe.org>

        * libraries/javalib/java/util/zip/InflaterInputStream.java:
        Resynced with GNU Classpath.

        2004-04-30  Ingo Proetel  <proetel at aicas.com>

        * java/util/zip/InflaterInputStream.java (skip): Copied implementation
        from java.io.InputStream.

Members: 
	ChangeLog:1.2287->1.2288 
	libraries/javalib/java/util/zip/InflaterInputStream.java:1.9->1.10 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2287 kaffe/ChangeLog:1.2288
--- kaffe/ChangeLog:1.2287	Sat May  1 16:30:22 2004
+++ kaffe/ChangeLog	Sat May  1 16:52:48 2004
@@ -1,5 +1,15 @@
 2004-05-01  Dalibor Topic  <robilad at kaffe.org>
 
+	* libraries/javalib/java/util/zip/InflaterInputStream.java:
+	Resynced with GNU Classpath.
+
+	2004-04-30  Ingo Proetel  <proetel at aicas.com>
+
+        * java/util/zip/InflaterInputStream.java (skip): Copied implementation
+        from java.io.InputStream.
+
+2004-05-01  Dalibor Topic  <robilad at kaffe.org>
+
 	* libraries/javalib/javax/naming/CompoundName.java:
 	Resynced with GNU Classpath.
 
Index: kaffe/libraries/javalib/java/util/zip/InflaterInputStream.java
diff -u kaffe/libraries/javalib/java/util/zip/InflaterInputStream.java:1.9 kaffe/libraries/javalib/java/util/zip/InflaterInputStream.java:1.10
--- kaffe/libraries/javalib/java/util/zip/InflaterInputStream.java:1.9	Wed Apr 21 14:59:06 2004
+++ kaffe/libraries/javalib/java/util/zip/InflaterInputStream.java	Sat May  1 16:52:49 2004
@@ -225,8 +225,21 @@
     if (n == 0)
       return 0;
 
-    int len = (int) Math.min(n, 2048);
-    byte[] buf = new byte[len];
-    return (long) read(buf);
-  }
+    // Implementation copied from InputStream
+    // Throw away n bytes by reading them into a temp byte[].
+    // Limit the temp array to 2Kb so we don't grab too much memory.
+    final int buflen = n > 2048 ? 2048 : (int) n;
+    byte[] tmpbuf = new byte[buflen];
+    final long origN = n;
+
+    while (n > 0L)
+      {
+	int numread = read(tmpbuf, 0, n > buflen ? buflen : (int) n);
+	if (numread <= 0)
+	  break;
+	n -= numread;
+      }
+
+    return origN - n;
+ }
 }




More information about the kaffe mailing list