harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r556570 [1/3] - in /harmony/enhanced/classlib/trunk/modules/archive/src/main/java: java/util/jar/ java/util/zip/ org/apache/harmony/archive/internal/nls/ org/apache/harmony/archive/util/
Date Mon, 16 Jul 2007 09:22:24 GMT
Author: pyang
Date: Mon Jul 16 02:22:19 2007
New Revision: 556570

URL: http://svn.apache.org/viewvc?view=rev&rev=556570
Log:
Tidy up format of archive module using Eclipse formatter, convert tabs to spaces, remove redundant empty lines and spaces, etc

Modified:
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Attributes.java
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/InitManifest.java
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarEntry.java
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarFile.java
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarInputStream.java
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarVerifier.java
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Manifest.java
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Pack200.java
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Adler32.java
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/CRC32.java
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/CheckedInputStream.java
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/CheckedOutputStream.java
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Checksum.java
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Deflater.java
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/DeflaterOutputStream.java
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/GZIPInputStream.java
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/GZIPOutputStream.java
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Inflater.java
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/InflaterInputStream.java
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipConstants.java
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipEntry.java
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipException.java
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipFile.java
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipInputStream.java
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipOutputStream.java
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/nls/Messages.java
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/util/Util.java

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Attributes.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Attributes.java?view=diff&rev=556570&r1=556569&r2=556570
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Attributes.java (original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Attributes.java Mon Jul 16 02:22:19 2007
@@ -40,8 +40,7 @@
 
         public static final Name CLASS_PATH = new Name("Class-Path"); //$NON-NLS-1$
 
-        public static final Name MANIFEST_VERSION = new Name(
-                "Manifest-Version"); //$NON-NLS-1$
+        public static final Name MANIFEST_VERSION = new Name("Manifest-Version"); //$NON-NLS-1$
 
         public static final Name MAIN_CLASS = new Name("Main-Class"); //$NON-NLS-1$
 
@@ -137,7 +136,7 @@
      */
     @SuppressWarnings("unchecked")
     public Attributes(Attributes attrib) {
-        map = (Map<Object, Object>)((HashMap) attrib.map).clone();
+        map = (Map<Object, Object>) ((HashMap) attrib.map).clone();
     }
 
     /**
@@ -233,9 +232,10 @@
      *                when key is not an Attributes.Name or value is not a
      *                String
      */
-    @SuppressWarnings("cast") // Require cast to force ClassCastException
+    @SuppressWarnings("cast")
+    // Require cast to force ClassCastException
     public Object put(Object key, Object value) {
-        return map.put((Name)key, (String)value);
+        return map.put((Name) key, (String) value);
     }
 
     /**

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/InitManifest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/InitManifest.java?view=diff&rev=556570&r1=556569&r2=556570
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/InitManifest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/InitManifest.java Mon Jul 16 02:22:19 2007
@@ -51,7 +51,8 @@
 
     private final byte[] mainAttributesChunk;
 
-    InitManifest(InputStream is, Attributes main, Map<String, Attributes> entries, Map<String, byte[]> chunks,
+    InitManifest(InputStream is, Attributes main,
+            Map<String, Attributes> entries, Map<String, byte[]> chunks,
             String verString) throws IOException {
         encoding = AccessController.doPrivileged(new PriviAction<String>(
                 "manifest.read.encoding")); //$NON-NLS-1$
@@ -77,14 +78,16 @@
 
         list.clear();
         byte[] chunk = null;
-        while (chunks == null ? readLines(is, list) : (chunk = nextChunk(is, list)) != null) {
+        while (chunks == null ? readLines(is, list) : (chunk = nextChunk(is,
+                list)) != null) {
             if (list.size() == 0) {
                 continue;
             }
             it = list.iterator();
             String line = it.next();
             if (line.length() < 7
-                    || !Util.toASCIILowerCase(line.substring(0, 5)).equals("name:")) { //$NON-NLS-1$
+                    || !Util.toASCIILowerCase(line.substring(0, 5)).equals(
+                            "name:")) { //$NON-NLS-1$
                 throw new IOException(Messages.getString("archive.23")); //$NON-NLS-1$
             }
             // Name: length required space char

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarEntry.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarEntry.java?view=diff&rev=556570&r1=556569&r2=556570
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarEntry.java (original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarEntry.java Mon Jul 16 02:22:19 2007
@@ -34,13 +34,13 @@
     private Attributes attributes;
 
     JarFile parentJar;
-   
+
     CodeSigner signers[];
 
     // Cached factory used to build CertPath-s in <code>getCodeSigners()</code>.
     private CertificateFactory factory;
 
-    private boolean isFactoryChecked = false;     
+    private boolean isFactoryChecked = false;
 
     /**
      * Create a new JarEntry named name
@@ -111,7 +111,7 @@
     public JarEntry(JarEntry je) {
         super(je);
         parentJar = je.parentJar;
-        attributes = je.attributes;        
+        attributes = je.attributes;
         signers = je.signers;
     }
 
@@ -137,7 +137,7 @@
     }
 
     private CodeSigner[] getCodeSigners(Certificate[] certs) {
-        if(null == certs) {
+        if (null == certs) {
             return null;
         }
 

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarFile.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarFile.java?view=diff&rev=556570&r1=556569&r2=556570
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarFile.java (original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarFile.java Mon Jul 16 02:22:19 2007
@@ -232,7 +232,7 @@
 
             public JarEntry nextElement() {
                 JarEntry je = new JarEntry(ze.nextElement());
-                je.parentJar = jf;                
+                je.parentJar = jf;
                 return je;
             }
         }
@@ -260,7 +260,7 @@
         if (manifest != null) {
             return manifest;
         }
-		try {
+        try {
             ByteArrayInputStream is = (ByteArrayInputStream) super
                     .getInputStream(manifestEntry);
             if (verifier != null) {
@@ -275,10 +275,10 @@
             } finally {
                 is.close();
             }
-	        manifestEntry = null;
-		} catch(NullPointerException e) {
-			manifestEntry = null;
-		}
+            manifestEntry = null;
+        } catch (NullPointerException e) {
+            manifestEntry = null;
+        }
         return manifest;
     }
 
@@ -300,10 +300,14 @@
                     if (verifier == null) {
                         break;
                     }
-                } else if (verifier != null && entryName.length() > dirLength
-                        && (Util.ASCIIIgnoreCaseRegionMatches(entryName, entryName.length() - 3, ".SF", 0 ,3) //$NON-NLS-1$
-                           || Util.ASCIIIgnoreCaseRegionMatches(entryName, entryName.length() - 4, ".DSA", 0 ,4) //$NON-NLS-1$
-                           || Util.ASCIIIgnoreCaseRegionMatches(entryName, entryName.length() - 4, ".RSA", 0 ,4))){ //$NON-NLS-1$
+                } else if (verifier != null
+                        && entryName.length() > dirLength
+                        && (Util.ASCIIIgnoreCaseRegionMatches(entryName,
+                                entryName.length() - 3, ".SF", 0, 3) //$NON-NLS-1$
+                                || Util.ASCIIIgnoreCaseRegionMatches(entryName,
+                                        entryName.length() - 4, ".DSA", 0, 4) //$NON-NLS-1$
+                        || Util.ASCIIIgnoreCaseRegionMatches(entryName,
+                                entryName.length() - 4, ".RSA", 0, 4))) { //$NON-NLS-1$
                     signed = true;
                     InputStream is = super.getInputStream(entry);
                     byte[] buf = new byte[is.available()];
@@ -373,7 +377,7 @@
             return ze;
         }
         JarEntry je = new JarEntry(ze);
-        je.parentJar = this;        
+        je.parentJar = this;
         return je;
     }
 

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarInputStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarInputStream.java?view=diff&rev=556570&r1=556569&r2=556570
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarInputStream.java (original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarInputStream.java Mon Jul 16 02:22:19 2007
@@ -132,9 +132,10 @@
                             throw e;
                         }
                     } else {
-                        verifier.verifySignatures(
-                                (JarVerifier.VerifierEntry) verStream,
-                                jarEntry);
+                        verifier
+                                .verifySignatures(
+                                        (JarVerifier.VerifierEntry) verStream,
+                                        jarEntry);
                     }
                 }
             } else {

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarVerifier.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarVerifier.java?view=diff&rev=556570&r1=556569&r2=556570
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarVerifier.java (original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarVerifier.java Mon Jul 16 02:22:19 2007
@@ -40,12 +40,12 @@
 import org.apache.harmony.archive.util.Util;
 
 /**
- * Non-public class used by {@link JarFile} and
- * {@link JarInputStream} to manage the verification of signed
- * jars. <code>JarFile</code> and <code>JarInputStream</code> objects will
- * be expected to have a <code>JarVerifier</code> instance member which can be
- * used to carry out the tasks associated with verifying a signed jar. These
- * tasks would typically include:
+ * Non-public class used by {@link JarFile} and {@link JarInputStream} to manage
+ * the verification of signed jars. <code>JarFile</code> and
+ * <code>JarInputStream</code> objects will be expected to have a
+ * <code>JarVerifier</code> instance member which can be used to carry out the
+ * tasks associated with verifying a signed jar. These tasks would typically
+ * include:
  * <ul>
  * <li>verification of all signed signature files
  * <li>confirmation that all signed data was signed only by the party or
@@ -63,14 +63,13 @@
 
     private HashMap<String, byte[]> metaEntries = new HashMap<String, byte[]>(5);
 
-    private final Hashtable<String, HashMap<String, Attributes>> signatures =
-        new Hashtable<String, HashMap<String, Attributes>>(5);
+    private final Hashtable<String, HashMap<String, Attributes>> signatures = new Hashtable<String, HashMap<String, Attributes>>(
+            5);
 
-    private final Hashtable<String, Certificate[]> certificates =
-        new Hashtable<String, Certificate[]>(5);
+    private final Hashtable<String, Certificate[]> certificates = new Hashtable<String, Certificate[]>(
+            5);
 
-    private final Hashtable<String, Certificate[]> verifiedEntries =
-        new Hashtable<String, Certificate[]>();
+    private final Hashtable<String, Certificate[]> verifiedEntries = new Hashtable<String, Certificate[]>();
 
     byte[] mainAttributesChunk;
 
@@ -150,8 +149,8 @@
         }
 
         Vector<Certificate> certs = new Vector<Certificate>();
-        Iterator<Map.Entry<String, HashMap<String, Attributes>>> it =
-            signatures.entrySet().iterator();
+        Iterator<Map.Entry<String, HashMap<String, Attributes>>> it = signatures
+                .entrySet().iterator();
         while (it.hasNext()) {
             Map.Entry<String, HashMap<String, Attributes>> entry = it.next();
             HashMap<String, Attributes> hm = entry.getValue();
@@ -275,7 +274,7 @@
                     new ByteArrayInputStream(sBlockBytes));
             /*
              * Recursive call in loading security provider related class which
-             * is in a signed jar. 
+             * is in a signed jar.
              */
             if (null == metaEntries) {
                 return;
@@ -287,8 +286,8 @@
             return;
         } catch (GeneralSecurityException e) {
             /* [MSG "archive.30", "{0} failed verification of {1}"] */
-            throw new SecurityException(
-                    Messages.getString("archive.30", jarName, signatureFile)); //$NON-NLS-1$
+            throw new SecurityException(Messages.getString(
+                    "archive.30", jarName, signatureFile)); //$NON-NLS-1$
         }
 
         // Verify manifest hash in .sf file
@@ -317,8 +316,8 @@
             if (!verify(attributes, digestAttribute, mainAttributesChunk,
                     false, true)) {
                 /* [MSG "archive.30", "{0} failed verification of {1}"] */
-                throw new SecurityException(
-                        Messages.getString("archive.30", jarName, signatureFile)); //$NON-NLS-1$
+                throw new SecurityException(Messages.getString(
+                        "archive.30", jarName, signatureFile)); //$NON-NLS-1$
             }
         }
 
@@ -340,10 +339,14 @@
                 }
                 if (!verify(entry.getValue(), "-Digest", chunk, //$NON-NLS-1$
                         createdBySigntool, false)) {
-                    /* [MSG "archive.31", "{0} has invalid digest for {1} in {2}"] */
-                    throw new SecurityException(
-                        Messages.getString("archive.31", //$NON-NLS-1$
-                            new Object[] { signatureFile, entry.getKey(), jarName }));
+                    /*
+                     * [MSG "archive.31", "{0} has invalid digest for {1} in
+                     * {2}"]
+                     */
+                    throw new SecurityException(Messages.getString(
+                            "archive.31", //$NON-NLS-1$
+                            new Object[] { signatureFile, entry.getKey(),
+                                    jarName }));
                 }
             }
         }
@@ -382,7 +385,8 @@
         byte[] digest = entry.digest.digest();
         if (!MessageDigest.isEqual(digest, Base64.decode(entry.hash))) {
             /* [MSG "archive.31", "{0} has invalid digest for {1} in {2}"] */
-            throw new SecurityException(Messages.getString("archive.31", new Object[] { //$NON-NLS-1$
+            throw new SecurityException(Messages.getString(
+                    "archive.31", new Object[] { //$NON-NLS-1$
                     JarFile.MANIFEST_NAME, zipEntry.getName(), jarName }));
         }
         verifiedEntries.put(zipEntry.getName(), entry.certificates);

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Manifest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Manifest.java?view=diff&rev=556570&r1=556569&r2=556570
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Manifest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Manifest.java Mon Jul 16 02:22:19 2007
@@ -30,7 +30,8 @@
 import org.apache.harmony.luni.util.PriviAction;
 
 /**
- * The Manifest class is used to obtain attribute information for a JarFile and its entries.
+ * The Manifest class is used to obtain attribute information for a JarFile and
+ * its entries.
  * 
  */
 public class Manifest implements Cloneable {
@@ -38,7 +39,8 @@
 
     private static final byte[] LINE_SEPARATOR = new byte[] { '\r', '\n' };
 
-    private static final Attributes.Name NAME_ATTRIBUTE = new Attributes.Name("Name"); //$NON-NLS-1$
+    private static final Attributes.Name NAME_ATTRIBUTE = new Attributes.Name(
+            "Name"); //$NON-NLS-1$
 
     private Attributes mainAttributes = new Attributes();
 
@@ -47,7 +49,8 @@
     private HashMap<String, byte[]> chunks;
 
     /**
-     * The data chunk of Main Attributes in the manifest is needed in verification.
+     * The data chunk of Main Attributes in the manifest is needed in
+     * verification.
      */
     private byte[] mainAttributesChunk;
 
@@ -61,9 +64,11 @@
     /**
      * Constructs a new Manifest instance using the attributes obtained from is.
      * 
-     * @param is InputStream to parse for attributes
+     * @param is
+     *            InputStream to parse for attributes
      * 
-     * @throws IOException if an IO error occurs while creating this Manifest
+     * @throws IOException
+     *             if an IO error occurs while creating this Manifest
      * 
      */
     public Manifest(InputStream is) throws IOException {
@@ -72,15 +77,17 @@
     }
 
     /**
-     * Constructs a new Manifest instance. The new instance will have the same attributes as
-     * those found in the parameter Manifest.
+     * Constructs a new Manifest instance. The new instance will have the same
+     * attributes as those found in the parameter Manifest.
      * 
-     * @param man Manifest instance to obtain attributes from
+     * @param man
+     *            Manifest instance to obtain attributes from
      */
     @SuppressWarnings("unchecked")
     public Manifest(Manifest man) {
         mainAttributes = (Attributes) man.mainAttributes.clone();
-        entryAttributes = (HashMap<String, Attributes>) man.entryAttributes.clone();
+        entryAttributes = (HashMap<String, Attributes>) man.entryAttributes
+                .clone();
     }
 
     Manifest(InputStream is, boolean readChunks) throws IOException {
@@ -91,8 +98,8 @@
     }
 
     /**
-     * Resets the both the mainAttributes as well as the entry Attributes associated with this
-     * Manifest.
+     * Resets the both the mainAttributes as well as the entry Attributes
+     * associated with this Manifest.
      */
     public void clear() {
         entryAttributes.clear();
@@ -102,7 +109,8 @@
     /**
      * Returns the Attributes associated with the parameter entry name
      * 
-     * @param name The name of the entry to obtain Attributes for.
+     * @param name
+     *            The name of the entry to obtain Attributes for.
      * @return The Attributes for the entry or null if the entry does not exist.
      */
     public Attributes getAttributes(String name) {
@@ -128,8 +136,8 @@
     }
 
     /**
-     * Creates a copy of this Manifest. The returned Manifest will equal the Manifest from which
-     * it was cloned.
+     * Creates a copy of this Manifest. The returned Manifest will equal the
+     * Manifest from which it was cloned.
      * 
      * @return A copy of the receiver.
      */
@@ -139,26 +147,31 @@
     }
 
     /**
-     * Writes out the attribute information of the receiver to the specified OutputStream
+     * Writes out the attribute information of the receiver to the specified
+     * OutputStream
      * 
-     * @param os The OutputStream to write to.
+     * @param os
+     *            The OutputStream to write to.
      * 
-     * @throws IOException If an error occurs writing the Manifest
+     * @throws IOException
+     *             If an error occurs writing the Manifest
      */
     public void write(OutputStream os) throws IOException {
         write(this, os);
     }
 
     /**
-     * Constructs a new Manifest instance obtaining Attribute information from the parameter
-     * InputStream.
+     * Constructs a new Manifest instance obtaining Attribute information from
+     * the parameter InputStream.
      * 
-     * @param is The InputStream to read from
-     * @throws IOException If an error occurs reading the Manifest.
+     * @param is
+     *            The InputStream to read from
+     * @throws IOException
+     *             If an error occurs reading the Manifest.
      */
     public void read(InputStream is) throws IOException {
-        InitManifest initManifest = new InitManifest(is, mainAttributes, entryAttributes,
-                chunks, null);
+        InitManifest initManifest = new InitManifest(is, mainAttributes,
+                entryAttributes, chunks, null);
         mainAttributesChunk = initManifest.getMainAttributesChunk();
     }
 
@@ -173,11 +186,14 @@
     }
 
     /**
-     * Determines if the receiver is equal to the parameter Object. Two Manifests are equal if
-     * they have identical main Attributes as well as identical entry Attributes.
-     * 
-     * @param o The Object to compare against.
-     * @return <code>true</code> if the manifests are equal, <code>false</code> otherwise
+     * Determines if the receiver is equal to the parameter Object. Two
+     * Manifests are equal if they have identical main Attributes as well as
+     * identical entry Attributes.
+     * 
+     * @param o
+     *            The Object to compare against.
+     * @return <code>true</code> if the manifests are equal,
+     *         <code>false</code> otherwise
      */
     @Override
     public boolean equals(Object o) {
@@ -206,31 +222,37 @@
     }
 
     /**
-     * Writes out the attribute information of the receiver to the specified OutputStream
+     * Writes out the attribute information of the receiver to the specified
+     * OutputStream
      * 
-     * @param manifest the attribute information of the receiver
-     * @param out The OutputStream to write to.
+     * @param manifest
+     *            the attribute information of the receiver
+     * @param out
+     *            The OutputStream to write to.
      * 
-     * @throws IOException If an error occurs writing the Manifest
+     * @throws IOException
+     *             If an error occurs writing the Manifest
      */
     static void write(Manifest manifest, OutputStream out) throws IOException {
         Charset charset = null;
-        String encoding = AccessController.doPrivileged(new PriviAction<String>(
-                "manifest.write.encoding")); //$NON-NLS-1$
+        String encoding = AccessController
+                .doPrivileged(new PriviAction<String>("manifest.write.encoding")); //$NON-NLS-1$
         if (encoding != null) {
             if (encoding.length() == 0) {
                 encoding = "UTF8"; //$NON-NLS-1$
             }
             charset = Charset.forName(encoding);
         }
-        String version = manifest.mainAttributes.getValue(Attributes.Name.MANIFEST_VERSION);
+        String version = manifest.mainAttributes
+                .getValue(Attributes.Name.MANIFEST_VERSION);
         if (version != null) {
             writeEntry(out, charset, Attributes.Name.MANIFEST_VERSION, version);
             Iterator<?> entries = manifest.mainAttributes.keySet().iterator();
             while (entries.hasNext()) {
                 Attributes.Name name = (Attributes.Name) entries.next();
                 if (!name.equals(Attributes.Name.MANIFEST_VERSION)) {
-                    writeEntry(out, charset, name, manifest.mainAttributes.getValue(name));
+                    writeEntry(out, charset, name, manifest.mainAttributes
+                            .getValue(name));
                 }
             }
         }
@@ -249,8 +271,8 @@
         }
     }
 
-    private static void writeEntry(OutputStream os, Charset charset, Attributes.Name name,
-            String value) throws IOException {
+    private static void writeEntry(OutputStream os, Charset charset,
+            Attributes.Name name, String value) throws IOException {
         int offset = 0;
         int limit = LINE_LENGTH_LIMIT;
         byte[] out = (name.toString() + ": ").getBytes("ISO8859_1"); //$NON-NLS-1$ //$NON-NLS-2$

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Pack200.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Pack200.java?view=diff&rev=556570&r1=556569&r2=556570
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Pack200.java (original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Pack200.java Mon Jul 16 02:22:19 2007
@@ -32,296 +32,296 @@
  */
 public abstract class Pack200 {
 
-	private static final String SYSTEM_PROPERTY_PACKER = "java.util.jar.Pack200.Packer"; //$NON-NLS-1$
+    private static final String SYSTEM_PROPERTY_PACKER = "java.util.jar.Pack200.Packer"; //$NON-NLS-1$
 
-	private static final String SYSTEM_PROPERTY_UNPACKER = "java.util.jar.Pack200.Unpacker"; //$NON-NLS-1$
+    private static final String SYSTEM_PROPERTY_UNPACKER = "java.util.jar.Pack200.Unpacker"; //$NON-NLS-1$
 
     /**
      * Prevent this class from being instantiated.
      */
-    private Pack200(){
-        //do nothing
+    private Pack200() {
+        // do nothing
     }
 
-	/**
-	 * The method first read from system property for the classname of a Packer,
-	 * if such property exists, the class shall be initialized; or the default
-	 * Packer will be returned
-	 * 
-	 * @return a instance of Packer
-	 */
-	public static Pack200.Packer newPacker() {
-		return (Packer) AccessController
-				.doPrivileged(new PrivilegedAction<Object>() {
-					public Object run() {
-						String className = System
-								.getProperty(SYSTEM_PROPERTY_PACKER,
-										"org.apache.harmony.archive.internal.pack200.Pack200PackerAdapter"); //$NON-NLS-1$
-						try {
-							// TODO Not sure if this will cause problems with
-							// loading the packer
-							return ClassLoader.getSystemClassLoader()
-									.loadClass(className).newInstance();
-						} catch (Exception e) {
-							throw new Error("Can't load class " + className, e);
-						}
-					}
-				});
-
-	}
-
-	/**
-	 * The method first read from system property for the classname of a
-	 * Unpacker, if such property exists, the class shall be initialized; or the
-	 * default Unpacker will be returned
-	 * 
-	 * @return a instance of Unpacker
-	 */
-	public static Pack200.Unpacker newUnpacker() {
-		return (Unpacker) AccessController
-				.doPrivileged(new PrivilegedAction<Object>() {
-					public Object run() {
-						String className = System
-								.getProperty(SYSTEM_PROPERTY_UNPACKER,
-										"org.apache.harmony.archive.internal.pack200.Pack200UnpackerAdapter");//$NON-NLS-1$
-						try {
-							return ClassLoader.getSystemClassLoader()
-									.loadClass(className).newInstance();
-						} catch (Exception e) {
-							throw new Error("Can't load class " + className, e);
-						}
-					}
-				});
-	}
-
-	/**
-	 * interface of Packer
-	 * 
-	 * @see JSR 200 specification
-	 */
-	public static interface Packer {
-
-		/**
-		 * the format of a class attribute name
-		 */
-		static final String CLASS_ATTRIBUTE_PFX = "pack.class.attribute."; //$NON-NLS-1$
-
-		/**
-		 * the format of a code attribute name
-		 */
-		static final String CODE_ATTRIBUTE_PFX = "pack.code.attribute."; //$NON-NLS-1$
-
-		/**
-		 * the deflation hint to set in the output archive
-		 */
-		static final String DEFLATE_HINT = "pack.deflate.hint";//$NON-NLS-1$
-
-		/**
-		 * the indicated amount of effort to use in compressing the archive.
-		 */
-		static final String EFFORT = "pack.effort";//$NON-NLS-1$
-
-		/**
-		 * a String of error
-		 */
-		static final String ERROR = "error";//$NON-NLS-1$
-
-		/**
-		 * a String of false
-		 */
-		static final String FALSE = "false";//$NON-NLS-1$
-
-		/**
-		 * the format of a field attribute name
-		 */
-		static final String FIELD_ATTRIBUTE_PFX = "pack.field.attribute.";//$NON-NLS-1$
-
-		/**
-		 * a String of keep
-		 */
-		static final String KEEP = "keep";//$NON-NLS-1$
-
-		/**
-		 * decide if all elements shall transmit in their original order
-		 */
-		static final String KEEP_FILE_ORDER = "pack.keep.file.order";//$NON-NLS-1$
-
-		/**
-		 * a String of latest
-		 */
-		static final String LATEST = "latest";//$NON-NLS-1$
-
-		/**
-		 * the format of a method attribute name
-		 */
-		static final String METHOD_ATTRIBUTE_PFX = "pack.method.attribute.";//$NON-NLS-1$
-
-		/**
-		 * Packer shall attempt to determine the latest modification time if
-		 * this is set to LASTEST
-		 */
-		static final String MODIFICATION_TIME = "pack.modification.time";//$NON-NLS-1$
-
-		/**
-		 * a String of pass
-		 */
-		static final String PASS = "pass";//$NON-NLS-1$
-
-		/**
-		 * the file that will not be compressed.
-		 */
-		static final String PASS_FILE_PFX = "pack.pass.file.";//$NON-NLS-1$
-
-		/**
-		 * packer progress as a percentage
-		 */
-		static final String PROGRESS = "pack.progress";//$NON-NLS-1$
-
-		/**
-		 * The number of bytes of each archive segment.
-		 */
-		static final String SEGMENT_LIMIT = "pack.segment.limit";//$NON-NLS-1$
-
-		/**
-		 * a String of strip
-		 */
-		static final String STRIP = "strip";//$NON-NLS-1$
-
-		/**
-		 * a String of true
-		 */
-		static final String TRUE = "true";//$NON-NLS-1$
-
-		/**
-		 * the action to take if an unknown attribute is encountered.
-		 */
-		static final String UNKNOWN_ATTRIBUTE = "pack.unknown.attribute";//$NON-NLS-1$
-
-		/**
-		 * 
-		 * @return the properties of packer
-		 */
-		SortedMap<String, String> properties();
-
-		/**
-		 * Pack jarfile with pack arithmetic
-		 * 
-		 * @param in
-		 *            jarfile to be compact
-		 * @param out
-		 *            stream of compact data
-		 * @throws IOException
-		 *             if I/O exception occurs
-		 */
-		void pack(JarFile in, OutputStream out) throws IOException;
-
-		/**
-		 * Pack jarStream with pack arithmetic
-		 * 
-		 * @param in
-		 *            stream of uncompact jar data
-		 * @param out
-		 *            stream of compact data
-		 * @throws IOException
-		 *             if I/O exception occurs
-		 */
-		void pack(JarInputStream in, OutputStream out) throws IOException;
-
-		/**
-		 * add a listener for PropertyChange events
-		 * 
-		 * @param listener
-		 *            the listener to listen if PropertyChange events occurs
-		 */
-		void addPropertyChangeListener(PropertyChangeListener listener);
-
-		/**
-		 * remove a listener
-		 * 
-		 * @param listener
-		 *            listener to remove
-		 */
-		void removePropertyChangeListener(PropertyChangeListener listener);
-	}
-
-	/**
-	 * interface of unpacker
-	 * 
-	 * @see JSR 200 specification
-	 */
-	public static interface Unpacker {
-
-		/**
-		 * The String indicating if the unpacker should ignore all transmitted
-		 * values,can be replaced by either true or false
-		 */
-		static final String DEFLATE_HINT = "unpack.deflate.hint";//$NON-NLS-1$
-
-		/**
-		 * a String of false
-		 */
-		static final String FALSE = "false";//$NON-NLS-1$
-
-		/**
-		 * a String of keep
-		 */
-		static final String KEEP = "keep";//$NON-NLS-1$
-
-		/**
-		 * the progress as a percentage
-		 */
-		static final String PROGRESS = "unpack.progress";//$NON-NLS-1$
-
-		/**
-		 * a String of true
-		 */
-		static final String TRUE = "true";//$NON-NLS-1$
-
-		/**
-		 * 
-		 * @return the properties of unpacker
-		 */
-		SortedMap<String, String> properties();
-
-		/**
-		 * unpack stream into jarfile with pack arithmetic
-		 * 
-		 * @param in
-		 *            stream to uncompact
-		 * @param out
-		 *            jarstream of uncompact data
-		 * @throws IOException
-		 *             if I/O exception occurs
-		 */
-		void unpack(InputStream in, JarOutputStream out) throws IOException;
-
-		/**
-		 * unpack File into jarfile with pack arithmetic
-		 * 
-		 * @param in
-		 *            file to be uncompact
-		 * @param out
-		 *            jarstream of uncompact data
-		 * @throws IOException
-		 *             if I/O exception occurs
-		 */
-		void unpack(File in, JarOutputStream out) throws IOException;
-
-		/**
-		 * add a listener for PropertyChange events
-		 * 
-		 * @param listener
-		 *            the listener to listen if PropertyChange events occurs
-		 */
-		void addPropertyChangeListener(PropertyChangeListener listener);
-
-		/**
-		 * remove a listener
-		 * 
-		 * @param listener
-		 *            listener to remove
-		 */
-		void removePropertyChangeListener(PropertyChangeListener listener);
-	}
+    /**
+     * The method first read from system property for the classname of a Packer,
+     * if such property exists, the class shall be initialized; or the default
+     * Packer will be returned
+     * 
+     * @return a instance of Packer
+     */
+    public static Pack200.Packer newPacker() {
+        return (Packer) AccessController
+                .doPrivileged(new PrivilegedAction<Object>() {
+                    public Object run() {
+                        String className = System
+                                .getProperty(SYSTEM_PROPERTY_PACKER,
+                                        "org.apache.harmony.archive.internal.pack200.Pack200PackerAdapter"); //$NON-NLS-1$
+                        try {
+                            // TODO Not sure if this will cause problems with
+                            // loading the packer
+                            return ClassLoader.getSystemClassLoader()
+                                    .loadClass(className).newInstance();
+                        } catch (Exception e) {
+                            throw new Error("Can't load class " + className, e);
+                        }
+                    }
+                });
+
+    }
+
+    /**
+     * The method first read from system property for the classname of a
+     * Unpacker, if such property exists, the class shall be initialized; or the
+     * default Unpacker will be returned
+     * 
+     * @return a instance of Unpacker
+     */
+    public static Pack200.Unpacker newUnpacker() {
+        return (Unpacker) AccessController
+                .doPrivileged(new PrivilegedAction<Object>() {
+                    public Object run() {
+                        String className = System
+                                .getProperty(SYSTEM_PROPERTY_UNPACKER,
+                                        "org.apache.harmony.archive.internal.pack200.Pack200UnpackerAdapter");//$NON-NLS-1$
+                        try {
+                            return ClassLoader.getSystemClassLoader()
+                                    .loadClass(className).newInstance();
+                        } catch (Exception e) {
+                            throw new Error("Can't load class " + className, e);
+                        }
+                    }
+                });
+    }
+
+    /**
+     * interface of Packer
+     * 
+     * @see JSR 200 specification
+     */
+    public static interface Packer {
+
+        /**
+         * the format of a class attribute name
+         */
+        static final String CLASS_ATTRIBUTE_PFX = "pack.class.attribute."; //$NON-NLS-1$
+
+        /**
+         * the format of a code attribute name
+         */
+        static final String CODE_ATTRIBUTE_PFX = "pack.code.attribute."; //$NON-NLS-1$
+
+        /**
+         * the deflation hint to set in the output archive
+         */
+        static final String DEFLATE_HINT = "pack.deflate.hint";//$NON-NLS-1$
+
+        /**
+         * the indicated amount of effort to use in compressing the archive.
+         */
+        static final String EFFORT = "pack.effort";//$NON-NLS-1$
+
+        /**
+         * a String of error
+         */
+        static final String ERROR = "error";//$NON-NLS-1$
+
+        /**
+         * a String of false
+         */
+        static final String FALSE = "false";//$NON-NLS-1$
+
+        /**
+         * the format of a field attribute name
+         */
+        static final String FIELD_ATTRIBUTE_PFX = "pack.field.attribute.";//$NON-NLS-1$
+
+        /**
+         * a String of keep
+         */
+        static final String KEEP = "keep";//$NON-NLS-1$
+
+        /**
+         * decide if all elements shall transmit in their original order
+         */
+        static final String KEEP_FILE_ORDER = "pack.keep.file.order";//$NON-NLS-1$
+
+        /**
+         * a String of latest
+         */
+        static final String LATEST = "latest";//$NON-NLS-1$
+
+        /**
+         * the format of a method attribute name
+         */
+        static final String METHOD_ATTRIBUTE_PFX = "pack.method.attribute.";//$NON-NLS-1$
+
+        /**
+         * Packer shall attempt to determine the latest modification time if
+         * this is set to LASTEST
+         */
+        static final String MODIFICATION_TIME = "pack.modification.time";//$NON-NLS-1$
+
+        /**
+         * a String of pass
+         */
+        static final String PASS = "pass";//$NON-NLS-1$
+
+        /**
+         * the file that will not be compressed.
+         */
+        static final String PASS_FILE_PFX = "pack.pass.file.";//$NON-NLS-1$
+
+        /**
+         * packer progress as a percentage
+         */
+        static final String PROGRESS = "pack.progress";//$NON-NLS-1$
+
+        /**
+         * The number of bytes of each archive segment.
+         */
+        static final String SEGMENT_LIMIT = "pack.segment.limit";//$NON-NLS-1$
+
+        /**
+         * a String of strip
+         */
+        static final String STRIP = "strip";//$NON-NLS-1$
+
+        /**
+         * a String of true
+         */
+        static final String TRUE = "true";//$NON-NLS-1$
+
+        /**
+         * the action to take if an unknown attribute is encountered.
+         */
+        static final String UNKNOWN_ATTRIBUTE = "pack.unknown.attribute";//$NON-NLS-1$
+
+        /**
+         * 
+         * @return the properties of packer
+         */
+        SortedMap<String, String> properties();
+
+        /**
+         * Pack jarfile with pack arithmetic
+         * 
+         * @param in
+         *            jarfile to be compact
+         * @param out
+         *            stream of compact data
+         * @throws IOException
+         *             if I/O exception occurs
+         */
+        void pack(JarFile in, OutputStream out) throws IOException;
+
+        /**
+         * Pack jarStream with pack arithmetic
+         * 
+         * @param in
+         *            stream of uncompact jar data
+         * @param out
+         *            stream of compact data
+         * @throws IOException
+         *             if I/O exception occurs
+         */
+        void pack(JarInputStream in, OutputStream out) throws IOException;
+
+        /**
+         * add a listener for PropertyChange events
+         * 
+         * @param listener
+         *            the listener to listen if PropertyChange events occurs
+         */
+        void addPropertyChangeListener(PropertyChangeListener listener);
+
+        /**
+         * remove a listener
+         * 
+         * @param listener
+         *            listener to remove
+         */
+        void removePropertyChangeListener(PropertyChangeListener listener);
+    }
+
+    /**
+     * interface of unpacker
+     * 
+     * @see JSR 200 specification
+     */
+    public static interface Unpacker {
+
+        /**
+         * The String indicating if the unpacker should ignore all transmitted
+         * values,can be replaced by either true or false
+         */
+        static final String DEFLATE_HINT = "unpack.deflate.hint";//$NON-NLS-1$
+
+        /**
+         * a String of false
+         */
+        static final String FALSE = "false";//$NON-NLS-1$
+
+        /**
+         * a String of keep
+         */
+        static final String KEEP = "keep";//$NON-NLS-1$
+
+        /**
+         * the progress as a percentage
+         */
+        static final String PROGRESS = "unpack.progress";//$NON-NLS-1$
+
+        /**
+         * a String of true
+         */
+        static final String TRUE = "true";//$NON-NLS-1$
+
+        /**
+         * 
+         * @return the properties of unpacker
+         */
+        SortedMap<String, String> properties();
+
+        /**
+         * unpack stream into jarfile with pack arithmetic
+         * 
+         * @param in
+         *            stream to uncompact
+         * @param out
+         *            jarstream of uncompact data
+         * @throws IOException
+         *             if I/O exception occurs
+         */
+        void unpack(InputStream in, JarOutputStream out) throws IOException;
+
+        /**
+         * unpack File into jarfile with pack arithmetic
+         * 
+         * @param in
+         *            file to be uncompact
+         * @param out
+         *            jarstream of uncompact data
+         * @throws IOException
+         *             if I/O exception occurs
+         */
+        void unpack(File in, JarOutputStream out) throws IOException;
+
+        /**
+         * add a listener for PropertyChange events
+         * 
+         * @param listener
+         *            the listener to listen if PropertyChange events occurs
+         */
+        void addPropertyChangeListener(PropertyChangeListener listener);
+
+        /**
+         * remove a listener
+         * 
+         * @param listener
+         *            listener to remove
+         */
+        void removePropertyChangeListener(PropertyChangeListener listener);
+    }
 
 }

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Adler32.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Adler32.java?view=diff&rev=556570&r1=556569&r2=556570
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Adler32.java (original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Adler32.java Mon Jul 16 02:22:19 2007
@@ -17,72 +17,71 @@
 
 package java.util.zip;
 
-
 /**
  * The Adler32 class is used to compute the Adler32 Checksum from a set of data.
  */
 public class Adler32 implements java.util.zip.Checksum {
 
-	private long adler = 1;
+    private long adler = 1;
 
-	/**
-	 * Returns the Adler32 checksum for all input received
-	 * 
-	 * @return The checksum for this instance
-	 */
-	public long getValue() {
-		return adler;
-	}
-
-	/**
-	 * Reset this instance to its initial checksum
-	 */
-	public void reset() {
-		adler = 1;
-	}
-
-	/**
-	 * Update this Adler32 checksum using val.
-	 * 
-	 * @param i
-	 *            byte to update checksum with
-	 */
-	public void update(int i) {
-		adler = updateByteImpl(i, adler);
-	}
-
-	/**
-	 * Update this Adler32 checksum using the contents of buf.
-	 * 
-	 * @param buf
-	 *            bytes to update checksum with
-	 */
-	public void update(byte[] buf) {
-		update(buf, 0, buf.length);
-	}
-
-	/**
-	 * Update this Adler32 checksum with the contents of buf, starting from
-	 * offset and using nbytes of data.
-	 * 
-	 * @param buf
-	 *            buffer to obtain dat from
-	 * @param off
-	 *            offset i buf to copy from
-	 * @param nbytes
-	 *            number of bytes from buf to use
-	 */
-	public void update(byte[] buf, int off, int nbytes) {
-		// avoid int overflow, check null buf
-		if (off <= buf.length && nbytes >= 0 && off >= 0
-				&& buf.length - off >= nbytes) {
+    /**
+     * Returns the Adler32 checksum for all input received
+     * 
+     * @return The checksum for this instance
+     */
+    public long getValue() {
+        return adler;
+    }
+
+    /**
+     * Reset this instance to its initial checksum
+     */
+    public void reset() {
+        adler = 1;
+    }
+
+    /**
+     * Update this Adler32 checksum using val.
+     * 
+     * @param i
+     *            byte to update checksum with
+     */
+    public void update(int i) {
+        adler = updateByteImpl(i, adler);
+    }
+
+    /**
+     * Update this Adler32 checksum using the contents of buf.
+     * 
+     * @param buf
+     *            bytes to update checksum with
+     */
+    public void update(byte[] buf) {
+        update(buf, 0, buf.length);
+    }
+
+    /**
+     * Update this Adler32 checksum with the contents of buf, starting from
+     * offset and using nbytes of data.
+     * 
+     * @param buf
+     *            buffer to obtain dat from
+     * @param off
+     *            offset i buf to copy from
+     * @param nbytes
+     *            number of bytes from buf to use
+     */
+    public void update(byte[] buf, int off, int nbytes) {
+        // avoid int overflow, check null buf
+        if (off <= buf.length && nbytes >= 0 && off >= 0
+                && buf.length - off >= nbytes) {
             adler = updateImpl(buf, off, nbytes, adler);
         } else {
             throw new ArrayIndexOutOfBoundsException();
         }
-	}
+    }
 
-	private native long updateImpl(byte[] buf, int off, int nbytes, long adler1);
+    private native long updateImpl(byte[] buf, int off, int nbytes, long adler1);
 
-	private native long updateByteImpl(int val, long adler1);
+    private native long updateByteImpl(int val, long adler1);
 }

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/CRC32.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/CRC32.java?view=diff&rev=556570&r1=556569&r2=556570
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/CRC32.java (original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/CRC32.java Mon Jul 16 02:22:19 2007
@@ -17,73 +17,72 @@
 
 package java.util.zip;
 
-
 /**
  * The CRC32 class is used to compute a CRC32 Checksum from a set of data.
  */
 public class CRC32 implements java.util.zip.Checksum {
 
-	private long crc = 0L;
+    private long crc = 0L;
 
-	long tbytes = 0L;
+    long tbytes = 0L;
 
-	/**
-	 * Returns the CRC32 Checksum for all input received.
-	 * 
-	 * @return The checksum for this instance
-	 */
-	public long getValue() {
-		return crc;
-	}
-
-	/**
-	 * Returns the CRC32 checksum to it initial state.
-	 */
-	public void reset() {
-		tbytes = crc = 0;
-
-	}
-
-	/**
-	 * Updates this Checksum with value val
-	 */
-	public void update(int val) {
-		crc = updateByteImpl((byte) val, crc);
-	}
-
-	/**
-	 * Updates this Checksum with the bytes contained in buffer buf.
-	 * 
-	 * @param buf
-	 *            Buffer to update Checksum
-	 */
-	public void update(byte[] buf) {
-		update(buf, 0, buf.length);
-	}
-
-	/**
-	 * Updates this Checksum with nbytes of data from buffer buf, starting at
-	 * offset off.
-	 * 
-	 * @param buf
-	 *            Buffer to update Checksum
-	 * @param off
-	 *            Offset in buf to obtain data from
-	 * @param nbytes
-	 *            Number of bytes to read from buf
-	 */
-	public void update(byte[] buf, int off, int nbytes) {
-		// avoid int overflow, check null buf
-		if (off <= buf.length && nbytes >= 0 && off >= 0
-				&& buf.length - off >= nbytes) {
-			tbytes += nbytes;
-			crc = updateImpl(buf, off, nbytes, crc);
-		} else {
+    /**
+     * Returns the CRC32 Checksum for all input received.
+     * 
+     * @return The checksum for this instance
+     */
+    public long getValue() {
+        return crc;
+    }
+
+    /**
+     * Returns the CRC32 checksum to it initial state.
+     */
+    public void reset() {
+        tbytes = crc = 0;
+
+    }
+
+    /**
+     * Updates this Checksum with value val
+     */
+    public void update(int val) {
+        crc = updateByteImpl((byte) val, crc);
+    }
+
+    /**
+     * Updates this Checksum with the bytes contained in buffer buf.
+     * 
+     * @param buf
+     *            Buffer to update Checksum
+     */
+    public void update(byte[] buf) {
+        update(buf, 0, buf.length);
+    }
+
+    /**
+     * Updates this Checksum with nbytes of data from buffer buf, starting at
+     * offset off.
+     * 
+     * @param buf
+     *            Buffer to update Checksum
+     * @param off
+     *            Offset in buf to obtain data from
+     * @param nbytes
+     *            Number of bytes to read from buf
+     */
+    public void update(byte[] buf, int off, int nbytes) {
+        // avoid int overflow, check null buf
+        if (off <= buf.length && nbytes >= 0 && off >= 0
+                && buf.length - off >= nbytes) {
+            tbytes += nbytes;
+            crc = updateImpl(buf, off, nbytes, crc);
+        } else {
             throw new ArrayIndexOutOfBoundsException();
         }
-	}
+    }
 
-	private native long updateImpl(byte[] buf, int off, int nbytes, long crc1);
+    private native long updateImpl(byte[] buf, int off, int nbytes, long crc1);
 
-	private native long updateByteImpl(byte val, long crc1);
+    private native long updateByteImpl(byte val, long crc1);
 }

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/CheckedInputStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/CheckedInputStream.java?view=diff&rev=556570&r1=556569&r2=556570
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/CheckedInputStream.java (original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/CheckedInputStream.java Mon Jul 16 02:22:19 2007
@@ -17,7 +17,6 @@
 
 package java.util.zip;
 
-
 import java.io.IOException;
 import java.io.InputStream;
 
@@ -27,86 +26,86 @@
  */
 public class CheckedInputStream extends java.io.FilterInputStream {
 
-	private final Checksum check;
+    private final Checksum check;
 
-	/**
-	 * Constructs a new CheckedInputStream on InputStream is. The Checksum will
-	 * be calculated using the algorithm implemented by csum.
-	 * 
-	 * @param is
-	 *            InputStream to calculate checksum from
-	 * @param csum
-	 *            Type of Checksum to calculate
-	 */
-	public CheckedInputStream(InputStream is, Checksum csum) {
-		super(is);
-		check = csum;
-	}
-
-	/**
-	 * Reads a byte of data from the underlying stream and recomputes the
-	 * Checksum with the byte data.
-	 * 
-	 * @return -1 if end of stream, a single byte value otherwise
-	 */
-	@Override
+    /**
+     * Constructs a new CheckedInputStream on InputStream is. The Checksum will
+     * be calculated using the algorithm implemented by csum.
+     * 
+     * @param is
+     *            InputStream to calculate checksum from
+     * @param csum
+     *            Type of Checksum to calculate
+     */
+    public CheckedInputStream(InputStream is, Checksum csum) {
+        super(is);
+        check = csum;
+    }
+
+    /**
+     * Reads a byte of data from the underlying stream and recomputes the
+     * Checksum with the byte data.
+     * 
+     * @return -1 if end of stream, a single byte value otherwise
+     */
+    @Override
     public int read() throws IOException {
-		int x = in.read();
-		if (x != -1) {
-			check.update(x);
-		}
-		return x;
-	}
-
-	/**
-	 * Reads up to nbytes of data from the underlying stream, storing it in buf,
-	 * starting at offset off. The Checksum is updated with the bytes read.
-	 * 
-	 * @return Number of bytes read, -1 if end of stream
-	 */
-	@Override
+        int x = in.read();
+        if (x != -1) {
+            check.update(x);
+        }
+        return x;
+    }
+
+    /**
+     * Reads up to nbytes of data from the underlying stream, storing it in buf,
+     * starting at offset off. The Checksum is updated with the bytes read.
+     * 
+     * @return Number of bytes read, -1 if end of stream
+     */
+    @Override
     public int read(byte[] buf, int off, int nbytes) throws IOException {
-		int x = in.read(buf, off, nbytes);
-		if (x != -1) {
+        int x = in.read(buf, off, nbytes);
+        if (x != -1) {
             check.update(buf, off, x);
         }
-		return x;
-	}
+        return x;
+    }
 
-	/**
-	 * Returns the Checksum calculated on the stream thus far.
-	 * 
-	 * @return A java.util.zip.Checksum
-	 */
-	public Checksum getChecksum() {
-		return check;
-	}
-
-	/**
-	 * Skip upto nbytes of data on the underlying stream. Any skipped bytes are
-	 * added to the running Checksum value.
-	 * 
-	 * @param nbytes
-	 *            long Number of bytes to skip
-	 * @return Number of bytes skipped
-	 */
-	@Override
+    /**
+     * Returns the Checksum calculated on the stream thus far.
+     * 
+     * @return A java.util.zip.Checksum
+     */
+    public Checksum getChecksum() {
+        return check;
+    }
+
+    /**
+     * Skip upto nbytes of data on the underlying stream. Any skipped bytes are
+     * added to the running Checksum value.
+     * 
+     * @param nbytes
+     *            long Number of bytes to skip
+     * @return Number of bytes skipped
+     */
+    @Override
     public long skip(long nbytes) throws IOException {
-		if (nbytes < 1) {
-			return 0;
-		}
-		long skipped = 0;
-		byte[] b = new byte[2048];
-		int x, v;
-		while (skipped != nbytes) {
-			x = in.read(b, 0,
-					(v = (int) (nbytes - skipped)) > b.length ? b.length : v);
-			if (x == -1) {
-				return skipped;
-			}
-			check.update(b, 0, x);
-			skipped += x;
-		}
-		return skipped;
-	}
+        if (nbytes < 1) {
+            return 0;
+        }
+        long skipped = 0;
+        byte[] b = new byte[2048];
+        int x, v;
+        while (skipped != nbytes) {
+            x = in.read(b, 0,
+                    (v = (int) (nbytes - skipped)) > b.length ? b.length : v);
+            if (x == -1) {
+                return skipped;
+            }
+            check.update(b, 0, x);
+            skipped += x;
+        }
+        return skipped;
+    }
 }

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/CheckedOutputStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/CheckedOutputStream.java?view=diff&rev=556570&r1=556569&r2=556570
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/CheckedOutputStream.java (original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/CheckedOutputStream.java Mon Jul 16 02:22:19 2007
@@ -17,7 +17,6 @@
 
 package java.util.zip;
 
-
 import java.io.IOException;
 import java.io.OutputStream;
 
@@ -27,64 +26,64 @@
  */
 public class CheckedOutputStream extends java.io.FilterOutputStream {
 
-	private final Checksum check;
+    private final Checksum check;
 
-	/**
-	 * Constructs a new CheckedOutputStream on OutputStream os. The Checksum
-	 * will be calculated using the algorithm implemented by csum.
-	 * 
-	 * @param os
-	 *            OutputStream to calculate checksum from
-	 * @param cs
-	 *            Type of Checksum to calculate
-	 */
-	public CheckedOutputStream(OutputStream os, Checksum cs) {
-		super(os);
-		check = cs;
-	}
-
-	/**
-	 * Returns the Checksum calculated on the stream thus far.
-	 * 
-	 * @return A java.util.zip.Checksum
-	 */
-	public Checksum getChecksum() {
-		return check;
-	}
-
-	/**
-	 * Writes byte value val to the underlying stream. The Checksum is updated
-	 * with val.
-	 * 
-	 * @param val
-	 *            Value of the byte to write out
-	 * 
-	 * @throws IOException
-	 *             if an IO error has occured
-	 */
-	@Override
+    /**
+     * Constructs a new CheckedOutputStream on OutputStream os. The Checksum
+     * will be calculated using the algorithm implemented by csum.
+     * 
+     * @param os
+     *            OutputStream to calculate checksum from
+     * @param cs
+     *            Type of Checksum to calculate
+     */
+    public CheckedOutputStream(OutputStream os, Checksum cs) {
+        super(os);
+        check = cs;
+    }
+
+    /**
+     * Returns the Checksum calculated on the stream thus far.
+     * 
+     * @return A java.util.zip.Checksum
+     */
+    public Checksum getChecksum() {
+        return check;
+    }
+
+    /**
+     * Writes byte value val to the underlying stream. The Checksum is updated
+     * with val.
+     * 
+     * @param val
+     *            Value of the byte to write out
+     * 
+     * @throws IOException
+     *             if an IO error has occured
+     */
+    @Override
     public void write(int val) throws IOException {
-		out.write(val);
-		check.update(val);
-	}
-
-	/**
-	 * Writes nbytes of data from buf starting at offset off to the underlying
-	 * stream. The Checksum is updated with the bytes written.
-	 * 
-	 * @param buf
-	 *            data to write out
-	 * @param off
-	 *            the start offset of the data
-	 * @param nbytes
-	 *            number of bytes to write out
-	 * 
-	 * @throws IOException
-	 *             if an IO error has occured
-	 */
-	@Override
+        out.write(val);
+        check.update(val);
+    }
+
+    /**
+     * Writes nbytes of data from buf starting at offset off to the underlying
+     * stream. The Checksum is updated with the bytes written.
+     * 
+     * @param buf
+     *            data to write out
+     * @param off
+     *            the start offset of the data
+     * @param nbytes
+     *            number of bytes to write out
+     * 
+     * @throws IOException
+     *             if an IO error has occured
+     */
+    @Override
     public void write(byte[] buf, int off, int nbytes) throws IOException {
-		out.write(buf, off, nbytes);
-		check.update(buf, off, nbytes);
-	}
+        out.write(buf, off, nbytes);
+        check.update(buf, off, nbytes);
+    }
 }

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Checksum.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Checksum.java?view=diff&rev=556570&r1=556569&r2=556570
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Checksum.java (original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Checksum.java Mon Jul 16 02:22:19 2007
@@ -17,13 +17,12 @@
 
 package java.util.zip;
 
-
 public interface Checksum {
-	public long getValue();
+    public long getValue();
 
-	public void reset();
+    public void reset();
 
-	public void update(int val);
+    public void update(int val);
 
-	public void update(byte[] buf, int off, int nbytes);
+    public void update(byte[] buf, int off, int nbytes);
 }

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Deflater.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Deflater.java?view=diff&rev=556570&r1=556569&r2=556570
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Deflater.java (original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Deflater.java Mon Jul 16 02:22:19 2007
@@ -26,52 +26,53 @@
  */
 public class Deflater {
 
-	public static final int BEST_COMPRESSION = 9;
+    public static final int BEST_COMPRESSION = 9;
 
-	public static final int BEST_SPEED = 1;
+    public static final int BEST_SPEED = 1;
 
-	public static final int DEFAULT_COMPRESSION = -1;
+    public static final int DEFAULT_COMPRESSION = -1;
 
-	public static final int DEFAULT_STRATEGY = 0;
+    public static final int DEFAULT_STRATEGY = 0;
 
-	public static final int DEFLATED = 8;
+    public static final int DEFLATED = 8;
 
-	public static final int FILTERED = 1;
+    public static final int FILTERED = 1;
 
-	public static final int HUFFMAN_ONLY = 2;
+    public static final int HUFFMAN_ONLY = 2;
 
-	public static final int NO_COMPRESSION = 0;
+    public static final int NO_COMPRESSION = 0;
 
-	private static final int Z_NO_FLUSH = 0;
+    private static final int Z_NO_FLUSH = 0;
+
+    private static final int Z_FINISH = 4;
 
-	private static final int Z_FINISH = 4;
-    
     // Fill in the JNI id caches
     private static native void oneTimeInitialization();
-    
-    // A stub buffer used when deflate() called while inputBuffer has not been set.
+
+    // A stub buffer used when deflate() called while inputBuffer has not been
+    // set.
     private static final byte[] STUB_INPUT_BUFFER = new byte[0];
 
     static {
         oneTimeInitialization();
     }
 
-	private int flushParm = Z_NO_FLUSH;
+    private int flushParm = Z_NO_FLUSH;
 
-	private boolean finished;
+    private boolean finished;
 
-	private int compressLevel = DEFAULT_COMPRESSION;
+    private int compressLevel = DEFAULT_COMPRESSION;
 
-	private int strategy = DEFAULT_STRATEGY;
+    private int strategy = DEFAULT_STRATEGY;
 
-	private long streamHandle = -1;
+    private long streamHandle = -1;
 
-	private byte[] inputBuffer;
+    private byte[] inputBuffer;
+
+    private int inRead;
 
-	private int inRead;
-    
     private int inLength;
-    
+
     /**
      * Constructs a new Deflater instance with default compression level and
      * strategy.
@@ -79,7 +80,7 @@
     public Deflater() {
         this(DEFAULT_COMPRESSION, false);
     }
-    
+
     /**
      * Constructs a new Deflater instance with compression level level and
      * default compression strategy. THe compression level provided must be
@@ -112,35 +113,35 @@
         streamHandle = createStream(compressLevel, strategy, noHeader);
     }
 
-	/**
-	 * Deflates data into the supplied buffer
-	 * 
-	 * @param buf
-	 *            buffer to store compressed data
-	 * 
-	 * @return number of bytes of compressed data stored
-	 * 
-	 */
-	public int deflate(byte[] buf) {
-		return deflate(buf, 0, buf.length);
-	}
-
-	/**
-	 * Deflates data into the supplied buffer using the region from off to
-	 * nbytes - 1.
-	 * 
-	 * @param buf
-	 *            buffer to store compressed data
-	 * @param off
-	 *            offset inf buf to start storing data
-	 * @param nbytes
-	 *            number of bytes of compressed data to store in buf
-	 * 
-	 * @return number of bytes of compressed data stored
-	 * 
-	 */
-	public synchronized int deflate(byte[] buf, int off, int nbytes) {
-		if (streamHandle == -1) {
+    /**
+     * Deflates data into the supplied buffer
+     * 
+     * @param buf
+     *            buffer to store compressed data
+     * 
+     * @return number of bytes of compressed data stored
+     * 
+     */
+    public int deflate(byte[] buf) {
+        return deflate(buf, 0, buf.length);
+    }
+
+    /**
+     * Deflates data into the supplied buffer using the region from off to
+     * nbytes - 1.
+     * 
+     * @param buf
+     *            buffer to store compressed data
+     * @param off
+     *            offset inf buf to start storing data
+     * @param nbytes
+     *            number of bytes of compressed data to store in buf
+     * 
+     * @return number of bytes of compressed data stored
+     * 
+     */
+    public synchronized int deflate(byte[] buf, int off, int nbytes) {
+        if (streamHandle == -1) {
             throw new IllegalStateException();
         }
         // avoid int overflow, check null buf
@@ -152,276 +153,276 @@
             }
             return deflateImpl(buf, off, nbytes, streamHandle, flushParm);
         }
-		throw new ArrayIndexOutOfBoundsException();
-	}
+        throw new ArrayIndexOutOfBoundsException();
+    }
 
-	private synchronized native int deflateImpl(byte[] buf, int off,
-			int nbytes, long handle, int flushParm1);
+    private synchronized native int deflateImpl(byte[] buf, int off,
+            int nbytes, long handle, int flushParm1);
 
-	private synchronized native void endImpl(long handle);
+    private synchronized native void endImpl(long handle);
 
-	/**
-	 * Frees all resources held onto by this Deflater. Any unused input or output
-	 * is discarded. This is also called from the finalize method.
-	 * 
-	 * @see #finalize
-	 */
-	public synchronized void end() {
-		if (streamHandle != -1) {
-			endImpl(streamHandle);
-			inputBuffer = null;
-			streamHandle = -1;
-		}
-	}
+    /**
+     * Frees all resources held onto by this Deflater. Any unused input or
+     * output is discarded. This is also called from the finalize method.
+     * 
+     * @see #finalize
+     */
+    public synchronized void end() {
+        if (streamHandle != -1) {
+            endImpl(streamHandle);
+            inputBuffer = null;
+            streamHandle = -1;
+        }
+    }
 
-	@Override
+    @Override
     protected void finalize() {
-		end();
-	}
+        end();
+    }
 
-	/**
-	 * Indicates to the Deflater that all uncompressed input has been provided
-	 * to it.
-	 * 
-	 * @see #finished
-	 */
-	public synchronized void finish() {
-		flushParm = Z_FINISH;
-	}
-
-	/**
-	 * Returns whether or not all provided data has been successfully
-	 * compressed.
-	 * 
-	 * @return true if all data has been compressed, false otherwise
-	 */
-	public synchronized boolean finished() {
-		return finished;
-	}
-
-	/**
-	 * Returns the Adler32 checksum of uncompressed data currently read. If a
-	 * preset dictionary is used getAdler() will return the Adler32 checksum of
-	 * the dictionary used.
-	 * 
-	 * @return The Adler32 checksum of uncompressed data or preset dictionary if
-	 *         used
-	 * 
-	 * @see #setDictionary(byte[])
-	 * @see #setDictionary(byte[], int, int)
-	 */
-	public synchronized int getAdler() {
-		if (streamHandle == -1) {
+    /**
+     * Indicates to the Deflater that all uncompressed input has been provided
+     * to it.
+     * 
+     * @see #finished
+     */
+    public synchronized void finish() {
+        flushParm = Z_FINISH;
+    }
+
+    /**
+     * Returns whether or not all provided data has been successfully
+     * compressed.
+     * 
+     * @return true if all data has been compressed, false otherwise
+     */
+    public synchronized boolean finished() {
+        return finished;
+    }
+
+    /**
+     * Returns the Adler32 checksum of uncompressed data currently read. If a
+     * preset dictionary is used getAdler() will return the Adler32 checksum of
+     * the dictionary used.
+     * 
+     * @return The Adler32 checksum of uncompressed data or preset dictionary if
+     *         used
+     * 
+     * @see #setDictionary(byte[])
+     * @see #setDictionary(byte[], int, int)
+     */
+    public synchronized int getAdler() {
+        if (streamHandle == -1) {
             throw new IllegalStateException();
         }
 
-		return getAdlerImpl(streamHandle);
-	}
+        return getAdlerImpl(streamHandle);
+    }
 
-	private synchronized native int getAdlerImpl(long handle);
+    private synchronized native int getAdlerImpl(long handle);
 
-	/**
-	 * Returns the total number of bytes of input consumed by the deflater.
-	 * 
-	 * @return number of bytes of input read.
-	 */
-	public synchronized int getTotalIn() {
-		if (streamHandle == -1) {
+    /**
+     * Returns the total number of bytes of input consumed by the deflater.
+     * 
+     * @return number of bytes of input read.
+     */
+    public synchronized int getTotalIn() {
+        if (streamHandle == -1) {
             throw new IllegalStateException();
         }
 
-		return (int)getTotalInImpl(streamHandle);
-	}
+        return (int) getTotalInImpl(streamHandle);
+    }
 
-	private synchronized native long getTotalInImpl(long handle);
+    private synchronized native long getTotalInImpl(long handle);
 
-	/**
-	 * Returns the total number of compressed bytes output by this Deflater.
-	 * 
-	 * @return number of compressed bytes output.
-	 */
-	public synchronized int getTotalOut() {
-		if (streamHandle == -1) {
+    /**
+     * Returns the total number of compressed bytes output by this Deflater.
+     * 
+     * @return number of compressed bytes output.
+     */
+    public synchronized int getTotalOut() {
+        if (streamHandle == -1) {
             throw new IllegalStateException();
         }
 
-		return (int)getTotalOutImpl(streamHandle);
-	}
+        return (int) getTotalOutImpl(streamHandle);
+    }
 
-	private synchronized native long getTotalOutImpl(long handle);
+    private synchronized native long getTotalOutImpl(long handle);
 
-	/**
-	 * Indicates whether or not all bytes of uncompressed input have been
-	 * consumed by the Deflater. If needsInput() answers true setInput() must be
-	 * called before deflation can continue. If all bytes of uncompressed data
-	 * have been provided to the Deflater finish() must be called to ensure the
-	 * compressed data is output.
-	 * 
-	 * @return True if input is required for deflation to continue, false
-	 *         otherwise
-	 * @see #finished()
-	 * @see #setInput(byte[])
-	 * @see #setInput(byte[], int, int)
-	 */
-	public synchronized boolean needsInput() {
-		if (inputBuffer == null) {
+    /**
+     * Indicates whether or not all bytes of uncompressed input have been
+     * consumed by the Deflater. If needsInput() answers true setInput() must be
+     * called before deflation can continue. If all bytes of uncompressed data
+     * have been provided to the Deflater finish() must be called to ensure the
+     * compressed data is output.
+     * 
+     * @return True if input is required for deflation to continue, false
+     *         otherwise
+     * @see #finished()
+     * @see #setInput(byte[])
+     * @see #setInput(byte[], int, int)
+     */
+    public synchronized boolean needsInput() {
+        if (inputBuffer == null) {
             return true;
         }
-		return inRead == inLength;
-	}
+        return inRead == inLength;
+    }
 
-	/**
-	 * Resets the <code>Deflater</code> to accept new input without affecting
-	 * any previously made settings for the compression strategy or level. This
-	 * operation <i>must</i> be called after <code>finished()</code> returns
-	 * <code>true</code> if the <code>Deflater</code> is to be reused.
-	 * 
-	 * @see #finished
-	 */
-	public synchronized void reset() {
-		if (streamHandle == -1) {
+    /**
+     * Resets the <code>Deflater</code> to accept new input without affecting
+     * any previously made settings for the compression strategy or level. This
+     * operation <i>must</i> be called after <code>finished()</code> returns
+     * <code>true</code> if the <code>Deflater</code> is to be reused.
+     * 
+     * @see #finished
+     */
+    public synchronized void reset() {
+        if (streamHandle == -1) {
             throw new NullPointerException();
         }
 
-		flushParm = Z_NO_FLUSH;
-		finished = false;
-		resetImpl(streamHandle);
-		inputBuffer = null;
-	}
-
-	private synchronized native void resetImpl(long handle);
-
-	public void setDictionary(byte[] buf) {
-		setDictionary(buf, 0, buf.length);
-	}
-
-	/**
-	 * Sets the dictionary to be used for compression by this Deflater.
-	 * setDictionary() can only be called if this Deflater supports the writing
-	 * of ZLIB headers. This is the default behaviour but can be overridden
-	 * using Deflater(int, boolean).
-	 * 
-	 * @see Deflater#Deflater(int, boolean)
-	 */
-	public synchronized void setDictionary(byte[] buf, int off, int nbytes) {
-		if (streamHandle == -1) {
+        flushParm = Z_NO_FLUSH;
+        finished = false;
+        resetImpl(streamHandle);
+        inputBuffer = null;
+    }
+
+    private synchronized native void resetImpl(long handle);
+
+    public void setDictionary(byte[] buf) {
+        setDictionary(buf, 0, buf.length);
+    }
+
+    /**
+     * Sets the dictionary to be used for compression by this Deflater.
+     * setDictionary() can only be called if this Deflater supports the writing
+     * of ZLIB headers. This is the default behaviour but can be overridden
+     * using Deflater(int, boolean).
+     * 
+     * @see Deflater#Deflater(int, boolean)
+     */
+    public synchronized void setDictionary(byte[] buf, int off, int nbytes) {
+        if (streamHandle == -1) {
             throw new IllegalStateException();
         }
-		// avoid int overflow, check null buf
-		if (off <= buf.length && nbytes >= 0 && off >= 0
-				&& buf.length - off >= nbytes) {
+        // avoid int overflow, check null buf
+        if (off <= buf.length && nbytes >= 0 && off >= 0
+                && buf.length - off >= nbytes) {
             setDictionaryImpl(buf, off, nbytes, streamHandle);
         } else {
             throw new ArrayIndexOutOfBoundsException();
         }
-	}
+    }
 
-	private synchronized native void setDictionaryImpl(byte[] buf, int off,
-			int nbytes, long handle);
+    private synchronized native void setDictionaryImpl(byte[] buf, int off,
+            int nbytes, long handle);
 
-	/**
-	 * Sets the input buffer the Deflater will use to extract uncompressed bytes
-	 * for later compression.
-	 */
-	public void setInput(byte[] buf) {
-		setInput(buf, 0, buf.length);
-	}
-
-	/**
-	 * Sets the input buffer the Deflater will use to extract uncompressed bytes
-	 * for later compression. Input will be taken from the buffer region
-	 * starting at off and ending at nbytes - 1.
-	 */
-	public synchronized void setInput(byte[] buf, int off, int nbytes) {
-		if (streamHandle == -1) {
+    /**
+     * Sets the input buffer the Deflater will use to extract uncompressed bytes
+     * for later compression.
+     */
+    public void setInput(byte[] buf) {
+        setInput(buf, 0, buf.length);
+    }
+
+    /**
+     * Sets the input buffer the Deflater will use to extract uncompressed bytes
+     * for later compression. Input will be taken from the buffer region
+     * starting at off and ending at nbytes - 1.
+     */
+    public synchronized void setInput(byte[] buf, int off, int nbytes) {
+        if (streamHandle == -1) {
             throw new IllegalStateException();
         }
-		// avoid int overflow, check null buf
-		if (off <= buf.length && nbytes >= 0 && off >= 0
-				&& buf.length - off >= nbytes) {
-			inLength = nbytes;
-			inRead = 0;
-			if (inputBuffer == null) {
+        // avoid int overflow, check null buf
+        if (off <= buf.length && nbytes >= 0 && off >= 0
+                && buf.length - off >= nbytes) {
+            inLength = nbytes;
+            inRead = 0;
+            if (inputBuffer == null) {
                 setLevelsImpl(compressLevel, strategy, streamHandle);
             }
-			inputBuffer = buf;
-			setInputImpl(buf, off, nbytes, streamHandle);
-		} else {
+            inputBuffer = buf;
+            setInputImpl(buf, off, nbytes, streamHandle);
+        } else {
             throw new ArrayIndexOutOfBoundsException();
         }
-	}
+    }
 
-	private synchronized native void setLevelsImpl(int level, int strategy,
-			long handle);
+    private synchronized native void setLevelsImpl(int level, int strategy,
+            long handle);
 
-	private synchronized native void setInputImpl(byte[] buf, int off,
-			int nbytes, long handle);
+    private synchronized native void setInputImpl(byte[] buf, int off,
+            int nbytes, long handle);
 
-	/**
-	 * Sets the compression level to be used when compressing data. The
-	 * compression level must be a value between 0 and 9. This value must be set
-	 * prior to calling setInput().
-	 * 
-	 * @param level
-	 *            compression level to use
-	 * @exception IllegalArgumentException
-	 *                If the compression level is invalid.
-	 */
-	public synchronized void setLevel(int level) {
-		if (level < DEFAULT_COMPRESSION || level > BEST_COMPRESSION) {
+    /**
+     * Sets the compression level to be used when compressing data. The
+     * compression level must be a value between 0 and 9. This value must be set
+     * prior to calling setInput().
+     * 
+     * @param level
+     *            compression level to use
+     * @exception IllegalArgumentException
+     *                If the compression level is invalid.
+     */
+    public synchronized void setLevel(int level) {
+        if (level < DEFAULT_COMPRESSION || level > BEST_COMPRESSION) {
             throw new IllegalArgumentException();
         }
-		if (inputBuffer != null) {
+        if (inputBuffer != null) {
             throw new IllegalStateException();
         }
-		compressLevel = level;
-	}
+        compressLevel = level;
+    }
 
-	/**
-	 * Sets the compression strategy to be used. The strategy must be one of
-	 * FILTERED, HUFFMAN_ONLY or DEFAULT_STRATEGY.This value must be set prior
-	 * to calling setInput().
-	 * 
-	 * @param strategy
-	 *            compression strategy to use
-	 * @exception IllegalArgumentException
-	 *                If the strategy specified is not one of FILTERED,
-	 *                HUFFMAN_ONLY or DEFAULT_STRATEGY.
-	 */
-	public synchronized void setStrategy(int strategy) {
-		if (strategy < DEFAULT_STRATEGY || strategy > HUFFMAN_ONLY) {
+    /**
+     * Sets the compression strategy to be used. The strategy must be one of
+     * FILTERED, HUFFMAN_ONLY or DEFAULT_STRATEGY.This value must be set prior
+     * to calling setInput().
+     * 
+     * @param strategy
+     *            compression strategy to use
+     * @exception IllegalArgumentException
+     *                If the strategy specified is not one of FILTERED,
+     *                HUFFMAN_ONLY or DEFAULT_STRATEGY.
+     */
+    public synchronized void setStrategy(int strategy) {
+        if (strategy < DEFAULT_STRATEGY || strategy > HUFFMAN_ONLY) {
             throw new IllegalArgumentException();
         }
-		if (inputBuffer != null) {
+        if (inputBuffer != null) {
             throw new IllegalStateException();
         }
-		this.strategy = strategy;
-	}
-	
-    /**
-	 * Returns a long int of total number of bytes read by the Deflater. This
-	 * method performs the same as getTotalIn except it returns a long value
-	 * instead of an integer
-	 * 
-	 * @see getTotalIn
-	 * @return bytes exactly read by deflater
-	 */
-	public synchronized long getBytesRead() {
-		// Throw NPE here
-		if (streamHandle == -1) {
+        this.strategy = strategy;
+    }
+
+    /**
+     * Returns a long int of total number of bytes read by the Deflater. This
+     * method performs the same as getTotalIn except it returns a long value
+     * instead of an integer
+     * 
+     * @see getTotalIn
+     * @return bytes exactly read by deflater
+     */
+    public synchronized long getBytesRead() {
+        // Throw NPE here
+        if (streamHandle == -1) {
             throw new NullPointerException();
         }
-		return getTotalInImpl(streamHandle);
-	}
+        return getTotalInImpl(streamHandle);
+    }
 
-	/**
-	 * Returns a long int of total number of bytes of read by the Deflater. This
-	 * method performs the same as getTotalOut except it returns a long value
-	 * instead of an integer
-	 * 
-	 * @see getTotalOut
-	 * @return bytes exactly write by deflater
-	 */
+    /**
+     * Returns a long int of total number of bytes of read by the Deflater. This
+     * method performs the same as getTotalOut except it returns a long value
+     * instead of an integer
+     * 
+     * @see getTotalOut
+     * @return bytes exactly write by deflater
+     */
     public synchronized long getBytesWritten() {
         // Throw NPE here
         if (streamHandle == -1) {
@@ -430,5 +431,5 @@
         return getTotalOutImpl(streamHandle);
     }
 
-	private native long createStream(int level, int strategy1, boolean noHeader1);
+    private native long createStream(int level, int strategy1, boolean noHeader1);
 }



Mime
View raw message