TrueZIP Kernel 7.0-rc2

de.schlichtherle.truezip.fs
Class FsEntryName

java.lang.Object
  extended by de.schlichtherle.truezip.entry.EntryName
      extended by de.schlichtherle.truezip.fs.FsEntryName
All Implemented Interfaces:
Serializable, Comparable<EntryName>

@Immutable
@DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class)
public final class FsEntryName
extends EntryName

Addresses an entry in a file system relative to its mount point. A file system entry name is usually constructed from a Uniform Resource Identifier in order to assert the following additional syntax constraints:

  1. The URI must be relative, i.e. it must not have a scheme.
  2. The URI must not have an authority.
  3. The URI's path must be in normal form, i.e. its path must not contain redundant "." and ".." segments.
  4. The URI's path must not equal ".".
  5. The URI's path must not equal "..".
  6. The URI's path must not start with "/".
  7. The URI's path must not start with "./".
  8. The URI's path must not start with "../".
  9. The URI's path must not end with "/".

Examples for valid file system entry name URIs are:

Examples for invalid file system entry name URIs are:

This class supports serialization with both ObjectOutputStream and XMLEncoder.

Author:
Christian Schlichtherle
See Also:
FsEntry.getName(), Serialized Form

Field Summary
static FsEntryName ROOT
          The file system entry name of the root directory, which is an empty URI.
private static long serialVersionUID
           
 
Fields inherited from class de.schlichtherle.truezip.entry.EntryName
SEPARATOR, SEPARATOR_CHAR
 
Constructor Summary
FsEntryName(FsEntryName parent, FsEntryName member)
          Constructs a new file system entry name by resolving the given member file system entry name against the given parent file system entry name.
FsEntryName(String uri)
          Equivalent to new FsEntryName(uri, FsUriModifier.NULL).
FsEntryName(String uri, FsUriModifier modifier)
          Constructs a new file system entry name by calling new URI(uri) and parsing the resulting URI.
FsEntryName(URI uri)
          Equivalent to new FsEntryName(uri, FsUriModifier.NULL).
FsEntryName(URI uri, FsUriModifier modifier)
          Constructs a new file system entry name by parsing the given URI.
 
Method Summary
static FsEntryName create(String uri)
          Equivalent to create(uri, FsUriModifier.NULL).
static FsEntryName create(String uri, FsUriModifier modifier)
          Constructs a new file system entry name by constructing a new URI from the given string representation and parsing the result.
static FsEntryName create(URI uri)
          Equivalent to create(uri, FsUriModifier.NULL).
static FsEntryName create(URI uri, FsUriModifier modifier)
          Constructs a new file system entry name by parsing the given URI.
private  boolean invariants()
           
 boolean isRoot()
           
private  void parse(URI uri)
           
private static String quote(Object s)
           
private  void readObject(ObjectInputStream in)
           
 
Methods inherited from class de.schlichtherle.truezip.entry.EntryName
compareTo, equals, getPath, getQuery, getUri, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

ROOT

public static final FsEntryName ROOT
The file system entry name of the root directory, which is an empty URI.

Constructor Detail

FsEntryName

public FsEntryName(String uri)
            throws URISyntaxException
Equivalent to new FsEntryName(uri, FsUriModifier.NULL).

Throws:
URISyntaxException

FsEntryName

public FsEntryName(String uri,
                   FsUriModifier modifier)
            throws URISyntaxException
Constructs a new file system entry name by calling new URI(uri) and parsing the resulting URI.

Parameters:
uri - the URI string representation.
modifier - the URI modifier.
Throws:
URISyntaxException - if uri does not conform to the syntax constraints for entry names.

FsEntryName

public FsEntryName(URI uri)
            throws URISyntaxException
Equivalent to new FsEntryName(uri, FsUriModifier.NULL).

Throws:
URISyntaxException

FsEntryName

public FsEntryName(URI uri,
                   FsUriModifier modifier)
            throws URISyntaxException
Constructs a new file system entry name by parsing the given URI.

Parameters:
uri - the URI.
modifier - the URI modifier.
Throws:
NullPointerException - if uri is null.
URISyntaxException - if uri does not conform to the syntax constraints for file system entry names.

FsEntryName

FsEntryName(FsEntryName parent,
            FsEntryName member)
Constructs a new file system entry name by resolving the given member file system entry name against the given parent file system entry name. Note that the URI of the parent file system entry name is considered to name a directory even if it's not ending with a EntryName.SEPARATOR, so calling this constructor with "foo" and "bar" as the URIs for the parent and member file system entry names respectively will result in the URI "foo/bar" for the resulting file system entry name.

Parameters:
parent - an entry name for the parent.
member - an entry name for the member.
Method Detail

create

public static FsEntryName create(String uri)
Equivalent to create(uri, FsUriModifier.NULL).


create

public static FsEntryName create(String uri,
                                 FsUriModifier modifier)
Constructs a new file system entry name by constructing a new URI from the given string representation and parsing the result. This static factory method calls new FsEntryName(uri, modifier) and wraps any thrown URISyntaxException in an IllegalArgumentException.

Parameters:
uri - the URI string representation.
modifier - the URI modifier.
Returns:
A new file system entry name.
Throws:
IllegalArgumentException - if uri does not conform to the syntax constraints for entry names.

create

public static FsEntryName create(URI uri)
Equivalent to create(uri, FsUriModifier.NULL).


create

public static FsEntryName create(URI uri,
                                 FsUriModifier modifier)
Constructs a new file system entry name by parsing the given URI. This static factory method calls new FsEntryName(uri, modifier) and wraps any thrown URISyntaxException in an IllegalArgumentException.

Parameters:
uri - the URI.
modifier - the URI modifier.
Returns:
A new file system entry name.
Throws:
IllegalArgumentException - if uri does not conform to the syntax constraints for entry names.

readObject

private void readObject(ObjectInputStream in)
                 throws IOException,
                        ClassNotFoundException
Throws:
IOException
ClassNotFoundException

parse

private void parse(URI uri)
            throws URISyntaxException
Throws:
URISyntaxException

quote

private static String quote(Object s)

invariants

private boolean invariants()

isRoot

public boolean isRoot()

TrueZIP Kernel 7.0-rc2

Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.