@Immutable @DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class) public class EntryName extends java.lang.Object implements java.io.Serializable, java.lang.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 java.lang.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 java.net.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(java.lang.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(java.net.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(java.lang.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(java.net.URI uri)
Constructs a new entry name by parsing the given URI.
|
boolean |
equals(java.lang.Object that)
Returns
true iff the given object is a entry name
and its URI equals the URI of this entry name. |
java.lang.String |
getFragment()
Returns the fragment of this entry name.
|
java.lang.String |
getPath()
Returns the path of this entry name.
|
java.lang.String |
getQuery()
Returns the query of this entry name.
|
java.net.URI |
getUri()
Deprecated.
|
int |
hashCode()
Returns a hash code which is consistent with
equals(Object). |
private boolean |
invariants() |
private void |
parse(java.net.URI uri) |
private void |
readObject(java.io.ObjectInputStream in) |
java.lang.String |
toString()
Equivalent to calling
URI.toString() on toUri(). |
java.net.URI |
toUri()
Returns the URI for this entry name.
|
private void |
writeObject(java.io.ObjectOutputStream out) |
private static final long serialVersionUID
public static final java.lang.String SEPARATOR
SEPARATOR_CHAR,
Constant Field Valuespublic static final char SEPARATOR_CHAR
SEPARATOR,
Constant Field Valuesprivate java.net.URI uri
@Deprecated
public EntryName(java.lang.String uri)
throws java.net.URISyntaxException
new URI(uri) and parsing the resulting URI.uri - the URI string representation.java.net.URISyntaxException - if uri does not conform to the
syntax constraints for entry names.public EntryName(java.net.URI uri)
throws java.net.URISyntaxException
uri - the URI.java.net.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(java.lang.String uri)
new EntryName(uri)
and wraps any thrown URISyntaxException in an
IllegalArgumentException.uri - the URI string representation.java.lang.IllegalArgumentException - if uri does not conform to the
syntax constraints for entry names.public static EntryName create(java.net.URI uri)
new EntryName(uri)
and wraps any thrown URISyntaxException in an
IllegalArgumentException.uri - the URI.java.lang.IllegalArgumentException - if uri does not conform to the
syntax constraints for entry names.private void writeObject(java.io.ObjectOutputStream out)
throws java.io.IOException
java.io.IOExceptionprivate void readObject(java.io.ObjectInputStream in)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOExceptionjava.lang.ClassNotFoundExceptionprivate void parse(java.net.URI uri)
throws java.net.URISyntaxException
java.net.URISyntaxExceptionprivate boolean invariants()
public final java.net.URI toUri()
@Deprecated public final java.net.URI getUri()
toUri()public final java.lang.String getPath()
toUri().getPath().@CheckForNull public final java.lang.String getQuery()
toUri().getQuery().@CheckForNull public final java.lang.String getFragment()
toUri().getFragment().public final boolean equals(@CheckForNull
java.lang.Object that)
true iff the given object is a entry name
and its URI equals the URI of this entry name.equals in class java.lang.Objectpublic final int compareTo(EntryName that)
equals(Object).compareTo in interface java.lang.Comparable<EntryName>public final int hashCode()
equals(Object).hashCode in class java.lang.Objectpublic final java.lang.String toString()
URI.toString() on toUri().toString in class java.lang.ObjectCopyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.