public abstract class AbstractFileName extends java.lang.Object implements FileName
ROOT_PATH, SEPARATOR, SEPARATOR_CHAR
Constructor and Description |
---|
AbstractFileName(java.lang.String scheme,
java.lang.String absPath,
FileType type) |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
appendRootUri(java.lang.StringBuffer buffer,
boolean addPassword)
Builds the root URI for this file name.
|
static boolean |
checkName(java.lang.String basePath,
java.lang.String path,
NameScope scope)
Checks whether a path fits in a particular scope of another path.
|
int |
compareTo(java.lang.Object obj)
Implement Comparable
|
abstract FileName |
createName(java.lang.String absPath,
FileType type)
Factory method for creating name instances.
|
protected java.lang.String |
createURI() |
boolean |
equals(java.lang.Object obj)
Determines if this object is equal to another.
|
java.lang.String |
getBaseName()
Returns the base name of the file.
|
int |
getDepth()
Returns the depth of this file name, within its file system.
|
java.lang.String |
getExtension()
Returns the extension of this file name.
|
java.lang.String |
getFriendlyURI()
returns a "friendly path", this is a path without a password.
|
FileName |
getParent()
Returns the name of the parent of the file.
|
java.lang.String |
getPath()
Returns the absolute path of the file, relative to the root of the
file system that the file belongs to.
|
java.lang.String |
getPathDecoded()
Returns the absolute path of this file, within its file system.
|
java.lang.String |
getRelativeName(FileName name)
Converts a file name to a relative name, relative to this file name.
|
FileName |
getRoot()
find the root of the filesystem
|
java.lang.String |
getRootURI()
Returns the root URI of the file system this file belongs to.
|
java.lang.String |
getScheme()
Returns the URI scheme of this file.
|
FileType |
getType()
Returns the requested or current type of this name.
|
java.lang.String |
getURI()
Returns the absolute URI of the file.
|
protected java.lang.String |
getUriTrailer() |
int |
hashCode()
Returns the hashcode for this name.
|
boolean |
isAncestor(FileName ancestor)
Determines if another file name is an ancestor of this file name.
|
boolean |
isDescendent(FileName descendent)
Determines if another file name is a descendent of this file name.
|
boolean |
isDescendent(FileName descendent,
NameScope scope)
Determines if another file name is a descendent of this file name.
|
java.lang.String |
toString()
Returns the URI of the file.
|
public AbstractFileName(java.lang.String scheme, java.lang.String absPath, FileType type)
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int compareTo(java.lang.Object obj)
compareTo
in interface java.lang.Comparable
obj
- another abstractfilenamepublic java.lang.String toString()
toString
in class java.lang.Object
public abstract FileName createName(java.lang.String absPath, FileType type)
protected abstract void appendRootUri(java.lang.StringBuffer buffer, boolean addPassword)
public java.lang.String getBaseName()
getBaseName
in interface FileName
public java.lang.String getPath()
protected java.lang.String getUriTrailer()
public java.lang.String getPathDecoded() throws FileSystemException
FileName
.
and ..
elements
have been removed. Also, the path only contains /
as its
separator character. The path always starts with /
The root of a file system has /
as its absolute path.
FileName.getPath()
the path is decoded i.e. all %nn stuff
replaced by its character.getPathDecoded
in interface FileName
FileSystemException
- if the path is not correctly encodedpublic FileName getParent()
public FileName getRoot()
public java.lang.String getScheme()
public java.lang.String getURI()
protected java.lang.String createURI()
public java.lang.String getRelativeName(FileName name) throws FileSystemException
getRelativeName
in interface FileName
name
- The name to convert to a relative path.FileSystemException
- On error.public java.lang.String getRootURI()
getRootURI
in interface FileName
public int getDepth()
public java.lang.String getExtension()
getExtension
in interface FileName
public boolean isAncestor(FileName ancestor)
isAncestor
in interface FileName
public boolean isDescendent(FileName descendent)
isDescendent
in interface FileName
public boolean isDescendent(FileName descendent, NameScope scope)
isDescendent
in interface FileName
public FileType getType()
FileType.FOLDER
if it ends with an "/" else
it will be a FileType.FILE
getType
in interface FileName
FileType.FOLDER
or FileType.FILE
public static boolean checkName(java.lang.String basePath, java.lang.String path, NameScope scope)
basePath
- An absolute, normalised path.path
- An absolute, normalised path.public java.lang.String getFriendlyURI()
getFriendlyURI
in interface FileName