|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK 11g Release 2 (11.1.2.3.0) E17493-04 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.ide.net.JarUtil
public final class JarUtil
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.util.List<java.net.URL> |
getClassPathURLs(java.net.URL jarURL) Utility method to return the Class-Path attribute from the JAR manifest as a list of URLs. |
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 JarIndex |
getJarIndex(java.net.URL jarURL, boolean full) Deprecated. use #getJarIndex(URL) |
static ReadWriteLock |
getLock(java.net.URL url) Get the lock used to synchronize access to a JAR file across multiple threads in the calling process. |
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 java.util.jar.Manifest |
getManifest(java.io.File jarFile) Returns the manifest of the specified JAR file. |
static java.util.jar.Manifest |
getManifest(java.net.URL jarURL) Returns the manifest 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 |
---|
public static java.lang.String getJarEntry(java.net.URL jarURL)
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.public static java.net.URL getJarFileURL(java.net.URL jarURL)
URL
. The specified URL
is returned if it is not a jar URL
.public static java.util.jar.Manifest getManifest(java.net.URL jarURL) throws java.io.IOException
java.io.IOException
public static java.util.jar.Manifest getManifest(java.io.File jarFile) throws java.io.IOException
java.io.IOException
public static java.lang.String getMainClass(java.io.File jarFile) throws java.io.IOException
Main-Class
attribute in the manifest file of the specified JAR file.java.io.IOException
public static java.lang.String getMainClass(java.net.URL jarURL) throws java.io.IOException
Main-Class
attribute in the manifest file of the specified JAR URL.java.io.IOException
public static java.lang.String getClassPath(java.io.File jarFile) throws java.io.IOException
Class-Path
attribute in the manifest file of the specified JAR file.java.io.IOException
public static java.lang.String getClassPath(java.net.URL jarURL) throws java.io.IOException
Class-Path
attribute in the manifest file of the specified JAR URL.java.io.IOException
public static java.util.List<java.net.URL> getClassPathURLs(java.net.URL jarURL) throws java.io.IOException
Class-Path
attribute from the JAR manifest as a list of URLs. Relative path entries are assumed to be relative to the location of the JAR file. URLs are not checked for existence or cyclic references (path entries pointing back to the JAR itself). URLs on the classpath may themselves be JAR URLs, and those JARs may themselves have classpaths. Those classpaths are not included in the classpath returned by this method.jarURL
- the JAR filejava.io.IOException
- if the JAR manifest could not be readpublic static boolean isJarURL(java.net.URL jarURL)
true
if the specified URL
has the "jar" protocol. Returns false
if the specified URL
is null
or has a protocol other than "jar". Alas, Websphere uses "wsjar" as an alias for "jar" protocol.public static JarIndex getJarIndex(java.net.URL jarURL) throws java.io.IOException
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.
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.java.io.IOException
@Deprecated
public static JarIndex getJarIndex(java.net.URL jarURL,
boolean full)
throws java.io.IOException
full
parameter indicates whether a full index is built initially. A full index takes much longer to create. If the caller just needs to check for the existance of entries in the JAR, or open input streams for entries, then a full index is not necessary. A full index is necessary for other operations, such as listing all entries in the JAR or within a directory in the JAR.jarURL
- the URL of the JAR filefull
- whether to build a full indexjava.io.IOException
- if the JAR file could not be readpublic static void releaseJarIndex(java.net.URL jarURL)
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.public static boolean isArchive(java.lang.String pathname)
public static ReadWriteLock getLock(java.net.URL url)
JarIndex
and URLFileSystem
, but it may be necessary to acquire this lock manually in cases where the JAR file is read or written without going through those APIs. For example, using the JarFile
class to read or write a JAR file would require manually acquiring this lock.
The caller must hold a strong reference to the lock while it is locked. This is necessary because locks are weakly cached.
Note that the locking mechanism provided by this method is different than native file system locking (such as that provided by FileLock
), which synchronizes access to a file across different processes, but does not synchronize access to the file across threads in the same process.
url
- the URL of the JAR file or an entry in the JAR file
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK 11g Release 2 (11.1.2.3.0) E17493-04 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |