Extension SDK 10.1.2

oracle.ide.net
Class JarUtil

java.lang.Object
  extended byoracle.ide.net.JarUtil

public final class JarUtil
extends java.lang.Object


Method Summary
static java.lang.String getClassPath(java.io.File jarFile)
          Returns the value of the Class-Path attribute in the manifest file of the specified JAR file.
static java.lang.String getClassPath(java.net.URL jarURL)
          Returns the value of the Class-Path attribute in the manifest file of the specified JAR URL.
static java.lang.String getJarEntry(java.net.URL jarURL)
          Returns the jar entry name within the specified jar URL.
static java.net.URL getJarFileURL(java.net.URL jarURL)
          Returns the jar file part of the specified jar URL.
static JarIndex getJarIndex(java.net.URL jarURL)
          Returns the JarIndex object that represents an index of the contents of the specified jar file.
static java.lang.String getMainClass(java.io.File jarFile)
          Returns the value of the Main-Class attribute in the manifest file of the specified JAR file.
static java.lang.String getMainClass(java.net.URL jarURL)
          Returns the value of the Main-Class attribute in the manifest file of the specified JAR URL.
static boolean isArchive(java.lang.String pathname)
          Determine if a given URL represents an jar or zip file.
static boolean isJarURL(java.net.URL jarURL)
          Returns true if the specified URL has the "jar" protocol.
static void releaseJarIndex(java.net.URL jarURL)
          Releases the in-memory jar index corresponding to the specified URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getJarEntry

public static java.lang.String getJarEntry(java.net.URL jarURL)
Returns the jar entry name within the specified jar URL. If the jar URL specifies no entry, then the empty string is returned. If the URL is not a jar URL, then null is returned.


getJarFileURL

public static java.net.URL getJarFileURL(java.net.URL jarURL)
Returns the jar file part of the specified jar URL. The specified URL is returned if it is not a jar URL.


getMainClass

public static java.lang.String getMainClass(java.io.File jarFile)
                                     throws java.io.IOException
Returns the value of the Main-Class attribute in the manifest file of the specified JAR file.

Throws:
java.io.IOException

getMainClass

public static java.lang.String getMainClass(java.net.URL jarURL)
                                     throws java.io.IOException
Returns the value of the Main-Class attribute in the manifest file of the specified JAR URL.

Throws:
java.io.IOException

getClassPath

public static java.lang.String getClassPath(java.io.File jarFile)
                                     throws java.io.IOException
Returns the value of the Class-Path attribute in the manifest file of the specified JAR file.

Throws:
java.io.IOException

getClassPath

public static java.lang.String getClassPath(java.net.URL jarURL)
                                     throws java.io.IOException
Returns the value of the Class-Path attribute in the manifest file of the specified JAR URL.

Throws:
java.io.IOException

isJarURL

public static boolean isJarURL(java.net.URL jarURL)
Returns true if the specified URL has the "jar" protocol. Returns false if the specified URL is null or has a protocol other than "jar".


getJarIndex

public static JarIndex getJarIndex(java.net.URL jarURL)
                            throws java.io.IOException
Returns the JarIndex object that represents an index of the contents of the specified jar file. If the jar file does not exist or if the URL points to content that is not a a jar file, then null is returned.

This method caches its results, so that if an index is requested for the same URL more than once, the previously calculated JarIndex is returned. However, as an implementation detail, this method may use an algorithm for removing cached indexes that have not been accessed recently in order to conserve memory. The details of that algorithm, if one is implemented, are not publically documented. If a previously cached index is removed and is subsequently requested later, it is simply rebuilt.

Parameters:
jarURL - This is the URL of the jar file. If this URL has the "jar" protocol, then the jar file part of the jar URL is extracted and indexed. Otherwise, the URL is assumed to point to a jar/zip file, and that file is indexed.
Throws:
java.io.IOException

releaseJarIndex

public static void releaseJarIndex(java.net.URL jarURL)
Releases the in-memory jar index corresponding to the specified URL. The URL may point to the jar file itself or it may be a jar URL pointing to an entry within a jar. If the URL is null, this method has no effect.


isArchive

public static boolean isArchive(java.lang.String pathname)
Determine if a given URL represents an jar or zip file. The method does a simple check to determine if the pathname ends with .jar or .zip.


Extension SDK

 

Copyright © 1997, 2004, Oracle. All rights reserved.