|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.6.0) E13403-07 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object oracle.ide.net.JarIndex
public final class JarIndex
Indexes the table of contents of a JAR or ZIP file.
It is important to understand that the return values of all the methods of
this class are a reflection of the state of the JAR index at the moment the
method was called. If the JAR file subsequently changes on disk, the return
value of any previous calls may no longer be accurate. In particular, this
means that the return values of multiple calls are not guaranteed to be
consistent, because the JAR file may have changed in between the calls.
The only way to obtain consistent results for multiple JAR entries is with
the visit(oracle.ide.net.JarIndex.Visitor)
method. This method holds an open file handle while
iterating the JAR entries, preventing any external modification of the JAR
while the entries are being visited.
Nested Class Summary | |
---|---|
static interface |
JarIndex.Visitor
Visits entries in this index. |
Method Summary | |
---|---|
int |
dirEntryIndex(java.lang.String entryName)
Deprecated. Use isDirectory(String) to determine if an entry is
a directory, or visit(Visitor) to iterate the index entries.
The index returned by this method may become invalid if the JAR file
changes on disk. |
int |
entryIndex(java.lang.String entryName)
Deprecated. Use visit(Visitor) to iterate the index entries.
The index returned by this method may become invalid if the JAR file
changes on disk. |
boolean |
exists(java.lang.String entryName)
Checks for the existance of an entry with the given name. |
static void |
flushCache()
|
byte[] |
getBytes(java.lang.String entryName)
Returns a byte array with the uncompressed data corresponding to entryName . |
java.lang.String[] |
getEntries()
Fetch a list of all entry names. |
JarIndexEntry |
getEntryAt(int i)
Deprecated. Use visit(Visitor) to iterate the index entries.
The index passed to this method may be invalid if the JAR file has changed
on disk. |
java.lang.String |
getEntryNameAt(int i)
Deprecated. Use visit(Visitor) to iterate the index entries.
The index passed to this method may be invalid if the JAR file has changed
on disk. |
static JarIndex |
getInstance(java.net.URL jarFileURL)
Get a JarIndex instance. |
int |
getNumEntries()
Deprecated. Use visit(Visitor) to iterate the index entries,
or isEmpty() to determine if the JAR index is empty. The number
of entries returned by this method may become invalid if the JAR file
changes on disk, so any operations assuming this value is correct may
fail. |
int |
getSize(java.lang.String entryName)
Returns the uncompressed size of the specified entry. |
long |
getTimestamp()
Get the timestamp of the index. |
long |
getTimestamp(java.lang.String entryName)
Get the timestamp of a JAR entry. |
boolean |
isDirectory(java.lang.String entryName)
Determines whether an entry exists and is a direcory. |
boolean |
isEmpty()
Determines whether this JAR index is currently empty. |
java.lang.String[] |
list(java.lang.String dirEntryName)
|
java.io.InputStream |
openInputStream(java.lang.String entryName)
Opens an input stream for the specified entryName . |
static void |
uncache(java.net.URL jarFileURL)
Remove any cached index for a JAR file. |
void |
visit(JarIndex.Visitor visitor)
Visit the entries in this index. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static JarIndex getInstance(java.net.URL jarFileURL)
JarIndex
instance.
jarFileURL
- the URL of the JAR file
public static void uncache(java.net.URL jarFileURL)
jarFileURL
- the URL of the JAR Filepublic void visit(JarIndex.Visitor visitor) throws java.io.IOException
visitor
- the visitor
java.io.IOException
- if the JAR cannot be readpublic boolean isEmpty()
true
if the JAR index is empty, false
otherwise@Deprecated public int dirEntryIndex(java.lang.String entryName)
isDirectory(String)
to determine if an entry is
a directory, or visit(Visitor)
to iterate the index entries.
The index returned by this method may become invalid if the JAR file
changes on disk.
@Deprecated public int entryIndex(java.lang.String entryName)
visit(Visitor)
to iterate the index entries.
The index returned by this method may become invalid if the JAR file
changes on disk.
@Deprecated public int getNumEntries()
visit(Visitor)
to iterate the index entries,
or isEmpty()
to determine if the JAR index is empty. The number
of entries returned by this method may become invalid if the JAR file
changes on disk, so any operations assuming this value is correct may
fail.
@Deprecated public JarIndexEntry getEntryAt(int i)
visit(Visitor)
to iterate the index entries.
The index passed to this method may be invalid if the JAR file has changed
on disk.
java.lang.IndexOutOfBoundsException
- if the specified index is
less than 0 or greater than or equal to the number of indexed
entries.@Deprecated public java.lang.String getEntryNameAt(int i)
visit(Visitor)
to iterate the index entries.
The index passed to this method may be invalid if the JAR file has changed
on disk.
java.lang.IndexOutOfBoundsException
- if the specified index is
less than 0 or greater than or equal to the number of indexed
entries.public java.lang.String[] getEntries()
public int getSize(java.lang.String entryName)
public java.lang.String[] list(java.lang.String dirEntryName)
public java.io.InputStream openInputStream(java.lang.String entryName) throws java.io.IOException
entryName
.
The input stream will contain uncompressed data.
java.io.IOException
public boolean exists(java.lang.String entryName)
entryName
- the name of the entry
true
if the entry exists in this JAR file,
false
otherwisepublic boolean isDirectory(java.lang.String entryName)
entryName
- the name of the JAR entry
true
if the entry exists and is a directory,
false
otherwisepublic static void flushCache()
public byte[] getBytes(java.lang.String entryName) throws java.io.IOException
entryName
.
java.io.IOException
public long getTimestamp(java.lang.String entryName)
entryName
- the name of the JAR entry
public long getTimestamp()
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.6.0) E13403-07 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |