@Immutable 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
.
TODO: This class is solely used for extension by the class
de.schlichtherle.truezip.fs.FsEntryName
and should be removed in
TrueZIP 8.
Entry.getName()
,
Serialized FormModifier 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.
|
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) . |
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) . |
String |
toString()
Equivalent to calling
URI.toString() on toUri() . |
URI |
toUri()
Returns the URI for this entry name.
|
public static final String SEPARATOR
SEPARATOR_CHAR
,
Constant Field Valuespublic static final char SEPARATOR_CHAR
SEPARATOR
,
Constant Field Valuespublic 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 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)
.public final String toString()
URI.toString()
on toUri()
.public final URI toUri()
Copyright © 2005–2018 Schlichtherle IT Services. All rights reserved.