|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | PROPERTY | CONSTR | METHOD | DETAIL: FIELD | PROPERTY | CONSTR | METHOD |
java.lang.Objectorg.vertx.groovy.core.file.FileSystem
class FileSystem
Contains a broad set of operations for manipulating files.
An asynchronous and a synchronous version of each operation is provided.
The asynchronous versions take an AsynchronousResultHandler which is called when the operation completes or an error occurs.
The synchronous versions return the results, or throw exceptions directly.
It is highly recommended the asynchronous versions are used unless you are sure the operation will not block for a significant period of time
Property Summary | |
---|---|
static java.io.FileSystem |
instance
|
Method Summary | |
---|---|
void
|
chmod(java.lang.String path, java.lang.String perms, java.lang.String dirPerms = null, groovy.lang.Closure handler)
Change the permissions on the file represented by path to perms, asynchronously. |
void
|
chmodSync(java.lang.String path, java.lang.String perms, java.lang.String dirPerms = null)
Synchronous version of chmod(String, String, String, Closure) |
void
|
copy(java.lang.String from, java.lang.String to, boolean recursive = false, groovy.lang.Closure handler)
Copy a file from the path from to path to, asynchronously. |
void
|
copySync(java.lang.String from, java.lang.String to, boolean recursive = false)
Synchronous version of copy(String, String, boolean, Closure) |
void
|
createFile(java.lang.String path, java.lang.String perms = null, groovy.lang.Closure handler)
Creates an empty file with the specified path, asynchronously. |
void
|
createFileSync(java.lang.String path, java.lang.String perms = null)
Synchronous version of createFile(String, String, Closure) |
void
|
delete(java.lang.String path, boolean recursive = false, groovy.lang.Closure handler)
Deletes the file represented by the specified path, asynchronously. |
void
|
deleteSync(java.lang.String path, boolean recursive)
Synchronous version of delete(String, boolean, Closure) |
void
|
exists(java.lang.String path, groovy.lang.Closure handler)
Determines whether the file as specified by the path path exists, asynchronously. |
boolean
|
existsSync(java.lang.String path)
Synchronous version of exists(String, Closure) |
void
|
fsProps(java.lang.String path, groovy.lang.Closure handler)
Returns properties of the file-system being used by the specified path, asynchronously. |
FileSystemProps
|
fsPropsSync(java.lang.String path)
Synchronous version of fsProps(String, Closure) |
void
|
link(java.lang.String link, java.lang.String existing, groovy.lang.Closure handler)
Create a hard link on the file system from link to existing, asynchronously. |
void
|
linkSync(java.lang.String link, java.lang.String existing)
Synchronous version of link(String, String, Closure) |
void
|
lprops(java.lang.String path, groovy.lang.Closure handler)
Obtain properties for the link represented by path, asynchronously. |
FileProps
|
lpropsSync(java.lang.String path)
Synchronous version of lprops(String, Closure) |
void
|
mkdir(java.lang.String path, java.lang.String perms = null, boolean createParents = false, groovy.lang.Closure handler)
Create the directory represented by path, asynchronously. |
void
|
mkdirSync(java.lang.String path, java.lang.String perms = null, boolean createParents = false)
Synchronous version of mkdir(String, String, boolean, Closure) |
void
|
move(java.lang.String from, java.lang.String to, groovy.lang.Closure handler)
Move a file from the path from to path to, asynchronously. |
void
|
moveSync(java.lang.String from, java.lang.String to)
Synchronous version of move(String, String, Closure) |
void
|
open(java.lang.String path, java.lang.String perms = null, boolean read = true, boolean write = true, boolean createNew = true, boolean flush = false, groovy.lang.Closure handler)
Open the file represented by path, asynchronously. |
AsyncFile
|
openSync(java.lang.String path, java.lang.String perms = null, boolean read = true, boolean write = true, boolean createNew = true, boolean flush = false)
Synchronous version of open(String, String, boolean, boolean, boolean, boolean, Closure) |
void
|
props(java.lang.String path, groovy.lang.Closure handler)
Obtain properties for the file represented by path, asynchronously. |
FileProps
|
propsSync(java.lang.String path)
Synchronous version of props(String, Closure) |
void
|
readDir(java.lang.String path, java.lang.String filter = null, groovy.lang.Closure handler)
Read the contents of the directory specified by path, asynchronously. |
java.lang.String[]
|
readDirSync(java.lang.String path, java.lang.String filter)
Synchronous version of readDir(String, String, Closure) |
void
|
readFile(java.lang.String path, groovy.lang.Closure handler)
Reads the entire file as represented by the path path as a Buffer, asynchronously. |
Buffer
|
readFileSync(java.lang.String path)
Synchronous version of readFile(String, Closure) |
void
|
readSymlink(java.lang.String link, groovy.lang.Closure handler)
Returns the path representing the file that the symbolic link specified by link points to, asynchronously. |
java.lang.String
|
readSymlinkSync(java.lang.String link)
Synchronous version of readSymlink(String, Closure) |
void
|
symlink(java.lang.String link, java.lang.String existing, groovy.lang.Closure handler)
Create a symbolic link on the file system from link to existing, asynchronously. |
void
|
symlinkSync(java.lang.String link, java.lang.String existing)
Synchronous version of link(String, String, Closure) |
void
|
truncate(java.lang.String path, long len, groovy.lang.Closure handler)
Truncate the file represented by path to length len in bytes, asynchronously. |
void
|
truncateSync(java.lang.String path, long len)
Synchronous version of truncate(String, long, Closure) |
void
|
unlink(java.lang.String link, groovy.lang.Closure handler)
Unlinks the link on the file system represented by the path link, asynchronously. |
void
|
unlinkSync(java.lang.String link)
Synchronous version of unlink(String, Closure) |
void
|
writeFile(java.lang.String path, Buffer data, groovy.lang.Closure handler)
Creates the file, and writes the specified Buffer data to the file represented by the path path, asynchronously. |
void
|
writeFile(java.lang.String path, java.lang.String data, groovy.lang.Closure handler)
Creates the file, and writes the specified String data to the file represented by the path path, asynchronously. |
void
|
writeFileSync(java.lang.String path, Buffer data)
Synchronous version of writeFile(String, Buffer, Closure) |
void
|
writeFileSync(java.lang.String path, java.lang.String data)
Synchronous version of writeFile(String, String, Closure) |
Methods inherited from 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() |
Property Detail |
---|
static java.io.FileSystem instance
Method Detail |
---|
void chmod(java.lang.String path, java.lang.String perms, java.lang.String dirPerms = null, groovy.lang.Closure handler)
If the file is directory then all contents will also have their permissions changed recursively. Any directory permissions will be set to dirPerms, whilst any normal file permissions will be set to perms.
void chmodSync(java.lang.String path, java.lang.String perms, java.lang.String dirPerms = null)
void copy(java.lang.String from, java.lang.String to, boolean recursive = false, groovy.lang.Closure handler)
If recursive is true and from represents a directory, then the directory and its contents will be copied recursively to the destination to.
The copy will fail if the destination if the destination already exists.
void copySync(java.lang.String from, java.lang.String to, boolean recursive = false)
void createFile(java.lang.String path, java.lang.String perms = null, groovy.lang.Closure handler)
void createFileSync(java.lang.String path, java.lang.String perms = null)
void delete(java.lang.String path, boolean recursive = false, groovy.lang.Closure handler)
If the path represents a directory and recursive = true then the directory and its contents will be deleted recursively.
void deleteSync(java.lang.String path, boolean recursive)
void exists(java.lang.String path, groovy.lang.Closure handler)
boolean existsSync(java.lang.String path)
void fsProps(java.lang.String path, groovy.lang.Closure handler)
FileSystemProps fsPropsSync(java.lang.String path)
void link(java.lang.String link, java.lang.String existing, groovy.lang.Closure handler)
void linkSync(java.lang.String link, java.lang.String existing)
void lprops(java.lang.String path, groovy.lang.Closure handler)
FileProps lpropsSync(java.lang.String path)
void mkdir(java.lang.String path, java.lang.String perms = null, boolean createParents = false, groovy.lang.Closure handler)
The new directory will be created with permissions as specified by perms. The permission String takes the form rwxr-x--- as specified in here.
If createParents is set to true then any non-existent parent directories of the directory will also be created.
The operation will fail if the directory already exists.
void mkdirSync(java.lang.String path, java.lang.String perms = null, boolean createParents = false)
void move(java.lang.String from, java.lang.String to, groovy.lang.Closure handler)
The move will fail if the destination already exists.
void moveSync(java.lang.String from, java.lang.String to)
void open(java.lang.String path, java.lang.String perms = null, boolean read = true, boolean write = true, boolean createNew = true, boolean flush = false, groovy.lang.Closure handler)
If read is true the file will be opened for reading. If write is true the file will be opened for writing.
If the file does not already exist and createNew is true it will be created with the permissions as specified by perms, otherwise the operation will fail.
If flush is true then all writes will be automatically flushed through OS buffers to the underlying storage on each write.
AsyncFile openSync(java.lang.String path, java.lang.String perms = null, boolean read = true, boolean write = true, boolean createNew = true, boolean flush = false)
void props(java.lang.String path, groovy.lang.Closure handler)
FileProps propsSync(java.lang.String path)
void readDir(java.lang.String path, java.lang.String filter = null, groovy.lang.Closure handler)
The result is an array of String representing the paths of the files inside the directory.
java.lang.String[] readDirSync(java.lang.String path, java.lang.String filter)
void readFile(java.lang.String path, groovy.lang.Closure handler)
Do not user this method to read very large files or you risk running out of available RAM.
Buffer readFileSync(java.lang.String path)
void readSymlink(java.lang.String link, groovy.lang.Closure handler)
java.lang.String readSymlinkSync(java.lang.String link)
void symlink(java.lang.String link, java.lang.String existing, groovy.lang.Closure handler)
void symlinkSync(java.lang.String link, java.lang.String existing)
void truncate(java.lang.String path, long len, groovy.lang.Closure handler)
The operation will fail if the file does not exist or len is less than zero.
void truncateSync(java.lang.String path, long len)
void unlink(java.lang.String link, groovy.lang.Closure handler)
void unlinkSync(java.lang.String link)
void writeFile(java.lang.String path, Buffer data, groovy.lang.Closure handler)
void writeFile(java.lang.String path, java.lang.String data, groovy.lang.Closure handler)
void writeFileSync(java.lang.String path, Buffer data)
void writeFileSync(java.lang.String path, java.lang.String data)
Groovy Documentation