@Immutable public final class FsNodeName extends Object implements Serializable, Comparable<FsNodeName>
mount point
.
An node name adds the following syntax constraints to a
Uniform Resource Identifier
:
"."
and ".."
segments.
"."
.
".."
.
"/"
.
"./"
(this rule is actually redundant - see #3).
"../"
.
"/"
.
Examples for valid node name URIs:
uri property |
root property |
path property |
query property |
---|---|---|---|
"" |
true |
"" |
null |
"foo" |
false |
"foo" |
null |
"foo/bar" |
false |
"foo/bar" |
null |
"foo?bar" |
false |
"foo" |
"bar" |
Examples for invalid node name URIs:
URI | Issue |
---|---|
foo:/bar |
not a relative URI |
//foo/bar |
authority component defined |
/foo |
leading slash not allowed |
foo/ |
trailing slash not allowed |
foo/. |
not a normalized URI |
foo#bar |
fragment defined |
For any node name e
, it's generally true that
new FsNodeName(e.getUri()).equals(e)
.
This class supports serialization with both
ObjectOutputStream
and XMLEncoder
.
FsNodePath
,
FsMountPoint
,
FsScheme
,
FsNode.getName()
,
Serialized FormModifier and Type | Field and Description |
---|---|
static FsNodeName |
ROOT
The file system node name of the root directory,
which is an empty URI.
|
static String |
SEPARATOR
The separator string for file names in an node name,
which is "/".
|
static char |
SEPARATOR_CHAR
The separator character for file names in an node name,
which is 47.
|
Constructor and Description |
---|
FsNodeName(FsNodeName parent,
FsNodeName member)
Constructs a new file system node name by resolving the given member
file system node name against the given parent file system node name.
|
FsNodeName(URI uri)
Constructs a new file system node name by parsing the given URI.
|
FsNodeName(URI uri,
FsUriModifier modifier)
Constructs a new file system node name by parsing the given URI
after applying the given URI modifier.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(FsNodeName that)
Implements a natural ordering which is consistent with
equals(Object) . |
static FsNodeName |
create(URI uri)
Constructs a new file system node name by parsing the given URI.
|
static FsNodeName |
create(URI uri,
FsUriModifier modifier)
Constructs a new file system node name by parsing the given URI
after applying the given URI modifier.
|
boolean |
equals(Object that)
Returns
true iff the given object is a node name
and its URI equals the URI of this node name. |
String |
getPath()
Returns the path component of this node name.
|
String |
getQuery()
Returns the query component of this node name.
|
URI |
getUri()
Returns the URI for this node name.
|
int |
hashCode()
Returns a hash code which is consistent with
equals(Object) . |
boolean |
isRoot()
Returns
true if and only if the path component of this file
system node name is empty and no query component is defined. |
String |
toString()
Equivalent to calling
URI.toString() on getUri() . |
public static final FsNodeName ROOT
public static final String SEPARATOR
SEPARATOR_CHAR
,
Constant Field Valuespublic static final char SEPARATOR_CHAR
SEPARATOR
,
Constant Field Valuespublic FsNodeName(FsNodeName parent, FsNodeName member)
"foo"
and "bar"
as the URIs for the parent and member
file system node names results in "foo/bar"
as the file system
node name URI.parent
- an node name for the parent.member
- an node name for the member.@ConstructorProperties(value="uri") public FsNodeName(URI uri) throws URISyntaxException
uri
- the URI
.NullPointerException
- if uri
is null
.URISyntaxException
- if uri
does not conform to the
syntax constraints for file system node names.public FsNodeName(URI uri, FsUriModifier modifier) throws URISyntaxException
uri
- the URI
.modifier
- the URI modifier.NullPointerException
- if uri
or modifier
are
null
.URISyntaxException
- if uri
still does not conform to the
syntax constraints for file system node names after its
modification.public int compareTo(FsNodeName that)
equals(Object)
.compareTo
in interface Comparable<FsNodeName>
that
- the node name to compare.public static FsNodeName create(URI uri)
new FsNodeName(uri, FsUriModifier.NULL)
and wraps any thrown URISyntaxException
in an
IllegalArgumentException
.uri
- the URI
.NullPointerException
- if uri
is null
.IllegalArgumentException
- if uri
does not conform to the
syntax constraints for file system node names.public static FsNodeName create(URI uri, FsUriModifier modifier)
new FsNodeName(uri, modifier)
and wraps any thrown URISyntaxException
in an
IllegalArgumentException
.uri
- the URI
.modifier
- the URI modifier.NullPointerException
- if uri
or modifier
are
null
.IllegalArgumentException
- if uri
still does not conform
to the syntax constraints for file system node names after its
modification.public boolean equals(@CheckForNull Object that)
true
iff the given object is a node name
and its URI equals
the URI of this node name.public String getPath()
getUri()
.getPath()
.@CheckForNull public String getQuery()
getUri()
.getQuery()
.public URI getUri()
public int hashCode()
equals(Object)
.public boolean isRoot()
true
if and only if the path component of this file
system node name is empty and no query component is defined.true
if and only if the path component of this file
system node name is empty and no query component is defined.public String toString()
URI.toString()
on getUri()
.Copyright © 2005–2018 Schlichtherle IT Services. All rights reserved.