public class ArchiveEntry
extends java.lang.Object
implements java.lang.Comparable
Archive
.
The primary consumer of the data encapsulated by this class is the
Archive
class. Archive
interprets instances
of ArchiveEntry
as archiving instructions -- the content at
the specified ArchiveEntry.url
is archived into the zip/jar
file as ArchiveEntry.entryName
.Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
entryName |
protected java.net.URL |
url |
Constructor and Description |
---|
ArchiveEntry(java.lang.String entryName,
java.net.URL url)
Create an immutable ArchiveEntry for use in an Archive.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(java.lang.Object o)
Only the entry name is used in the comparison.
|
boolean |
equals(java.lang.Object o)
For hashing purposes, two instances of
ArchiveEntry are
equal if their entry names are equal. |
java.lang.String |
getName()
Get the name for the Archive entry.
|
java.net.URL |
getURL()
Get the URL for the entry.
|
int |
hashCode()
Only the entry name is used for hashing; the URL is ignored.
|
java.lang.String |
toString()
This simply returns the
entryName . |
protected final java.lang.String entryName
protected final java.net.URL url
public ArchiveEntry(java.lang.String entryName, java.net.URL url)
entryName
- The entry name of the file as it should appear in the zip/jar
file. Note that forward slashes ("/") should be used as the
file separator character within the entry name.url
- The URL
of the content being represented by this
ArchiveEntry
. This can be null
if the
content URL
could not be located.public java.lang.String getName()
public java.net.URL getURL()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
ArchiveEntry
are
equal if their entry names are equal. Note that this does not
necessarily mean that they point to identical content, since the
URLs do not affect the value returned by equals()
.
The reason for this implementation of equals()
is
that multiple ArchiveEntry
instances added to the same
java.util.Set
will replace each other if their entry
name is the same.equals
in class java.lang.Object
public java.lang.String toString()
entryName
. This makes it
very convenient to use ArchiveEntry
in a variety of
UI widgets that provide a default presentation based on the
toString()
method.toString
in class java.lang.Object
public int compareTo(java.lang.Object o)
equals()
.compareTo
in interface java.lang.Comparable