Author: tdraier
Date: Wed May 23 12:14:05 2007
New Revision: 17360

URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D17360&repname=
=3Djahia
Log:
switched to jdk 1.4 implementation for compatibility

Modified:
    branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/utils/zip/Deflater=
OutputStream.java
    branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/utils/zip/Inflater=
InputStream.java
    branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/utils/zip/ZipConst=
ants.java
    branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/utils/zip/ZipEntry=
.java
    branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/utils/zip/ZipInput=
Stream.java
    branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/utils/zip/ZipOutpu=
tStream.java

Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/utils/zip/De=
flaterOutputStream.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/core/src/java/org/jahia/utils/zip/DeflaterOutputStream.java&rev=3D1=
7360&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/utils/zip/Deflater=
OutputStream.java (original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/utils/zip/Deflater=
OutputStream.java Wed May 23 12:14:05 2007
@@ -1,7 +1,7 @@
 /*
- * @(#)DeflaterOutputStream.java       1.34 04/01/12
+ * @(#)DeflaterOutputStream.java       1.34 06/04/05
  *
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  */
 =

@@ -9,7 +9,6 @@
 =

 import java.io.FilterOutputStream;
 import java.io.OutputStream;
-import java.io.InputStream;
 import java.io.IOException;
 import java.util.zip.Deflater;
 =

@@ -110,9 +109,14 @@
            return;
        }
        if (!def.finished()) {
-           def.setInput(b, off, len);
-           while (!def.needsInput()) {
-               deflate();
+            // Deflate no more than stride bytes at a time.  This avoids
+            // excess copying in deflateBytes (see Deflater.c)
+            int stride =3D buf.length;
+            for (int i =3D 0; i < len; i+=3D stride) {
+                def.setInput(b, off + i, Math.min(stride, len - i));
+                while (!def.needsInput()) {
+                    deflate();
+                }
            }
        }
     }

Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/utils/zip/In=
flaterInputStream.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/core/src/java/org/jahia/utils/zip/InflaterInputStream.java&rev=3D17=
360&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/utils/zip/Inflater=
InputStream.java (original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/utils/zip/Inflater=
InputStream.java Wed May 23 12:14:05 2007
@@ -1,7 +1,7 @@
 /*
- * @(#)InflaterInputStream.java        1.37 04/06/11
+ * @(#)InflaterInputStream.java        1.32 03/01/23
  *
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  */
 =

@@ -21,7 +21,7 @@
  * decompression filters, such as GZIPInputStream.
  *
  * @see                Inflater
- * @version    1.37, 06/11/04
+ * @version    1.32, 01/23/03
  * @author     David Connelly
  */
 public
@@ -145,7 +145,7 @@
     }
 =

     /**
-     * Returns 0 after EOF has been reached, otherwise always return 1.
+     * Returns 0 after EOF has reached, otherwise always return 1.
      * <p>
      * Programs should not count on this method to return the actual number
      * of bytes that could be read without blocking.
@@ -195,8 +195,7 @@
     }
 =

     /**
-     * Closes this input stream and releases any system resources associat=
ed
-     * with the stream.
+     * Closes the input stream.
      * @exception IOException if an I/O error has occurred
      */
     public void close() throws IOException {
@@ -220,48 +219,4 @@
        }
        inf.setInput(buf, 0, len);
     }
-
-    /**
-     * Tests if this input stream supports the <code>mark</code> and
-     * <code>reset</code> methods. The <code>markSupported</code>
-     * method of <code>InflaterInputStream</code> returns
-     * <code>false</code>.
-     *
-     * @return  a <code>boolean</code> indicating if this stream type supp=
orts
-     *          the <code>mark</code> and <code>reset</code> methods.
-     * @see     java.io.InputStream#mark(int)
-     * @see     java.io.InputStream#reset()
-     */
-    public boolean markSupported() {
-        return false;
-    }
-
-    /**
-     * Marks the current position in this input stream.
-     *
-     * <p> The <code>mark</code> method of <code>InflaterInputStream</code>
-     * does nothing.
-     *
-     * @param   readlimit   the maximum limit of bytes that can be read be=
fore
-     *                      the mark position becomes invalid.
-     * @see     java.io.InputStream#reset()
-     */
-    public synchronized void mark(int readlimit) {
-    }
-
-    /**
-     * Repositions this stream to the position at the time the
-     * <code>mark</code> method was last called on this input stream.
-     *
-     * <p> The method <code>reset</code> for class
-     * <code>InflaterInputStream</code> does nothing except throw an
-     * <code>IOException</code>.
-     *
-     * @exception  IOException  if this method is invoked.
-     * @see     java.io.InputStream#mark(int)
-     * @see     java.io.IOException
-     */
-    public synchronized void reset() throws IOException {
-        throw new IOException("mark/reset not supported");
-    }
 }

Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/utils/zip/Zi=
pConstants.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/core/src/java/org/jahia/utils/zip/ZipConstants.java&rev=3D17360&rep=
name=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/utils/zip/ZipConst=
ants.java (original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/utils/zip/ZipConst=
ants.java Wed May 23 12:14:05 2007
@@ -1,7 +1,7 @@
 /*
- * @(#)ZipConstants.java       1.18 03/12/19
+ * @(#)ZipConstants.java       1.17 03/01/23
  *
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  */
 =

@@ -11,7 +11,7 @@
  * This interface defines the constants that are used by the classes
  * which manipulate ZIP files.
  *
- * @version    1.18, 12/19/03
+ * @version    1.17, 01/23/03
  * @author     David Connelly
  */
 interface ZipConstants {

Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/utils/zip/Zi=
pEntry.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/core/src/java/org/jahia/utils/zip/ZipEntry.java&rev=3D17360&repname=
=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/utils/zip/ZipEntry=
.java (original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/utils/zip/ZipEntry=
.java Wed May 23 12:14:05 2007
@@ -1,5 +1,5 @@
 /*
- * @(#)ZipEntry.java   1.38 05/08/09
+ * @(#)ZipEntry.java   1.37 05/04/29
  *
  * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
@@ -12,7 +12,7 @@
 /**
  * This class is used to represent a ZIP file entry.
  *
- * @version    1.38, 08/09/05
+ * @version    1.37, 04/29/05
  * @author     David Connelly
  */
 public

Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/utils/zip/Zi=
pInputStream.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/core/src/java/org/jahia/utils/zip/ZipInputStream.java&rev=3D17360&r=
epname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/utils/zip/ZipInput=
Stream.java (original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/utils/zip/ZipInput=
Stream.java Wed May 23 12:14:05 2007
@@ -1,7 +1,7 @@
 /*
- * @(#)ZipInputStream.java     1.37 04/06/11
+ * @(#)ZipInputStream.java     1.33 03/02/07
  *
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  */
 =

@@ -20,7 +20,7 @@
  * entries.
  *
  * @author     David Connelly
- * @version    1.37, 06/11/04
+ * @version    1.33, 02/07/03
  */
 public
 class ZipInputStream extends InflaterInputStream implements ZipConstants {
@@ -59,10 +59,10 @@
     }
 =

     /**
-     * Reads the next ZIP file entry and positions the stream at the
-     * beginning of the entry data.
-     * @return the next ZIP file entry, or null if there are no more entri=
es
-     * @exception java.util.zip.ZipException if a ZIP file error has occur=
red
+     * Reads the next ZIP file entry and positions stream at the beginning
+     * of the entry data.
+     * @return the ZipEntry just read
+     * @exception ZipException if a ZIP file error has occurred
      * @exception IOException if an I/O error has occurred
      */
     public ZipEntry getNextEntry() throws IOException {
@@ -199,8 +199,7 @@
     }
 =

     /**
-     * Closes this input stream and releases any system resources associat=
ed
-     * with the stream.
+     * Closes the ZIP input stream.
      * @exception IOException if an I/O error has occurred
      */
     public void close() throws IOException {
@@ -324,15 +323,15 @@
                 e.size =3D get32(tmpbuf, EXTLEN);
             }
        }
-       if (e.size !=3D inf.getBytesWritten()) {
+       if (e.size !=3D inf.getTotalOut()) {
            throw new ZipException(
-               "invalid entry size (expected " + e.size +
-               " but got " + inf.getBytesWritten() + " bytes)");
+               "invalid entry size (expected " + e.size + " but got " +
+               inf.getTotalOut() + " bytes)");
        }
-       if (e.csize !=3D inf.getBytesRead()) {
+       if (e.csize !=3D inf.getTotalIn()) {
            throw new ZipException(
                "invalid entry compressed size (expected " + e.csize +
-               " but got " + inf.getBytesRead() + " bytes)");
+               " but got " + inf.getTotalIn() + " bytes)");
        }
        if (e.crc !=3D crc.getValue()) {
            throw new ZipException(

Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/utils/zip/Zi=
pOutputStream.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/core/src/java/org/jahia/utils/zip/ZipOutputStream.java&rev=3D17360&=
repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/utils/zip/ZipOutpu=
tStream.java (original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/utils/zip/ZipOutpu=
tStream.java Wed May 23 12:14:05 2007
@@ -1,7 +1,7 @@
 /*
- * @(#)ZipOutputStream.java    1.31 03/12/19
+ * @(#)ZipOutputStream.java    1.27 03/02/07
  *
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  */
 =

@@ -23,7 +23,7 @@
  * entries.
  *
  * @author     David Connelly
- * @version    1.31, 12/19/03
+ * @version    1.27, 02/07/03
  */
 public
 class ZipOutputStream extends DeflaterOutputStream implements ZipConstants=
 {
@@ -31,7 +31,7 @@
     private Vector entries =3D new Vector();
     private Hashtable names =3D new Hashtable();
     private CRC32 crc =3D new CRC32();
-    private long written =3D 0;
+    private long written;
     private long locoff =3D 0;
     private String comment;
     private int method =3D DEFLATED;
@@ -189,15 +189,16 @@
                }
                if ((e.flag & 8) =3D=3D 0) {
                    // verify size, compressed size, and crc-32 settings
-                   if (e.size !=3D def.getBytesRead()) {
+                   if (e.size !=3D def.getTotalIn()) {
                        throw new ZipException(
                            "invalid entry size (expected " + e.size +
-                           " but got " + def.getBytesRead() + " bytes)");
+                           " but got " + def.getTotalIn() + " bytes)");
                    }
-                   if (e.csize !=3D def.getBytesWritten()) {
+                   if (e.csize !=3D def.getTotalOut()) {
                        throw new ZipException(
                            "invalid entry compressed size (expected " +
-                           e.csize + " but got " + def.getBytesWritten() + " 
bytes)");
+                           e.csize + " but got " + def.getTotalOut() +
+                           " bytes)");
                    }
                    if (e.crc !=3D crc.getValue()) {
                        throw new ZipException(
@@ -206,8 +207,8 @@
                            Long.toHexString(crc.getValue()) + ")");
                    }
                } else {
-                   e.size  =3D def.getBytesRead();
-                   e.csize =3D def.getBytesWritten();
+                   e.size =3D def.getTotalIn();
+                   e.csize =3D def.getTotalOut();
                    e.crc =3D crc.getValue();
                    writeEXT(e);
                }
@@ -444,7 +445,7 @@
        written +=3D len;
     }
 =

-    static private String encoding =3D "ISO-8859-1";
+    static private String encoding =3D "UTF-8";
     /*
      * Returns the length of String's UTF8 encoding.
      */

_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list

Reply via email to