The methods which provide utility functions for paths and sorted sets/maps containing them are implemented efficiently, meaning they will rarely require more time complexity than O(lookup) where lookup is the time it takes to look up an element in a sorted set/map. Unless noted otherwise, these functions expect the parameter sets/maps to be sorted by the natural order.
public static ByteArrayRegion | getBytes( Gets the raw byte contents of the file, implicitly synchronizing the file using the specified content database. |
public static NavigableMap< | Gets the content descriptors of the children of the specified directory. |
public static String | getContent( Gets the string contents of the file, implicitly synchronizing the file using the specified content database. |
public static NavigableMap< | Gets the children of the specified directory by resolving the names against the current path of the directory. |
public static NavigableMap< | getDirectoryChildrenByPath( Gets the children of the specified directory by resolving the names against the specified path. |
public static NavigableMap< | Gets the children in the specified directory tree. |
public static NavigableMap< | getFilesRecursiveByPath( Gets the children in the specified directory tree using the given predicate. |
public static NavigableMap< | getFilesRecursiveByPath( Gets the all of the children in the specified directory tree, resolving the relative paths against the argument. |
public static ProviderHolderPathKey | getPathKey( Gets the path key for a local path. |
public static ProviderHolderPathKey | getPathKey( Gets the path key for a file provider and corresponding path. |
public static SakerPath | getPathOrParent( Gets the path or any of its parent which is contained in a set for a specified path. |
public static < | getPathOrParentEntry( Gets the entry for the path path or any of its parent which is contained in a map for a specified path. |
public static < | getPathSubMapAbsolutes( Gets a submap of the argument which only contains entries that are mapped to a absolute path. |
public static < | getPathSubMapDirectoryChildren( Gets a submap of the argument which only contains entries with keys that start with the argument directory path. |
public static < | getPathSubMapDirectoryChildren( Gets a submap of the argument which only contains entries with keys that start with the argument directory path. |
public static < | getPathSubMapRelatives( Gets a submap of the argument which only contains entries that are mapped to a relative path. |
public static NavigableSet< | Gets a subset of the argument paths which only contain absolute paths. |
public static NavigableSet< | getPathSubSetDirectoryChildren( Gets a subset of the argument which only contains paths that only contain paths that start with the argument
directory path. |
public static NavigableSet< | Gets a subset of the argument paths which only contain relative paths. |
public static SortedSet< | getPathSubSetRelatives( Gets a subset of the argument paths which only contain relative paths. |
public static RootFileProviderKey | getRootFileProviderKey( Gets the root file provider key of a file provider by unwrapping it according the wrapping rules of file
providers. |
public static boolean | hasAbsolutePath( Checks if the argument map contains any absolute path key. |
public static boolean | hasAbsolutePath( Checks if the argument set contains any absolute path element. |
public static boolean | hasDifferentRootedPaths( Checks if the specified path set doesn't contain paths which have different roots. |
public static boolean | hasNonForwardRelative( Checks if the argument sorted path set has any non-forward relative path. |
public static boolean | hasPathOrParent( Checks if the argument pahts set contains the specified path, or any parent path of it. |
public static boolean | hasPathOrSubPath( Checks if the argument set contains the specified test path, or any subpath of it. |
public static boolean | hasRelativePath( Checks if the argument map contains any relative path keys. |
public static boolean | hasRelativePath( Checks if the argument set contains any relative path element. |
public static boolean | hasSubPath( Checks if the argument set contains at least one path that is a subpath of the specified test path. |
public static boolean | isAllSubPath( Checks if all key paths in the argument map starts with the specified base path. |
public static boolean | isAllSubPath( Checks if all paths in the argument set starts with the specified base path. |
public static boolean | isOnlyForwardRelatives( Checks if the argument sorted path set consists only of forward relative paths. |
public static boolean | isPathInDirectory( Checks if a specified file path is a direct children of a directory path. |
public static boolean | isSamePaths( Checks if the specified path with the given file provider has the same location as the argument local path. |
public static boolean | isSamePaths( Checks if a location specified by a file provider and absolute path is same as the given path key. |
public static boolean | isSamePaths( Checks if the specified file provider-path pair point to the same location. |
public static boolean | isSameProvider( Checks if the argument file provider keys are the same. |
public static boolean | isSameProvider( Checks if the file provider key represents the file provider as the file provider argument. |
public static boolean | isSameProvider( Checks if the argument file providers operate on the same files. |
public static boolean | Checks if the argument path key operate on the same file providers, and the second path is a subpath of the first
(base) path. |
public static boolean | isSubPath( Tests if second file provider-path pair is a subpath of the first base pair. |
public static int | nameComparator( Comparator function for comparing the argument files by their name. |
public static InputStream | openInputStream( Opens an input stream to the contents of the file, implicitly synchronizing the file using the specified content
database. |
public static final void | prettyPrintRecursive( Pretty prints a file hierarchy to the specified stream. |
public static < | relativizeSubPath( Converts a map by taking the subpath of the keys for a given path base. |
public static NavigableSet< | relativizeSubPath( Converts a path set by taking the subpath of the paths for a given path base. |
public static Path | requireAbsolutePath( Validation method for ensuring that the specified path is absolute. |
public static Path | requireAbsolutePath( Validation method for ensuring that the specified path is absolute. |
public static SakerPath | requireAbsolutePath( Validation method for ensuring that the specified file is available through an absolute path. |
public static SakerPath | requireAbsolutePath( Validation method for ensuring that the specified file is available through an absolute path. |
public static SakerPath | requireAbsolutePath( Validation method for ensuring that the specified path is absolute. |
public static SakerPath | requireAbsolutePath( Validation method for ensuring that the specified path is absolute. |
public static SakerDirectory | requireBuildDirectory( Validation method for ensuring that the execution has a build directory configured for it. |
public static SakerDirectory | requireBuildDirectory( Validation method for ensuring that the task has a build directory configured for it. |
public static SakerPath | requireBuildDirectoryPath( Validation method for ensuring that the task has a build directory path configured for it. |
public static String | requireFileName( Validation method for ensuring that the specified path has a valid file name. |
public static String | requireFileName( Validation method for ensuring that the specified path has a valid file name. |
public static SakerPath | requireParent( Validation method for ensuring that a specified path has a non- null
parent. |
public static SakerPath | requireParent( Validation method for ensuring that a specified path has a non- null
parent. |
public static Path | requireRelativePath( Validation method for ensuring that the specified path is relative. |
public static Path | requireRelativePath( Validation method for ensuring that the specified path is relative. |
public static SakerPath | requireRelativePath( Validation method for ensuring that the specified file is available through a relative path. |
public static SakerPath | requireRelativePath( Validation method for ensuring that the specified file is available through a relative path. |
public static SakerPath | requireRelativePath( Validation method for ensuring that the specified path is relative. |
public static SakerPath | requireRelativePath( Validation method for ensuring that the specified path is relative. |
public static SakerFileProvider | requireRootFileProvider( Validation method for ensuring that the specified file provider is a root file provider. |
public static RootFileProviderKey | requireRootFileProviderKey( Validation method for ensuring that the specified file provider is a root file provider. |
public static String | requireValidFileName( Validation method for a file name according to the rules of FileHandle.getName(). |
public static String | requireValidFileName( Validation method for a file name according to the rules of FileHandle.getName(). |
public static SakerFile | resolve( Resolves a file or directory name against the specified directory. |
public static SakerFile | resolveAtAbsolutePath( Resolves a file or directory using the given absolute path. |
public static SakerFile | resolveAtPath( Same as resolveAtPath( |
public static SakerFile | resolveAtPath( Resolves a file or directory at the given path. |
public static SakerFile | resolveAtRelativePath( Resolves a file or directory using the given relative path against a base directory. |
public static SakerFile | resolveAtRelativePathNames( Resolves a file or directory with the given path names against a base directory. |
public static SakerDirectory | resolveDirectory( Resolves a directory name on the specified directory. |
public static SakerDirectory | resolveDirectoryAtAbsolutePath( Resolves a directory using the given absolute path. |
public static SakerDirectory | resolveDirectoryAtAbsolutePathCreate( Resolves a directory using the given absolute path, creating it if necessary, overwriting already existing files. |
public static SakerDirectory | resolveDirectoryAtAbsolutePathCreateIfAbsent( Resolves a directory using the given absolute path, creating it if possible. |
public static SakerDirectory | resolveDirectoryAtPath( Same as resolveDirectoryAtPath( |
public static SakerDirectory | resolveDirectoryAtPath( Resolves a directory at a given path. |
public static SakerDirectory | resolveDirectoryAtPathCreate( Same as resolveDirectoryAtPathCreate( |
public static SakerDirectory | resolveDirectoryAtPathCreate( Resolves a directory at a given path, creating it if necessary, overwriting already existing files. |
public static SakerDirectory | resolveDirectoryAtPathCreateIfAbsent( Same as resolveDirectoryAtPathCreateIfAbsent( |
public static SakerDirectory | resolveDirectoryAtPathCreateIfAbsent( Resolves a directory at a given path, creating it if possible. |
public static SakerDirectory | resolveDirectoryAtRelativePath( Resolves a directory using the given relative path against a base directory. |
public static SakerDirectory | resolveDirectoryAtRelativePathCreate( Resolves a directory using the given relative path against a base directory, creating it if necessary,
overwriting already existing files. |
public static SakerDirectory | resolveDirectoryAtRelativePathCreateIfAbsent( Resolves a directory using the given relative path against a base directory, creating it if possible. |
public static SakerDirectory | resolveDirectoryAtRelativePathNames( Resolves a directory with the given path names against a base directory. |
public static SakerDirectory | resolveDirectoryAtRelativePathNamesCreate( Resolves a directory with the given path names against a base directory, creating it if necessary, overwriting
already existing files. |
public static SakerDirectory | resolveDirectoryAtRelativePathNamesCreateIfAbsent( Resolves a directory with the given path names against a base directory, creating it if possible. |
public static SakerDirectory | resolveDirectoryCreate( Resolves a directory name on the specified directory, creating if necessary. |
public static SakerDirectory | resolveDirectoryCreateIfAbsent( Resolves a directory name on the specified directory, creating if possible. |
public static SakerFile | resolveFile( Resolves a file but not a directory name on the specified directory. |
public static SakerFile | resolveFileAtAbsolutePath( Resolves a file but not a directory using the given absolute path. |
public static SakerFile | resolveFileAtPath( Same as resolveFileAtPath( |
public static SakerFile | resolveFileAtPath( Resolves a file but not a directory at the given path. |
public static SakerFile | resolveFileAtRelativePath( Resolves a file but not a directory using the given relative path against a base directory. |
public static SakerFile | resolveFileAtRelativePathNames( Resolves a file but not a directory with the given path names against a base directory. |
public static void | synchronizeDirectory( Executes the synchronization of a directory to its denoted path using the given content database and
synchronization predicate. |
public static void | Executes the synchronization of a directory to its denoted path using the given content database. |
public static void | synchronizeDirectory( Executes the synchronization of a directory to the given path using the given content database and
synchronization predicate. |
public static void | synchronizeFile( Executes the synchronization of a file (but not a directory) to its denoted path using the given content
database. |
public static void | synchronizeFile( Executes the synchronization of a file (but not a directory) to the specified path using the given content
database. |
public static SakerPath | toAbsolutePath( Converts the argument to an absolute path by optionally resolving it against the working directory of the task
context. |
public static < | toFileContentMap( Transforms the parameter map by taking the content descriptor of the values. |
public static NavigableMap< | toPathContentMap( Converts the given files to a map with their retrieved paths as keys and content
descriptors as values. |
public static NavigableMap< | toPathFileMap( Converts the given files to a map with their retrieved paths as keys. |
public static String | toRelativeString( Converts the argument path to a relative string if possible. |
public static void | writeTo( Writes the contents of the file to the parameter stream, implicitly synchronizing the file using the specified
content database. |
It is recommended that users call TaskExecutionUtilities.getBytes(
null
to skip implicit
synchronization.null
.
Works the same way as TaskExecutionUtilities.getChildrenFileContents(
null
.
It is recommended that users call TaskExecutionUtilities.getContent(
Unless the file reports getting the bytes efficient, this method gets the raw bytes of the file and decodes them as UTF-8.
null
to skip implicit
synchronization.null
.Only the direct children of the directory is included.
This method works in the same way as if SakerDirectory.getChildren() was called, and every entry key is resolved against the directory path.
Same as:
getDirectoryChildrenByPath(dir, dir.getSakerPath())
null
.Only the direct children of the directory is included.
This method works in the same way as if SakerDirectory.getChildren() was called, and every entry key is resolved against the base path.
null
.The result map will have the files mapped to a relative path compared to the argument directory. Any file that is a direct child of the directory will have a relative path with a single path name as their key.
This is a convenience function for calling:
dir.getFilesRecursiveByPath(SakerPath.EMPTY, DirectoryVisitPredicate.everything())
null
.This is a convenience function for calling:
dir.getFilesRecursiveByPath(SakerPath.EMPTY, predicate)
null
,
DirectoryVisitPredicate.everything() will be used.null
.This is a convenience function for calling:
dir.getFilesRecursiveByPath(basepath, DirectoryVisitPredicate.everything())
null
.Same as:
LocalFileProvider.getInstance().getPathKey(path)
null
.null
.The argument must be naturally ordered.
null
.null
.The argument must be naturally ordered.
If the argument is empty, false
is returned.
true
if the argument contains at least one absolute path.The argument must be naturally ordered.
If the argument is empty, false
is returned.
true
if the argument contains at least one absolute path.The argument must be naturally ordered.
If the argument is empty, then false
is returned as it satisfies the condition.
true
if all of the paths in the set have the same root.
If there is an absolute path in the set, the result will be true
.
Empty argument will result in false
.
In any other cases if there is a path in it that starts with ".."
, true
is returned.
true
if there is at least one not forward relative path in the set.The argument must be naturally ordered.
If the argument is empty, false
is returned.
true
if the argument contains at least one relative path.The argument must be naturally ordered.
If the argument is empty, false
is returned.
true
if the argument contains at least one relative path.The argument must be naturally ordered.
If the path map is empty, true
is returned.
true
if all paths in the map start with the base path argument.The argument must be naturally ordered.
If the path set is empty, true
is returned.
true
if all paths in the set start with the base path argument.
If the argument is empty, the result is true
.
If the argument contains an absolute path, the result is false
.
If the argument contains a path that is not forward relative, the result is false
.
true
if all of the paths in the argument set are forward relative.
This method returns true
if and only if the file path starts with the directory path, and the path
name count of the file is one greater than the directory path name count.
true
, if the path for the file is a direct child path of the directory.The file system of the argument Path object is not taken into account. It is always interpreted as a path on the local file system.
true
if they represent the same file location.null
.true
if they represent the same file location.null
.true
if they represent the same file location.null
.The keys are checked for equality.
true
if the keys equal.null
.The key is checked for equality against the key of the argument file provider.
true
if the key equals to the key of the file provider.null
.Their file provider keys are checked for equality.
true
if their file provider keys equal.null
.true
if the paths are associated with the same file providers, and the second path is a
subpath of the first.null
.true
if the second path is a subpath of the first.null
.
It is recommended that users call TaskExecutionUtilities.openInputStream(
null
to skip implicit
synchronization.null
.If the file is a directory, the children and their children recursively will be printed, and indented in the output.
The file name, its identity hash, and the classname is printed to the output.
The argument must be naturally ordered.
The argument must be naturally ordered.
null
.null
.)A file has an absolute path if and only if it has every parent until one of the root directories for the execution, or is a root directory itself.
null
.A file has an absolute path if and only if it has every parent until one of the root directories for the execution, or is a root directory itself.
null
.)null
.null
.)null
.null
.null
.null
.null
.)null
parent.null
.null
parent.null
.)null
.null
.)A file has a relative path if and only if it has no parent, or none of its parents are a root directory of the execution.
null
.A file has a relative path if and only if it has no parent, or none of its parents are a root directory of the execution.
null
.)null
.null
.)null
.null
.
The name may not be null
, empty, "."
or ".."
, must not contain slash
characters ('/'
, '\\'
), and must not contain the colon (':'
) and semicolon
(';'
) characters.
null
.
The name may not be null
, empty, "."
or ".."
, must not contain slash
characters ('/'
, '\\'
), and must not contain the colon (':'
) and semicolon
(';'
) characters.
null
.)
Tha names "."
and ".."
are specially handled meaning the directory itself, and its
parent respectively.
In any other case a child file of the directory is returned.
null
if not found.null
.
It is recommended that users call TaskExecutionUtilities.resolveAtAbsolutePath(
null
if not found.null
.
It is recommended that users call TaskExecutionUtilities.resolveAtPath(
null
if not found.null
, or path is relative and base directory is null
, or path is
absolute and execution directory context is null
.
It is recommended that users call TaskExecutionUtilities.resolveAtPath(
If the path is relative, it will be resolved against the current task working directory.
If it is absolute, the execution root directories will be used as a base of resolution.
null
if not found.null
.
It is recommended that users call TaskExecutionUtilities.resolveAtRelativePath(
null
if not found.null
.
It is recommended that users call
TaskExecutionUtilities.resolveAtRelativePathNames(
The path names are interpreted as if they were relative compared to the base directory.
null
if not found.null
.
Tha names "."
and ".."
are specially handled meaning the directory itself, and its
parent respectively.
If the specified child of the directory is not a directory instance, then null
is returned.
In any other case a child directory of the directory is returned.
null
if a directory was not found for the name.null
.
It is recommended that users call TaskExecutionUtilities.resolveDirectoryAtAbsolutePath(
null
if a directory was not found at the path.null
.
It is recommended that users call TaskExecutionUtilities.resolveDirectoryAtAbsolutePathCreate(
null
.
It is recommended that users call
TaskExecutionUtilities.resolveDirectoryAtAbsolutePathCreateIfAbsent(
This method doesn't overwrite the already existing file at the path if it's not a directory.
null
if it cannot be created.null
.
It is recommended that users call
TaskExecutionUtilities.resolveDirectoryAtPath(
null
if a directory was not found at the path.null
, or path is relative and base directory is null
, or path is
absolute and execution directory context is null
.
It is recommended that users call TaskExecutionUtilities.resolveDirectoryAtPath(
If the path is relative, it will be resolved against the current task working directory.
If it is absolute, the execution root directories will be used as a base of resolution.
null
if a directory was not found at the path.null
.
It is recommended that users call
TaskExecutionUtilities.resolveDirectoryAtPathCreate(
null
, or path is relative and base directory is null
, or path is
absolute and execution directory context is null
.
It is recommended that users call TaskExecutionUtilities.resolveDirectoryAtPathCreate(
If the path is relative, it will be resolved against the current task working directory.
If it is absolute, the execution root directories will be used as a base of resolution.
null
.
It is recommended that users call
TaskExecutionUtilities.resolveDirectoryAtPathCreateIfAbsent(
null
if it cannot be created.null
, or path is relative and base directory is null
, or path is
absolute and execution directory context is null
.
It is recommended that users call TaskExecutionUtilities.resolveDirectoryAtPathCreateIfAbsent(
This method doesn't overwrite the already existing file at the path if it's not a directory.
If the path is relative, it will be resolved against the current task working directory.
If it is absolute, the execution root directories will be used as a base of resolution.
null
if it cannot be created.null
.
It is recommended that users call
TaskExecutionUtilities.resolveDirectoryAtRelativePath(
null
if a directory was not found at the path.null
.
It is recommended that users call
TaskExecutionUtilities.resolveDirectoryAtRelativePathCreate(
null
.
It is recommended that users call
TaskExecutionUtilities.resolveDirectoryAtRelativePathCreateIfAbsent(
This method doesn't overwrite the already existing file at the path if it's not a directory.
null
if it cannot be created.null
.
It is recommended that users call
TaskExecutionUtilities.resolveDirectoryAtRelativePathNames(
The path names are interpreted as if they were relative compared to the base directory.
null
if a directory was not found at the path.null
.
It is recommended that users call
TaskExecutionUtilities.resolveDirectoryAtRelativePathNamesCreate(
The path names are interpreted as if they were relative compared to the base directory.
null
.
It is recommended that users call
TaskExecutionUtilities.resolveDirectoryAtRelativePathNamesCreateIfAbsent(
This method doesn't overwrite the already existing file at the path if it's not a directory.
The path names are interpreted as if they were relative compared to the base directory.
null
if it cannot be created.null
.
Tha names "."
and ".."
are specially handled meaning the directory itself, and its
parent respectively.
If the file name is ".."
and the directory has no parent, null
is returned.
In any other case a child directory of the passed directory is returned or created.
null
if the file name is ".."
and the
directory has no parent.null
.
Tha names "."
and ".."
are specially handled meaning the directory itself, and its
parent respectively.
If the specified child of the directory is present and not a directory instance, then null
is
returned.
If the file name is ".."
and the directory has no parent, null
is returned.
In any other case a child directory of the passed directory is returned or created.
null
if the file name is ".."
and the
directory has no parent, or failed to create the directory.null
.
Tha names "."
and ".."
are specially handled meaning the directory itself, and its
parent respectively. In these cases null
is returned.
If the specified child of the directory is a directory instance, then null
is returned.
In any other case a child file of the directory is returned.
null
if a file was not found for the name or the found file is a
directory.null
.
It is recommended that users call TaskExecutionUtilities.resolveFileAtAbsolutePath(
null
if not found or it's a directory.null
.
It is recommended that users call TaskExecutionUtilities.resolveFileAtPath(
null
if not found or it's a directory.null
, or path is relative and base directory is null
, or path is
absolute and execution directory context is null
.
It is recommended that users call TaskExecutionUtilities.resolveFileAtPath(
If the path is relative, it will be resolved against the current task working directory.
If it is absolute, the execution root directories will be used as a base of resolution.
null
if not found or it's a directory.null
.
It is recommended that users call
TaskExecutionUtilities.resolveFileAtRelativePath(
null
if not found or it's a directory.null
.
It is recommended that users call
TaskExecutionUtilities.resolveFileAtRelativePathNames(
The path names are interpreted as if they were relative compared to the base directory.
null
if not found or it's a directory.null
.The actual path is determined using ContentDatabase.getPathConfiguration().
Clients should not call this method directly, but SakerDirectory.synchronize(
null
is the same as DirectoryVisitPredicate.everything().null
.The actual path is determined using ContentDatabase.getPathConfiguration().
Clients should not call this method directly, but SakerDirectory.synchronize() instead.
null
.
Clients should not call this method directly, but
SakerDirectory.synchronize(
null
is the same as DirectoryVisitPredicate.everything().null
.The actual path is determined using ContentDatabase.getPathConfiguration().
Clients should not call this method directly, but SakerFile.synchronize() instead.
null
.
Clients should not call this method directly, but SakerFile.synchronize(
null
.If the argument path is already absolute, it is returned directly.
null
.The ordering of the returned map is the same as the argument.
This function has no conterpart in TaskExecutionUtilities. To retrieve content descriptors of files see
TaskExecutionUtilities.toPathContentMap(
null
.
Works the same way as TaskExecutionUtilities.toPathContentMap(
null
.
Works the same way as TaskExecutionUtilities.toPathFileMap(
null
.If the argument is already relative, it will be converted to string directly.
If it is absolute, the method will try to convert it to a relative one by checking if it is under the execution working directory. The resulting path string will be forward relative.
If this method is called from a build execution thread, the configured execution working directory will be used to convert the path to a relative string.
If the path is not a subpath of the execution working directory, it will be stringized as an absolute path.
If this method is not called from a build execution, it is equivalent to path.toString()
.
This method is useful when displaying paths to the user, as relative paths are often more meaningful.
null
.
It is recommended that users call TaskExecutionUtilities.writeTo(
null
to skip implicit
synchronization.null
.