|
TrueZIP Kernel 7.0-rc2 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.schlichtherle.truezip.fs.FsPath
@Immutable @DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class) public final class FsPath
Addresses an entry in a file system.
A path is usually constructed from a Uniform Resource Identifier
in order to assert the following additional syntax constraints:
FsMountPoint and set
as the value of the property mount point.
The part after the last mount point separator is parsed
according to the syntax constraints for an FsEntryName and set as
the value of the property entry name.
".",
parsedaccording to the syntax constraints for a FsMountPoint and
set as the value of the property mount point.
The value of the property entry name is then set
to the URI relativized to this mount point.
mount point is set to null and the URI
is parsed according to the syntax constraints for an FsEntryName
and set as the value of the property entry name.
JarURLConnection, so that any opaque URL
obtained from an instance of this class could be used to
create a JarURLConnection object.
Examples for valid path URIs are:
foo:bar:/baz!/bang (mountPoint="foo:bar:/baz!/", entryName="bang")
foo:/bar (mountPoint="foo:/", entryName="bar")
foo:/bar/ (mountPoint="foo:/bar/", entryName="")
/foo (leading slash separator not allowed if not absolute)
foo/ (trailing slash separator not allowed if not absolute)
foo:bar (opaque URI w/o mount point separator)
foo:bar:baz:/bang!/boom (dito)
This class supports serialization with both
ObjectOutputStream and XMLEncoder.
| Field Summary | |
|---|---|
private static URI |
DOT
|
private FsEntryName |
entryName
|
private FsPath |
hierarchical
|
static String |
MOUNT_POINT_SEPARATOR
The separator which is used to split opaque path names into mount points and entry names. |
private FsMountPoint |
mountPoint
|
private static long |
serialVersionUID
|
private URI |
uri
|
| Constructor Summary | |
|---|---|
FsPath(File file)
Equivalent to new FsPath(file.toURI(), FsUriModifier.CANONICALIZE). |
|
FsPath(FsMountPoint mountPoint,
FsEntryName entryName)
Constructs a new path by synthesizing its URI from the given nullable mount point and entry name. |
|
FsPath(String uri)
Equivalent to new FsPath(uri, FsUriModifier.NULL). |
|
FsPath(String uri,
FsUriModifier modifier)
Constructs a new path by calling new URI(uri) and parsing the resulting URI. |
|
FsPath(URI uri)
Equivalent to new FsPath(uri, FsUriModifier.NULL). |
|
FsPath(URI uri,
FsUriModifier modifier)
Constructs a new path by parsing the given URI. |
|
| Method Summary | |
|---|---|
int |
compareTo(FsPath that)
Implements a natural ordering which is consistent with equals(Object). |
static FsPath |
create(String uri)
Equivalent to create(uri, FsUriModifier.NULL). |
static FsPath |
create(String uri,
FsUriModifier modifier)
Constructs a new path by constructing a new URI from the given string representation and parsing the result. |
static FsPath |
create(URI uri)
Equivalent to create(uri, FsUriModifier.NULL). |
static FsPath |
create(URI uri,
FsUriModifier modifier)
Constructs a new path by parsing the given URI. |
boolean |
equals(Object that)
Returns true iff the given object is a path name and its URI
equals the URI of this path name. |
FsEntryName |
getEntryName()
Returns the entry name. |
FsMountPoint |
getMountPoint()
Returns the mount point or null iff this path's
URI is not absolute. |
URI |
getUri()
Returns the URI of this path. |
int |
hashCode()
Returns a hash code which is consistent with equals(Object). |
FsPath |
hierarchicalize()
Returns a hierarchical URI for this path. |
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 path. |
String |
toString()
Equivalent to calling URI.toString() on getUri(). |
private void |
writeObject(ObjectOutputStream out)
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final long serialVersionUID
public static final String MOUNT_POINT_SEPARATOR
mount points and entry names.
This is identical to the separator in the class
JarURLConnection.
private static final URI DOT
private URI uri
@Nullable private transient FsMountPoint mountPoint
private transient FsEntryName entryName
@Nullable private transient volatile FsPath hierarchical
| Constructor Detail |
|---|
public FsPath(String uri)
throws URISyntaxException
new FsPath(uri, FsUriModifier.NULL).
URISyntaxException
public FsPath(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 paths.public FsPath(File file)
new FsPath(file.toURI(), FsUriModifier.CANONICALIZE).
Note that this constructor is expected not to throw any exceptions.
public FsPath(URI uri)
throws URISyntaxException
new FsPath(uri, FsUriModifier.NULL).
URISyntaxException
public FsPath(URI uri,
FsUriModifier modifier)
throws URISyntaxException
uri - the non-null URI.modifier - the URI modifier.
URISyntaxException - if uri does not conform to the
syntax constraints for paths.
public FsPath(@CheckForNull
FsMountPoint mountPoint,
FsEntryName entryName)
mountPoint - the nullable mount point.entryName - the entry name.
URISyntaxException - if the synthesized path URI
would not conform to the syntax constraints for paths.| Method Detail |
|---|
public static FsPath create(String uri)
create(uri, FsUriModifier.NULL).
public static FsPath create(String uri,
FsUriModifier modifier)
new FsPath(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 paths.public static FsPath create(URI uri)
create(uri, FsUriModifier.NULL).
public static FsPath create(URI uri,
FsUriModifier modifier)
new FsPath(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 paths.
private void writeObject(ObjectOutputStream out)
throws IOException
IOException
private void readObject(ObjectInputStream in)
throws IOException,
ClassNotFoundException
IOException
ClassNotFoundException
private void parse(URI uri,
FsUriModifier modifier)
throws URISyntaxException
URISyntaxExceptionprivate static String quote(Object s)
private boolean invariants()
@Nullable public FsMountPoint getMountPoint()
null iff this path's
URI is not absolute.
public FsEntryName getEntryName()
null.
public URI getUri()
public FsPath resolve(FsEntryName entryName)
entryName - an entry name relative to this path.
public FsPath hierarchicalize()
URI is opaque, the
hierarchical URI of its
mount point with its
entry name resolved against it is returned.
Otherwise, this path is returned.
Note that this function is idempotent, so calling it repeatedly will
produce the same result again.
However, this function is not injective, so two different paths
may produce equal results.
For example, the path URIs zip:file:/archive!/entry and
tar:file:/archive!/entry both have the same hierarchical URI
file:/archive/entry.
public boolean equals(@CheckForNull
Object that)
true iff the given object is a path name and its URI
equals the URI of this path name.
Note that this ignores the mount point and entry name.
equals in class Objectpublic int compareTo(FsPath that)
equals(Object).
compareTo in interface Comparable<FsPath>public int hashCode()
equals(Object).
hashCode in class Objectpublic String toString()
URI.toString() on getUri().
toString in class Object
|
TrueZIP Kernel 7.0-rc2 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||