|
TrueZIP Kernel 7.0-rc2 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.schlichtherle.truezip.entry.EntryName
@Immutable @DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class) public class EntryName
Addresses an entry in an entry container.
An entry name is usually constructed from a
Uniform Resource Identifier in order to assert the following
additional syntax constraints:
Examples for valid entry name URIs are:
/foo
foo/bar
foo
foo#bar
foo/
foo/.
foo/..
../foo
foo:/bar (not relative)
//foo/bar (authority defined)
Although this class is declared to be immutable, it's not declared to be final solely in order to enable subclassing for the purpose of adding even more constraints in the sub class constructor while still being able to use references to this base class polymorphically.
This class supports serialization with both
ObjectOutputStream and XMLEncoder.
Entry.getName(),
Serialized Form| Field Summary | |
|---|---|
static String |
SEPARATOR
The separator string for file names in an entry name, which is "/". |
static char |
SEPARATOR_CHAR
The separator character for file names in an entry name, which is 47. |
private static long |
serialVersionUID
|
private URI |
uri
|
| Constructor Summary | |
|---|---|
EntryName(EntryName parent,
EntryName member)
Constructs a new entry name by resolving the given member entry name against the given parent entry name. |
|
EntryName(String uri)
Constructs a new entry name by calling new URI(uri) and parsing the resulting URI. |
|
EntryName(URI uri)
Constructs a new entry name by parsing the given URI. |
|
| Method Summary | |
|---|---|
int |
compareTo(EntryName that)
Implements a natural ordering which is consistent with equals(Object). |
static EntryName |
create(String uri)
Constructs a new entry name by constructing a new URI from the given string representation and parsing the result. |
static EntryName |
create(URI uri)
Constructs a new entry name by parsing the given URI. |
boolean |
equals(Object that)
Returns true iff the given object is a entry name
and its URI equals the URI of this entry name. |
String |
getPath()
Returns the path of this entry name. |
String |
getQuery()
Returns the query of this entry name. |
URI |
getUri()
Returns the URI of this entry name. |
int |
hashCode()
Returns a hash code which is consistent with equals(Object). |
private boolean |
invariants()
|
private void |
parse(URI uri)
|
private static String |
quote(Object s)
|
private void |
readObject(ObjectInputStream in)
|
String |
toString()
Equivalent to calling URI.toString() on getUri(). |
private void |
writeObject(ObjectOutputStream out)
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final long serialVersionUID
public static final String SEPARATOR
SEPARATOR_CHAR,
Constant Field Valuespublic static final char SEPARATOR_CHAR
SEPARATOR,
Constant Field Valuesprivate URI uri
| Constructor Detail |
|---|
public EntryName(String uri)
throws URISyntaxException
new URI(uri) and parsing the resulting URI.
uri - the URI string representation.
URISyntaxException - if uri does not conform to the
syntax constraints for entry names.
public EntryName(URI uri)
throws URISyntaxException
uri - the URI.
URISyntaxException - if uri does not conform to the
syntax constraints for entry names.
public EntryName(EntryName parent,
EntryName member)
SEPARATOR_CHAR, so calling this constructor with
"foo" and "bar" as the URIs for the parent and member
entry names respectively will result in the URI
"foo/bar" for the resulting entry name.
parent - an entry name for the parent.member - an entry name for the member.| Method Detail |
|---|
public static EntryName create(String uri)
new EntryName(uri)
and wraps any thrown URISyntaxException in an
IllegalArgumentException.
uri - the URI string representation.
IllegalArgumentException - if uri does not conform to the
syntax constraints for entry names.public static EntryName create(URI uri)
new EntryName(uri)
and wraps any thrown URISyntaxException in an
IllegalArgumentException.
uri - the URI.
IllegalArgumentException - if uri does not conform to the
syntax constraints for entry names.
private void writeObject(ObjectOutputStream out)
throws IOException
IOException
private void readObject(ObjectInputStream in)
throws IOException,
ClassNotFoundException
IOException
ClassNotFoundException
private void parse(URI uri)
throws URISyntaxException
URISyntaxExceptionprivate static String quote(Object s)
private boolean invariants()
public final String getPath()
getUri().getPath().
@CheckForNull public final String getQuery()
getUri().getQuery().
public final URI getUri()
public final boolean equals(@CheckForNull
Object that)
true iff the given object is a entry name
and its URI equals the URI of this entry name.
equals in class Objectpublic final int compareTo(EntryName that)
equals(Object).
compareTo in interface Comparable<EntryName>public final int hashCode()
equals(Object).
hashCode in class Objectpublic final String toString()
URI.toString() on getUri().
toString in class Object
|
TrueZIP Kernel 7.0-rc2 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||