no java.util.zip.ZipFile.size()

Patrick Tullmann tullmann at cs.utah.edu
Tue Sep 26 16:21:03 PDT 2000


The size() method on java.util.zip.ZipFile seems to be missing.  (It
is documented to return the number of entries in a ZipFile.)

The attached patch should add it.  (I added a new native method on
ZipFile.java, getZipFileSize0).  The size was stored in the jarFile
struct's 'count' field.

Let me know if this passes whatever standards we have, and I'll check
it in.  :)

-Pat

----- ----- ---- ---  ---  --   -    -      -         -               -
Pat Tullmann                                       tullmann at cs.utah.edu
	  This signature witticism intentionally left blank.


Index: libraries/javalib/java/util/zip/ZipFile.java
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/javalib/java/util/zip/ZipFile.java,v
retrieving revision 1.3
diff -u -r1.3 ZipFile.java
--- libraries/javalib/java/util/zip/ZipFile.java        1999/04/25 13:42:28     1.3
+++ libraries/javalib/java/util/zip/ZipFile.java        2000/09/26 23:18:01
@@ -71,6 +71,11 @@
        return (name);
 }
 
+public int size()
+{
+       return getZipFileSize0(zip);
+}
+
 protected void finalize()
 {
        try {
@@ -85,5 +90,6 @@
 private static native ZipEntry getZipEntry0(Ptr zip, String zname);
 private static native Vector getZipEntries0(Ptr zip);
 private static native byte[] getZipData0(Ptr zip, ZipEntry ze);
+private static native int getZipFileSize0(Ptr zip);
 
 }
Index: libraries/clib/native/ZipFile.c
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/clib/native/ZipFile.c,v
retrieving revision 1.12
diff -u -r1.12 ZipFile.c
--- libraries/clib/native/ZipFile.c     2000/08/26 22:21:57     1.12
+++ libraries/clib/native/ZipFile.c     2000/09/26 23:18:01
@@ -39,6 +39,12 @@
        closeJarFile((jarFile*)zip);
 }
 
+int
+java_util_zip_ZipFile_getZipFileSize0(struct Hkaffe_util_Ptr* zip)
+{
+       return ((jarFile*)zip)->count;
+}
+
 struct Hjava_util_zip_ZipEntry*
 java_util_zip_ZipFile_getZipEntry0(struct Hkaffe_util_Ptr* zip, Hjava_lang_String* zname)
 {


More information about the kaffe mailing list