@Immutable @DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class) public final class FsMountPoint extends Object implements Serializable, Comparable<FsMountPoint>
A mount point adds the following syntax constraints to a
Uniform Resource Identifier:
"!/".
The scheme specific part before the mount point separator is
parsed according the syntax constraints for a FsPath and the
following additional syntax constraints:
The path component must be absolute.
If its opaque, it's entry name must not be empty.
Finally, its set as the value of the path component
property.
"/".
The path component property of the mount point is set
to null in this case.
Examples for valid mount point URIs are:
uri property |
scheme property |
path URI |
parent URI |
|---|---|---|---|
foo:/bar/ |
foo |
(n/a)* | (n/a)* |
foo:bar:/baz!/ |
foo |
bar:/baz |
bar:/ |
foo:bar:baz:/bang!/boom!/ |
foo |
bar:baz:/bang!/boom |
baz:/bang |
* the component property is null and hence its URI is not
available.
Examples for invalid mount point URIs are:
| URI | Issue |
|---|---|
/foo |
not an absolute URI |
foo:/bar |
missing slash at end of hierarchical URI |
foo:/bar/#baz |
fragment component defined |
foo:bar:/baz!/bang |
missing mount point separator "!/" at end |
foo:bar:baz:/bang!/!/ |
empty entry name in path component after mount point "bar:baz:/bang!/" |
For any mount point m, it's generally true that
new FsMountPoint(m.toUri()).equals(m).
For any mount point m with an opaque URI, it's generally true that
new FsMountPoint(m.getScheme(), m.getPath()).equals(m).
This class supports serialization with both
ObjectOutputStream and XMLEncoder.
FsPath,
FsEntryName,
FsScheme,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
private URI |
hierarchical |
private FsPath |
path |
private FsScheme |
scheme |
static String |
SEPARATOR
The separator which is used to split opaque path names into
mount points and entry names. |
private static long |
serialVersionUID |
private URI |
uri |
| Constructor and Description |
|---|
FsMountPoint(FsScheme scheme,
FsPath path)
Constructs a new opaque mount point by composing its URI from the given
scheme and path.
|
FsMountPoint(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.
|
FsMountPoint(String uri,
FsUriModifier modifier)
Deprecated.
This constructor does not quote characters with a special
meaning in a URI - use the constructor variant with the URI
parameter instead.
|
FsMountPoint(URI uri)
Equivalent to
new FsMountPoint(uri, FsUriModifier.NULL). |
FsMountPoint(URI uri,
FsUriModifier modifier)
Constructs a new mount point by parsing the given URI.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(FsMountPoint that)
Implements a natural ordering which is consistent with
equals(Object). |
static FsMountPoint |
create(FsScheme scheme,
FsPath path)
Constructs a new mount point by composing its URI from the given scheme
and path.
|
static FsMountPoint |
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 FsMountPoint |
create(String uri,
FsUriModifier modifier)
Deprecated.
This method does not quote characters with a special meaning
in a URI - use the method variant with the URI parameter
instead.
|
static FsMountPoint |
create(URI uri)
Equivalent to
create(uri, FsUriModifier.NULL). |
static FsMountPoint |
create(URI uri,
FsUriModifier modifier)
Constructs a new mount point by parsing the given URI.
|
boolean |
equals(Object that)
Returns
true iff the given object is a mount point and its URI
equals the URI of this mount point. |
URI |
getHierarchicalUri()
Deprecated.
|
FsMountPoint |
getParent()
Returns the parent component, i.e. the mount point of the parent file
system,
or
null iff this mount point's URI doesn't name
a parent mount point, i.e. if and only if it's hierarchical. |
FsPath |
getPath()
Returns the path component
or
null iff this mount point's URI doesn't name
a parent mount point, i.e. if and only if it's hierarchical. |
FsScheme |
getScheme()
Returns the scheme component.
|
URI |
getUri()
Deprecated.
|
int |
hashCode()
Returns a hash code which is consistent with
equals(Object). |
private boolean |
invariants() |
private void |
parse(URI uri,
FsUriModifier modifier) |
private static String |
quote(Object s) |
private void |
readObject(ObjectInputStream in) |
FsPath |
resolve(FsEntryName entryName)
Resolves the given entry name against this mount point.
|
URI |
toHierarchicalUri()
Returns a URI which is recursively transformed from the URI of this
mount point so that it's absolute and hierarchical.
|
String |
toString()
Equivalent to calling
URI.toString() on toUri(). |
URI |
toUri()
Returns the URI for this mount point.
|
private void |
writeObject(ObjectOutputStream out) |
private static final long serialVersionUID
public static final String SEPARATOR
mount points and entry names.
This is identical to the separator in the class
JarURLConnection.private URI uri
@Nullable private transient FsPath path
@Nullable private transient volatile FsScheme scheme
@Nullable private transient volatile URI hierarchical
@Deprecated public FsMountPoint(String uri) throws URISyntaxException
new FsMountPoint(uri, FsUriModifier.NULL).URISyntaxException@Deprecated public FsMountPoint(String uri, FsUriModifier modifier) throws URISyntaxException
new URI(uri) and parsing the resulting URI.uri - the URI string representation.modifier - the URI modifier.URISyntaxException - if uri does not conform to the
syntax constraints for mount points.public FsMountPoint(URI uri) throws URISyntaxException
new FsMountPoint(uri, FsUriModifier.NULL).URISyntaxExceptionpublic FsMountPoint(URI uri, FsUriModifier modifier) throws URISyntaxException
uri - the URI.modifier - the URI modifier.URISyntaxException - if uri does not conform to the
syntax constraints for mount points.public FsMountPoint(FsScheme scheme, FsPath path) throws URISyntaxException
scheme - the non-null scheme.path - the non-null path.URISyntaxException - if the composed mount point URI would not
conform to the syntax constraints for mount points.@Deprecated public static FsMountPoint create(String uri)
create(uri, FsUriModifier.NULL).@Deprecated public static FsMountPoint create(String uri, FsUriModifier modifier)
new FsMountPoint(uri, modifier)
and wraps any thrown URISyntaxException in an
IllegalArgumentException.uri - the URI string representation.modifier - the URI modifier.IllegalArgumentException - if uri does not conform to the
syntax constraints for mount points.public static FsMountPoint create(URI uri)
create(uri, FsUriModifier.NULL).public static FsMountPoint create(URI uri, FsUriModifier modifier)
new FsMountPoint(uri, modifier)
and wraps any thrown URISyntaxException in an
IllegalArgumentException.uri - the URI.modifier - the URI modifier.IllegalArgumentException - if uri does not conform to the
syntax constraints for mount points.public static FsMountPoint create(FsScheme scheme, FsPath path)
new FsMountPoint(scheme, path)
and wraps any thrown URISyntaxException in an
IllegalArgumentException.scheme - the scheme.path - the path.IllegalArgumentException - if the composed mount point URI would
not conform to the syntax constraints for mount points.private void writeObject(ObjectOutputStream out) throws IOException
IOExceptionprivate void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionprivate void parse(URI uri, FsUriModifier modifier) throws URISyntaxException
URISyntaxExceptionprivate boolean invariants()
public URI toUri()
@Deprecated public URI getUri()
toUri()public URI toHierarchicalUri()
For example, the mount point URIs zip:file:/archive!/ and
tar:file:/archive!/ would both produce the hierarchical URI
file:/archive.
@Deprecated public URI getHierarchicalUri()
toHierarchicalUri()()public FsScheme getScheme()
@Nullable public FsPath getPath()
null iff this mount point's URI doesn't name
a parent mount point, i.e. if and only if it's hierarchical.@Nullable public FsMountPoint getParent()
null iff this mount point's URI doesn't name
a parent mount point, i.e. if and only if it's hierarchical.public FsPath resolve(FsEntryName entryName)
entryName - an entry name relative to this mount point.public boolean equals(@CheckForNull
Object that)
true iff the given object is a mount point and its URI
equals the URI of this mount point.
Note that this ignores the scheme and path.public int compareTo(FsMountPoint that)
equals(Object).compareTo in interface Comparable<FsMountPoint>public int hashCode()
equals(Object).public String toString()
URI.toString() on toUri().Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.