[Kaffe] patch for InflaterInputStream.java

Moses DeJong dejong at cs.umn.edu
Sun Feb 13 16:55:47 PST 2000


Here is a patch that should speed up the ZipInputStream implementation.

Sun Feb 13 Moses DeJong  <mdejong at cs.umn.edu>

        * libraries/javalib/java/util/zip/InflaterInputStream.java:
        Changed call to read() in the skip() method so that an
        array of 1 byte is not allocated each time through the loop.
-------------- next part --------------
Index: libraries/javalib/java/util/zip/InflaterInputStream.java
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/javalib/java/util/zip/InflaterInputStream.java,v
retrieving revision 1.3
diff -u -r1.3 InflaterInputStream.java
--- libraries/javalib/java/util/zip/InflaterInputStream.java	1999/03/10 21:26:02	1.3
+++ libraries/javalib/java/util/zip/InflaterInputStream.java	2000/02/13 23:56:20
@@ -79,8 +79,10 @@
 public long skip(long n) throws IOException {
 	// This is a terribly inefficient way to skip ...
 	long cnt;
+	byte[] b = new byte[1];
+
 	for (cnt = 0; cnt < n; cnt++) {
-		int r = read();
+		int r = read(b, 0, 1);
 		if (r == -1) {
 			break;
 		}


More information about the kaffe mailing list