Provides some helper method handling files
| Modifiers | Name | Description |
|---|---|---|
static char[] |
ALPHA |
|
static java.util.regex.Pattern |
URL_PROTOCOL |
| Type Params | Return Type | Name and description |
|---|---|---|
|
static java.nio.file.Path |
asPath(java.lang.String str)Given an hierarchical file URI path returns a java.nio.file.Path object eventually creating the associated file system if required. |
|
static java.nio.file.Path |
asPath(java.net.URI uri)Given a java.net.URI return a java.nio.file.Path object eventually creating the associated file system if required |
|
static java.nio.file.Path |
checkIfExists(java.nio.file.Path path, java.util.Map opts) |
|
static java.nio.file.Path |
copyPath(java.nio.file.Path source, java.nio.file.Path target, java.nio.file.CopyOption... options)Move a path to a target destination. |
|
static java.nio.file.Path |
createLocalDir(java.lang.String prefix = 'nxf-') |
|
static java.nio.file.Path |
createTempFolder(java.nio.file.Path basePath) |
|
static void |
deletePath(java.nio.file.Path path)Delete a path or a directory. |
|
static boolean |
empty(java.io.File file)Check whenever a file or a directory is empty |
|
static boolean |
empty(java.nio.file.Path path) |
|
protected static java.util.Map |
envFor(java.lang.String scheme)Lazy create and memoize this object since it will never change |
|
static java.io.FileSystem |
fileSystemForScheme(java.lang.String scheme) |
|
static java.nio.file.PathMatcher |
getDefaultPathMatcher(java.lang.String syntaxAndInput)Returns a PathMatcher that performs match operations on the
String representation of java.nio.file.Path objects by interpreting a
given pattern. |
|
static java.lang.String |
getIdentifier(java.nio.file.Path script, java.lang.String prefix = null)@return
|
|
static java.nio.file.Path |
getLocalCachePath(java.nio.file.Path sourcePath, java.nio.file.Path cacheDir, java.util.UUID sessionId = null )Given a path look for an existing file with that name in the cacheDir folder.
|
|
static java.nio.file.Path |
getLocalTempPath() |
|
static java.io.FileSystem |
getOrCreateFileSystemFor(java.net.URI uri, java.util.Map env = null )Acquire or create the file system for the given java.net.URI |
|
static java.io.FileSystem |
getOrCreateFileSystemFor(java.lang.String scheme, java.util.Map env = null ) |
<T extends FileSystemProvider> |
static T |
getOrInstallProvider(java.lang.Class<T> clazz)Get the instance of the specified FileSystemProvider class. |
|
static java.lang.String |
getPathFsType(java.nio.file.Path path) |
|
static java.nio.file.PathMatcher |
getPathMatcherFor(java.lang.String syntaxAndPattern, java.io.FileSystem fileSystem)Get a path matcher for the specified file system and file pattern. |
|
static java.nio.file.spi.FileSystemProvider |
getProviderFor(java.lang.String scheme)Returns a java.nio.file.spi.FileSystemProvider for a file scheme |
|
static java.lang.String |
getUrlProtocol(java.lang.String str) |
|
static java.io.FileSystem |
getWorkDirFileSystem()NOTE: this cannot be accessed by a remote system |
|
static boolean |
getWorkDirIsNFS()@return true when the current session working directory is a NFS mounted path
false otherwise |
|
static java.nio.file.Path |
getWorkFolder(java.nio.file.Path bashPath, com.google.common.hash.HashCode hash)Defines a cacheable path for the specified HashCode instance. |
|
static boolean |
isGlobAllowed(java.nio.file.Path path) |
|
static boolean |
isPathNFS(java.nio.file.Path path)Check if the specified path is a NFS mount |
|
static java.lang.String |
listDirectory(java.nio.file.Path path)List the content of a file system path |
|
static java.nio.file.Path |
movePath(java.nio.file.Path source, java.nio.file.Path target, java.nio.file.CopyOption... options)Move a path to a target destination. |
|
static java.util.List |
nameParts(java.lang.String name) |
|
static java.lang.String |
normalizePath(java.lang.String path) |
|
static java.lang.String |
randomString(int len, char[] alphabet)Creates a random string with the number of character specified e.g. |
|
static java.lang.String |
randomString(int len) |
|
static java.nio.file.attribute.BasicFileAttributes |
readAttributes(java.nio.file.Path path, java.nio.file.LinkOption... options) |
|
protected static java.nio.file.Path |
relativize0(java.nio.file.Path folder, java.nio.file.Path fullPath) |
|
static void |
visitFiles(java.util.Map options = null, java.nio.file.Path folder, java.lang.String filePattern, groovy.lang.Closure action)Applies the specified action on one or more files and directories matching the specified glob pattern |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Given an hierarchical file URI path returns a java.nio.file.Path object eventually creating the associated file system if required.
An hierarchical URI is either an absolute URI whose scheme-specific part begins with a slash character (e.g. file:/some/file.txt),
or a relative URI, that is, a URI that does not specify a scheme (e.g. some/file.txt).
See http://docs.oracle.com/javase/7/docs/api/java/net/URI.html
str - A path string eventually qualified with the scheme prefixGiven a java.net.URI return a java.nio.file.Path object eventually creating the associated file system if required
uri - A URI for identifying the requested pathMove a path to a target destination. It handles file or directory both to a local or to a foreign file system.
Delete a path or a directory. If the directory is not empty delete all the content of the directory. Note when the path is a symlink, it only remove the link without following affecting the target path
Check whenever a file or a directory is empty
file - The file path toLazy create and memoize this object since it will never change
Returns a PathMatcher that performs match operations on the
String representation of java.nio.file.Path objects by interpreting a
given pattern.
Given a path look for an existing file with that name in the cacheDir folder.
If exists will return the path to it, otherwise make a copy of it in the cache folder
and returns to the path to it.
sourcePath - A java.nio.file.Path object to an existing file or directorycacheDir - A java.nio.file.Path to the folder containing the cached objectssessionId - An option java.util.UUID used to create the object invalidation keyAcquire or create the file system for the given java.net.URI
uri - A java.net.URI locating a file into a file systemenv - An option environment specification that may be used to instantiate the underlying file system.
As defined by FileSystemProvider#newFileSystem(java.net.URI, java.util.Map) Get the instance of the specified FileSystemProvider class. If the provider is not
in the list of installed provided, it creates a new instance and add it to the list
This method has been deprecated use getOrCreateFileSystemFor(java.lang.String) instead
clazz - A class extending FileSystemProviderGet a path matcher for the specified file system and file pattern. It tries to get the matcher returned by java.io.FileSystem#getPathMatcher and falling back to getDefaultPathMatcher(java.lang.String) when it return a null or an java.lang.UnsupportedOperationException
Returns a java.nio.file.spi.FileSystemProvider for a file scheme
scheme - A file system scheme e.g. file, s3, dxfs, etc.NOTE: this cannot be accessed by a remote system
Session#workDir attribute
true when the current session working directory is a NFS mounted path
false otherwise Defines a cacheable path for the specified HashCode instance.
Check if the specified path is a NFS mount
path - The path to verifytrue when the path is a NFS mount false otherwiseList the content of a file system path
path
- The system system directory to listMove a path to a target destination. It handles file or directory both to a local or to a foreign file system
source - The source pathtarget - The target pathoptions - The copy options Creates a random string with the number of character specified
e.g. s8hm2nxt3
len - The len of the final random stringalphabet - The set of characters allowed in the random stringApplies the specified action on one or more files and directories matching the specified glob pattern
folder does not exist