[jboss-cvs] JBossAS SVN: r59474 - projects/vfs/trunk/src/main/java/org/jboss/virtual.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Jan 10 06:25:01 EST 2007


Author: alesj
Date: 2007-01-10 06:24:56 -0500 (Wed, 10 Jan 2007)
New Revision: 59474

Modified:
   projects/vfs/trunk/src/main/java/org/jboss/virtual/VFSUtils.java
Log:
added readManifest method

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/VFSUtils.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/VFSUtils.java	2007-01-10 11:16:39 UTC (rev 59473)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/VFSUtils.java	2007-01-10 11:24:56 UTC (rev 59474)
@@ -21,27 +21,21 @@
 */
 package org.jboss.virtual;
 
+import org.jboss.logging.Logger;
+import org.jboss.util.StringPropertyReplacer;
+import org.jboss.virtual.spi.LinkInfo;
+
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.StringTokenizer;
+import java.util.*;
 import java.util.jar.Attributes;
 import java.util.jar.JarFile;
 import java.util.jar.Manifest;
 
-import org.jboss.logging.Logger;
-import org.jboss.util.StringPropertyReplacer;
-import org.jboss.virtual.spi.LinkInfo;
-
 /**
  * VFS Utilities
  * 
@@ -184,7 +178,18 @@
          log.debug("Can't find manifest for " + archive.getPathName());
          return null;
       }
+      return readManifest(manifest);
+   }
 
+   /**
+    * Read the manifest from given manifest VirtualFile.
+    *
+    * @param manifest the VF to read from
+    * @return JAR's manifest
+    * @throws IOException if problems while opening VF stream occur
+    */
+   public static Manifest readManifest(VirtualFile manifest) throws IOException
+   {
       InputStream stream = manifest.openStream();
       try
       {
@@ -201,21 +206,21 @@
          }
       }
    }
-   
+
    /**
-    * Get a manifest from a virtual file system,
-    * assuming the root of the VFS is the root of an archive
-    * 
-    * @param archive the vfs
-    * @return the manifest or null if not found
-    * @throws IOException if there is an error reading the manifest
-    * @throws IllegalArgumentException for a null archive
-    */
-   public static Manifest getManifest(VFS archive) throws IOException
-   {
-      VirtualFile root = archive.getRoot();
-      return getManifest(root);
-   }
+     * Get a manifest from a virtual file system,
+     * assuming the root of the VFS is the root of an archive
+     *
+     * @param archive the vfs
+     * @return the manifest or null if not found
+     * @throws IOException if there is an error reading the manifest
+     * @throws IllegalArgumentException for a null archive
+     */
+    public static Manifest getManifest(VFS archive) throws IOException
+    {
+       VirtualFile root = archive.getRoot();
+       return getManifest(root);
+    }
    
    /**
     * Fix a name (removes any trailing slash)




More information about the jboss-cvs-commits mailing list