@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 |
fragment property |
|---|---|---|---|
foo |
foo |
(null) | (null) |
foo/bar |
foo/bar |
(null) | (null) |
foo?bar |
foo |
bar |
(null) |
foo#bar |
foo |
(null) | bar |
../foo/./#bar |
../foo/./ |
(null) | bar |
Examples for invalid entry name URIs are:
| URI | Issue |
|---|---|
foo:/bar |
not a relative URI |
//foo/bar |
authority 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(String uri)
Deprecated.
This constructor does not quote characters with a special
meaning in a URI - use the constructor variant with the URI
parameter instead.
|
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(String uri)
Deprecated.
This method does not quote characters with a special meaning
in a URI - use the method variant with the URI parameter
instead.
|
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.
|
URI |
getUri()
Deprecated.
|
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 toUri(). |
URI |
toUri()
Returns the URI for this entry name.
|
private void |
writeObject(ObjectOutputStream out) |
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
@Deprecated 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 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.@Deprecated 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
IOExceptionprivate void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionprivate void parse(URI uri) throws URISyntaxException
URISyntaxExceptionprivate boolean invariants()
public final URI toUri()
public final String getPath()
toUri().getPath().@CheckForNull public final String getQuery()
toUri().getQuery().@CheckForNull public final String getFragment()
toUri().getFragment().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.public final int compareTo(EntryName that)
equals(Object).compareTo in interface Comparable<EntryName>public final int hashCode()
equals(Object).public final String toString()
URI.toString() on toUri().Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.