public interface FileName extends Comparable<FileName>
FileObject
Modifier and Type | Field and Description |
---|---|
static FileName[] |
EMPTY_ARRAY
Empty array of FileName.
|
static String |
ROOT_PATH
The absolute path of the root of a file system.
|
static String |
SEPARATOR
The separator used in file paths.
|
static char |
SEPARATOR_CHAR
The separator character used in file paths.
|
Modifier and Type | Method and Description |
---|---|
String |
getBaseName()
Gets the base name of this file.
|
int |
getDepth()
Gets the depth of this file name, within its file system.
|
String |
getExtension()
Gets the extension of this file name.
|
String |
getFriendlyURI()
Gets a "friendly path", this is a path without a password.
|
FileName |
getParent()
Gets the file name of the parent of this file.
|
String |
getPath()
Gets the absolute path string of this file, within its file system.
|
String |
getPathDecoded()
Returns the absolute path of this file, within its file system.
|
String |
getRelativeName(FileName name)
Converts a file name to a relative name, relative to this file name.
|
FileName |
getRoot()
Gets the root of the file system.
|
String |
getRootURI()
Gets the root URI string of the file system this file belongs to.
|
String |
getScheme()
Gets the URI scheme of this file.
|
FileType |
getType()
Gets the requested or current type of this name.
|
String |
getURI()
Gets the absolute URI string of this file.
|
boolean |
isAncestor(FileName ancestor)
Tests if another file name is an ancestor of this file name.
|
boolean |
isDescendent(FileName descendent)
Tests if another file name is a descendent of this file name.
|
boolean |
isDescendent(FileName descendent,
NameScope nameScope)
Tests if another file name is a descendent of this file name.
|
boolean |
isFile()
Tests if this file name is a name for a regular file.
|
compareTo
static final char SEPARATOR_CHAR
static final String SEPARATOR
static final String ROOT_PATH
static final FileName[] EMPTY_ARRAY
String getBaseName()
/somefolder/somefile
is somefile
.
The root file of a file system has an empty base name.
int getDepth()
String getExtension()
String getFriendlyURI()
This path can not be used to resolve the path again.
FileName getParent()
FileName
object representing the parent name. Returns null for the root of a file system.String getPath()
.
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.
String getPathDecoded() throws FileSystemException
.
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.
In contrast to getPath()
, this path is decoded: All %nn escapes are replaced by their respective
characters.
FileSystemException
- if the path is not correctly encodedString getRelativeName(FileName name) throws FileSystemException
name
- The name to convert to a relative path.FileSystemException
- On error.FileName getRoot()
String getRootURI()
String getScheme()
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.
FileType.FOLDER
or FileType.FILE
String getURI()
boolean isAncestor(FileName ancestor)
ancestor
- The FileName to check.boolean isDescendent(FileName descendent)
descendent
- the FileName to check.boolean isDescendent(FileName descendent, NameScope nameScope)
descendent
- the FileName to check.nameScope
- the NameScope of the FileName.boolean isFile() throws FileSystemException
FileSystemException
- if an error occurs.getType()
,
FileType.FILE
Copyright © 2002–2020 The Apache Software Foundation. All rights reserved.