@Immutable @DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class) public class EntryName extends Object implements Serializable, Comparable<EntryName>
An entry name adds the following syntax constraints to a
Uniform Resource Identifier:
Examples for valid entry name URIs are:
uri property |
path property |
query property |
|---|---|---|
foo |
foo |
(null) |
foo/bar |
foo/bar |
(null) |
foo?bar |
foo |
bar |
../foo/./ |
../foo/./ |
(null) |
Examples for invalid entry name URIs are:
| URI | Issue |
|---|---|
foo:/bar |
scheme component defined |
//foo/bar |
authority component defined |
foo#bar |
fragment component defined |
For any entry name e, it's generally true that
new EntryName(e.toUri()).equals(e).
This class supports serialization with both
ObjectOutputStream and XMLEncoder.
Entry.getName(),
Serialized Form| Modifier and Type | Field and Description |
|---|---|
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 and Description |
|---|
EntryName(EntryName parent,
EntryName member)
Constructs a new entry name by resolving the given member
entry name against the given parent entry name.
|
EntryName(URI uri)
Constructs a new entry name by parsing the given URI.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(EntryName that)
Implements a natural ordering which is consistent with
equals(Object). |
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 |
getFragment()
Returns the fragment of this entry name.
|
String |
getPath()
Returns the path of this entry name.
|
String |
getQuery()
Returns the query 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 void |
readObject(ObjectInputStream in) |
String |
toString()
Equivalent to calling
URI.toString() on toUri(). |
URI |
toUri()
Returns the URI for this entry name.
|
private void |
writeObject(ObjectOutputStream out) |
public static final String SEPARATOR
SEPARATOR_CHAR,
Constant Field Valuespublic static final char SEPARATOR_CHAR
SEPARATOR,
Constant Field Valuesprivate static final long serialVersionUID
private URI uri
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 will produce the URI foo/bar for the resulting
entry name.parent - an entry name for the parent.member - an entry name for the member.public EntryName(URI uri) throws URISyntaxException
uri - the URI.URISyntaxException - if uri does not conform to the
syntax constraints for entry names.public final int compareTo(EntryName that)
equals(Object).compareTo in interface Comparable<EntryName>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.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.@CheckForNull public final String getFragment()
toUri().getFragment().public final String getPath()
toUri().getPath().@CheckForNull public final String getQuery()
toUri().getQuery().public final int hashCode()
equals(Object).private boolean invariants()
private void parse(URI uri) throws URISyntaxException
URISyntaxExceptionprivate void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic final String toString()
URI.toString() on toUri().public final URI toUri()
private void writeObject(ObjectOutputStream out) throws IOException
IOExceptionCopyright © 2004-2011 Schlichtherle IT Services. All Rights Reserved.