F - the generic type of the FileSystem on which the operation is performedpublic abstract class FileCommand<F extends FileSystem> extends AbstractFileCommand<F,Path>
AbstractFileCommand for local file systems which use Path to identify and manage
files and directories.fileSystem| Modifier | Constructor and Description |
|---|---|
protected |
FileCommand(F fileSystem)
Creates a new instance
|
| Modifier and Type | Method and Description |
|---|---|
protected Path |
getAbsolutePath(Path path)
Returns an object representing the absolute path for the given path.
|
protected Path |
getParent(Path path)
Returns the parent path, or
null if this path does not
have a parent. |
protected String |
pathToString(Path path) |
protected Path |
resolvePath(Path basePath,
String filePath)
Resolve the given basePath against the filePath.
|
alreadyExistsException, assureParentFolderExists, cannotListFileException, cannotReadDirectoryException, doMkDirs, exception, exception, exists, getBasePath, isVirtualDirectory, mkdirs, pathNotFoundException, resolveExistingPath, resolvePathprotected FileCommand(F fileSystem)
fileSystem - the FileSystem on which the operation is performedprotected String pathToString(Path path)
pathToString in class AbstractFileCommand<F extends FileSystem,Path><I> as a String.protected Path getAbsolutePath(Path path)
If the given path is already absolute then this method simply returns it. Otherwise, this method resolves the path in an implementation dependent manner, typically by resolving the path against a file system default directory. Depending on the implementation, this method may throw an I/O error if the file system is not accessible.
getAbsolutePath in class AbstractFileCommand<F extends FileSystem,Path>path - the given pathPathprotected Path getParent(Path path)
null if this path does not
have a parent.
The parent of this path object consists of this path's root
component, if any, and each element in the path except for the
farthest from the root in the directory hierarchy. This method
does not access the file system; the path or its parent may not exist.
Furthermore, this method does not eliminate special names such as "."
and ".." that may be used in some implementations. On UNIX for example,
the parent of "/a/b/c" is "/a/b", and the parent of
"x/y/." is "x/y".
getParent in class AbstractFileCommand<F extends FileSystem,Path>Pathprotected Path resolvePath(Path basePath, String filePath)
If the filePath parameter is an absolute
path then this method trivially returns filePath. If filePath
is an empty path then this method trivially returns basePath.
Otherwise this method considers the basePath to be a directory and resolves
the given filePath against the basePath. In the simplest case, the given filePath
does not have a root component, in which case this method
joins both paths and returns a resulting path
that ends with the given filePath. Where the given filePath has
a root component then resolution is highly implementation dependent and
therefore unspecified.
resolvePath in class AbstractFileCommand<F extends FileSystem,Path>basePath - the base path considered as a directoryfilePath - the path to resolve against the basePathPathCopyright © 2003–2019 MuleSoft, Inc.. All rights reserved.