@Immutable @DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class) public final class FsMountPoint extends java.lang.Object implements java.io.Serializable, java.lang.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 java.net.URI |
hierarchical |
private FsPath |
path |
private FsScheme |
scheme |
static java.lang.String |
SEPARATOR
The separator which is used to split opaque path names into
mount points and entry names. |
private static long |
serialVersionUID |
private java.net.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(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.
|
FsMountPoint(java.lang.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(java.net.URI uri)
Equivalent to
new FsMountPoint(uri, FsUriModifier.NULL). |
FsMountPoint(java.net.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(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 FsMountPoint |
create(java.lang.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(java.net.URI uri)
Equivalent to
create(uri, FsUriModifier.NULL). |
static FsMountPoint |
create(java.net.URI uri,
FsUriModifier modifier)
Constructs a new mount point by parsing the given URI.
|
boolean |
equals(java.lang.Object that)
Returns
true iff the given object is a mount point and its URI
equals the URI of this mount point. |
java.net.URI |
getHierarchicalUri()
Deprecated.
|
FsMountPoint |
getParent()
Returns the parent component, that is the mount point of the parent file
system,
or
null iff this mount point's URI doesn't name
a parent mount point, that is 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, that is if and only if it's hierarchical. |
FsScheme |
getScheme()
Returns the scheme component.
|
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,
FsUriModifier modifier) |
private void |
readObject(java.io.ObjectInputStream in) |
FsPath |
resolve(FsEntryName entryName)
Resolves the given entry name against this mount point.
|
java.net.URI |
toHierarchicalUri()
Returns a URI which is recursively transformed from the URI of this
mount point so that it's absolute and hierarchical.
|
java.lang.String |
toString()
Equivalent to calling
URI.toString() on toUri(). |
java.net.URI |
toUri()
Returns the URI for this mount point.
|
private void |
writeObject(java.io.ObjectOutputStream out) |
private static final long serialVersionUID
public static final java.lang.String SEPARATOR
mount points and entry names.
This is identical to the separator in the class
JarURLConnection.private java.net.URI uri
@Nullable private transient FsPath path
@Nullable private transient volatile FsScheme scheme
@Nullable private transient volatile java.net.URI hierarchical
@Deprecated
public FsMountPoint(java.lang.String uri)
throws java.net.URISyntaxException
new FsMountPoint(uri, FsUriModifier.NULL).java.net.URISyntaxException@Deprecated
public FsMountPoint(java.lang.String uri,
FsUriModifier modifier)
throws java.net.URISyntaxException
new URI(uri) and parsing the resulting URI.uri - the URI string representation.modifier - the URI modifier.java.net.URISyntaxException - if uri does not conform to the
syntax constraints for mount points.public FsMountPoint(java.net.URI uri)
throws java.net.URISyntaxException
new FsMountPoint(uri, FsUriModifier.NULL).java.net.URISyntaxExceptionpublic FsMountPoint(java.net.URI uri,
FsUriModifier modifier)
throws java.net.URISyntaxException
uri - the URI.modifier - the URI modifier.java.net.URISyntaxException - if uri does not conform to the
syntax constraints for mount points.@Deprecated public static FsMountPoint create(java.lang.String uri)
create(uri, FsUriModifier.NULL).@Deprecated public static FsMountPoint create(java.lang.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.java.lang.IllegalArgumentException - if uri does not conform to the
syntax constraints for mount points.public static FsMountPoint create(java.net.URI uri)
create(uri, FsUriModifier.NULL).public static FsMountPoint create(java.net.URI uri, FsUriModifier modifier)
new FsMountPoint(uri, modifier)
and wraps any thrown URISyntaxException in an
IllegalArgumentException.uri - the URI.modifier - the URI modifier.java.lang.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.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,
FsUriModifier modifier)
throws java.net.URISyntaxException
java.net.URISyntaxExceptionprivate boolean invariants()
public java.net.URI toUri()
@Deprecated public java.net.URI getUri()
toUri()public java.net.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 java.net.URI getHierarchicalUri()
toHierarchicalUri()()public FsScheme getScheme()
@Nullable public FsPath getPath()
null iff this mount point's URI doesn't name
a parent mount point, that is 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, that is 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
java.lang.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.equals in class java.lang.Objectpublic int compareTo(FsMountPoint that)
equals(Object).compareTo in interface java.lang.Comparable<FsMountPoint>public int hashCode()
equals(Object).hashCode in class java.lang.Objectpublic java.lang.String toString()
URI.toString() on toUri().toString in class java.lang.ObjectCopyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.