public abstract class AbstractFileName extends Object implements org.apache.commons.vfs2.FileName
Constructor and Description |
---|
AbstractFileName(String scheme,
String absPath,
org.apache.commons.vfs2.FileType type) |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
appendRootUri(StringBuilder buffer,
boolean addPassword)
Builds the root URI for this file name.
|
static boolean |
checkName(String basePath,
String path,
org.apache.commons.vfs2.NameScope scope)
Checks whether a path fits in a particular scope of another path.
|
int |
compareTo(org.apache.commons.vfs2.FileName obj)
Implement Comparable.
|
abstract org.apache.commons.vfs2.FileName |
createName(String absPath,
org.apache.commons.vfs2.FileType type)
Factory method for creating name instances.
|
protected String |
createURI() |
boolean |
equals(Object o) |
String |
getBaseName()
Returns the base name of the file.
|
int |
getDepth()
Returns the depth of this file name, within its file system.
|
String |
getExtension()
Returns the extension of this file name.
|
String |
getFriendlyURI()
returns a "friendly path", this is a path without a password.
|
org.apache.commons.vfs2.FileName |
getParent()
Returns the name of the parent of the file.
|
String |
getPath()
Returns the absolute path of the file, relative to the root of the
file system that the file belongs to.
|
String |
getPathDecoded()
Returns the decoded path.
|
String |
getRelativeName(org.apache.commons.vfs2.FileName name)
Converts a file name to a relative name, relative to this file name.
|
org.apache.commons.vfs2.FileName |
getRoot()
find the root of the filesystem.
|
String |
getRootURI()
Returns the root URI of the file system this file belongs to.
|
String |
getScheme()
Returns the URI scheme of this file.
|
org.apache.commons.vfs2.FileType |
getType()
Returns the requested or current type of this name.
|
String |
getURI()
Returns the absolute URI of the file.
|
protected String |
getUriTrailer() |
int |
hashCode() |
boolean |
isAncestor(org.apache.commons.vfs2.FileName ancestor)
Determines if another file name is an ancestor of this file name.
|
boolean |
isDescendent(org.apache.commons.vfs2.FileName descendent)
Determines if another file name is a descendent of this file name.
|
boolean |
isDescendent(org.apache.commons.vfs2.FileName descendent,
org.apache.commons.vfs2.NameScope scope)
Determines if another file name is a descendent of this file name.
|
String |
toString()
Returns the URI of the file.
|
public int compareTo(org.apache.commons.vfs2.FileName obj)
compareTo
in interface Comparable<org.apache.commons.vfs2.FileName>
obj
- another abstractfilenamepublic String toString()
public abstract org.apache.commons.vfs2.FileName createName(String absPath, org.apache.commons.vfs2.FileType type)
absPath
- The absolute path.type
- The FileType.protected abstract void appendRootUri(StringBuilder buffer, boolean addPassword)
buffer
- A StringBuilder to use to construct the URI.addPassword
- true if the password should be added, false otherwise.public String getBaseName()
getBaseName
in interface org.apache.commons.vfs2.FileName
public String getPath()
getPath
in interface org.apache.commons.vfs2.FileName
protected String getUriTrailer()
public String getPathDecoded() throws org.apache.commons.vfs2.FileSystemException
getPathDecoded
in interface org.apache.commons.vfs2.FileName
org.apache.commons.vfs2.FileSystemException
- If an error occurs.public org.apache.commons.vfs2.FileName getParent()
getParent
in interface org.apache.commons.vfs2.FileName
public org.apache.commons.vfs2.FileName getRoot()
getRoot
in interface org.apache.commons.vfs2.FileName
public String getScheme()
getScheme
in interface org.apache.commons.vfs2.FileName
public String getURI()
getURI
in interface org.apache.commons.vfs2.FileName
protected String createURI()
public String getFriendlyURI()
getFriendlyURI
in interface org.apache.commons.vfs2.FileName
public String getRelativeName(org.apache.commons.vfs2.FileName name) throws org.apache.commons.vfs2.FileSystemException
getRelativeName
in interface org.apache.commons.vfs2.FileName
name
- The FileName.org.apache.commons.vfs2.FileSystemException
- if an error occurs.public String getRootURI()
getRootURI
in interface org.apache.commons.vfs2.FileName
public int getDepth()
getDepth
in interface org.apache.commons.vfs2.FileName
public String getExtension()
getExtension
in interface org.apache.commons.vfs2.FileName
public boolean isAncestor(org.apache.commons.vfs2.FileName ancestor)
isAncestor
in interface org.apache.commons.vfs2.FileName
ancestor
- The FileName to check.public boolean isDescendent(org.apache.commons.vfs2.FileName descendent)
isDescendent
in interface org.apache.commons.vfs2.FileName
descendent
- The FileName to check.public boolean isDescendent(org.apache.commons.vfs2.FileName descendent, org.apache.commons.vfs2.NameScope scope)
isDescendent
in interface org.apache.commons.vfs2.FileName
descendent
- The FileName to check.scope
- The NameScope.public org.apache.commons.vfs2.FileType getType()
The "requested" type is the one determined during resolving the name.
In this case the name is a FileType.FOLDER
if it ends with an "/" else
it will be a FileType.FILE
Once attached it will be changed to reflect the real type of this resource.
getType
in interface org.apache.commons.vfs2.FileName
FileType.FOLDER
or FileType.FILE
public static boolean checkName(String basePath, String path, org.apache.commons.vfs2.NameScope scope)
basePath
- An absolute, normalised path.path
- An absolute, normalised path.scope
- The NameScope.Copyright © 2005-2017 Apache Software Foundation. All Rights Reserved.