Class AbstractFileName
java.lang.Object
org.apache.commons.vfs.provider.AbstractFileName
- All Implemented Interfaces:
Comparable, FileName
- Direct Known Subclasses:
GenericFileName, LayeredFileName, LocalFileName, VirtualFileName
A default file name implementation.
- Version:
- $Revision: 480428 $ $Date: 2006-11-29 07:15:24 +0100 (Wed, 29 Nov 2006) $
- Author:
- Adam Murdoch
-
Field Summary
Fields inherited from interface FileName
ROOT_PATH, SEPARATOR, SEPARATOR_CHAR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidappendRootUri(StringBuffer buffer, boolean addPassword) Builds the root URI for this file name.static booleanChecks whether a path fits in a particular scope of another path.intImplement Comparableabstract FileNamecreateName(String absPath, FileType type) Factory method for creating name instances.protected StringbooleanDetermines if this object is equal to another.Returns the base name of the file.intgetDepth()Returns the depth of this file name, within its file system.Returns the extension of this file name.returns a "friendly path", this is a path without a password.Returns the name of the parent of the file.getPath()Returns the absolute path of the file, relative to the root of the file system that the file belongs to.Returns the absolute path of this file, within its file system.getRelativeName(FileName name) Converts a file name to a relative name, relative to this file name.getRoot()find the root of the filesystemReturns the root URI of the file system this file belongs to.Returns the URI scheme of this file.getType()Returns the requested or current type of this name.getURI()Returns the absolute URI of the file.protected StringinthashCode()Returns the hashcode for this name.booleanisAncestor(FileName ancestor) Determines if another file name is an ancestor of this file name.booleanisDescendent(FileName descendent) Determines if another file name is a descendent of this file name.booleanisDescendent(FileName descendent, NameScope scope) Determines if another file name is a descendent of this file name.toString()Returns the URI of the file.
-
Constructor Details
-
AbstractFileName
-
-
Method Details
-
hashCode
-
equals
-
compareTo
Implement Comparable- Specified by:
compareToin interfaceComparable- Parameters:
obj- another abstractfilename
-
toString
-
createName
-
appendRootUri
Builds the root URI for this file name. Note that the root URI must not end with a separator character. -
getBaseName
Returns the base name of the file.- Specified by:
getBaseNamein interfaceFileName- Returns:
- The base name. Never returns null.
-
getPath
-
getUriTrailer
-
getPathDecoded
Description copied from interface:FileNameReturns the absolute path of this file, within its file system. This path is normalised, so that.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
In contrast to/as its absolute path.FileName.getPath()the path is decoded i.e. all %nn stuff replaced by its character.- Specified by:
getPathDecodedin interfaceFileName- Returns:
- The path. Never returns null.
- Throws:
FileSystemException- if the path is not correctly encoded
-
getParent
-
getRoot
-
getScheme
-
getURI
-
createURI
-
getRelativeName
Converts a file name to a relative name, relative to this file name.- Specified by:
getRelativeNamein interfaceFileName- Parameters:
name- The name to convert to a relative path.- Returns:
- The relative name.
- Throws:
FileSystemException- On error.
-
getRootURI
Returns the root URI of the file system this file belongs to.- Specified by:
getRootURIin interfaceFileName
-
getDepth
-
getExtension
Returns the extension of this file name.- Specified by:
getExtensionin interfaceFileName- Returns:
- The extension. Returns an empty string if the name has no extension.
-
isAncestor
Determines if another file name is an ancestor of this file name.- Specified by:
isAncestorin interfaceFileName
-
isDescendent
Determines if another file name is a descendent of this file name.- Specified by:
isDescendentin interfaceFileName
-
isDescendent
Determines if another file name is a descendent of this file name.- Specified by:
isDescendentin interfaceFileName
-
getType
Returns the requested or current type of this name.
The "requested" type is the one determined during resolving the name.
In this case the name is aFileType.FOLDERif it ends with an "/" else it will be aFileType.FILE
Once attached it will be changed to reflect the real type of this resource.- Specified by:
getTypein interfaceFileName- Returns:
FileType.FOLDERorFileType.FILE
-
checkName
-
getFriendlyURI
returns a "friendly path", this is a path without a password.- Specified by:
getFriendlyURIin interfaceFileName
-