public interface AQFileSystem
gets information from and interacts with the filesystem.
Synopsis:
file system
DescriptionModifier and Type | Method and Description |
---|---|
void |
attrib(String source,
String attrName,
String attrValue)
Changes the permissions and/or attributes of a file or all files inside
the specified directory.
|
void |
concat(AQFileSet fileset,
String file)
Concatenates multiple files into a single one or displays to the console if
file is not set. |
void |
copy(String source,
String destination)
Copies a single file to another file/directory or a directory to another
directory.
|
void |
copyFileSets(AQFileSet[] filesets,
String destination)
Copies a list of files as specified by the AQFilesSet object.
|
boolean |
createDirectory(String directory)
Creates a directory.
|
boolean |
deleteDirectory(String directory)
Delete a directory.
|
boolean |
deleteDirectoryRecursively(String directory)
Delete a directory recursively.
|
boolean |
deleteFile(String file)
Delete a single file.
|
void |
deleteFileSets(AQFileSet[] filesets)
Deletes files and directories as specified in the AQFileSet object.
|
int |
directoryCount(String location,
boolean recurse)
Retrieves the number of directories under the defined directory.
|
long |
directorySize(String location,
boolean recurse)
Returns the size of a directory file denoted by this location name.
|
boolean |
exists(String source)
Test whether a file or directory exists.
|
int |
fileCount(String location,
boolean recurse)
Retrieves the number of files under a directory.
|
long |
fileSize(String source)
Returns the length of the file defined as the source.
|
void |
fixCRLF(String source,
String eol,
String eof)
Adjusts a text file or all files inside a directory to local conventions.
|
long |
getFreeSpace(String partition)
Returns the number of unallocated bytes in the partition.
|
long |
getTotalSpace(String partition)
Returns the size of the partition.
|
long |
getUsableSpace(String partition)
Returns the number of bytes available to this virtual machine on the
partition.
|
boolean |
isDirectory(String directory)
Test whether the directory specified exists.
|
boolean |
isFile(String file)
Test whether the file specified exists.
|
boolean |
isHidden(String source)
Tests whether the file named by source is a hidden file.
|
String |
lastModified(String Source)
Returns the time that the file or directory denoted by source was last modified.
|
String[] |
list(String source)
Returns the files and directories defined in the source.
|
void |
move(String source,
String destination)
Moves a single file to a new file or a directory to a new directory.
|
void |
moveFileSets(AQFileSet[] filesets,
String destination)
Move files as specified in the AQFileSet object to a new location.
|
AQFileSet |
newFileSet()
Returns a new instance of FileSet.
|
void |
rename(String source,
String destination)
Renames a file or a directory.
|
void |
renameExtensions(String source,
String from,
String to)
Renames the file extensions in the source directory.
|
void |
replace(String directory,
String token,
String value)
Replaces the occurrence of a given string (token) with another string
(value) in a file or all files inside a directory.
|
void |
replaceRegExp(String directory,
String expression,
String substitution)
Replaces the occurrence of a given regular expression with a substitution
pattern in a file or all files inside a directory.
|
String[] |
scan(AQFileSet fileset)
Scans a directory as defined in a fileset and returns a list of files.
|
String[] |
scan(String directory)
Scans a directory and return a list of files, including the subdirectories.
|
void |
sync(String source,
String destination)
Synchronize a local target directory with files and subdirectories as defined in the source
directory.
|
void |
touch(String file,
String modificationTime)
Changes the modification time of a file and possibly creates it at the
same time.
|
void attrib(String source, String attrName, String attrValue) throws Exception
Valid attrName
s are: archive, hidden, readonly and system.
Valid attrValue
s are: true and false. Any value other then
true will clear the attribute.
source
- The file or directory to perform the task.attrName
- The attribute to be changed. The valid attributes are
"archive", "hidden", "readonly" and "system".attrValue
- "true" or "false", any value other then "true" will clear the
attribute.Exception
- on errorvoid concat(AQFileSet fileset, String file) throws Exception
file
is not set.fileset
- A list of files, as defined in the AQFileSet object, to
perform the task; required.file
- The location and name of the file; required.Exception
- on errorvoid copy(String source, String destination) throws Exception
source
- The file to be copied; required.destination
- The location of where the file will be copied; required.Exception
- on errorvoid copyFileSets(AQFileSet[] filesets, String destination) throws Exception
filesets
- A list of files, as defined in the AQFileSet object, to
perform the task; required.destination
- The directory where the files will be copied; required.Exception
- on errorboolean deleteFile(String file) throws Exception
file
- The name of the file to be deleted; required.Exception
- on errorboolean deleteDirectory(String directory) throws Exception
directory
- The name of the directory to be deleted; required.Exception
- on errorboolean deleteDirectoryRecursively(String directory)
directory
- The name of the directory to be deleted; required.void deleteFileSets(AQFileSet[] filesets) throws Exception
filesets
- A list of files, as defined in the AQFileSet object, to
perform the task; required.Exception
- on errorboolean exists(String source) throws Exception
source
- The file or directory; required.Exception
- on errorlong fileSize(String source) throws Exception
source
- The file; required.Exception
- on errorvoid fixCRLF(String source, String eol, String eof) throws Exception
source
- The file or directory to perform the task; required.eol
- Specifies how end-of-line (EOL) characters are to be handled.
The EOL characters are CR, LF and the pair CRLF. Valid values
for this property are:eof
- Specifies how DOS end of file (control-Z) characters are to be
handled. Valid values for this property are:
Exception
- on errorlong getTotalSpace(String partition) throws Exception
partition
- The name of the partition; required.Exception
- on errorlong getFreeSpace(String partition) throws Exception
The returned number of unallocated bytes is a hint, but not a guarantee, that it is possible to use most or any of these bytes. The number of unallocated bytes is most likely to be accurate immediately after this call. It is likely to be made inaccurate by any external I/O operations including those made on the system outside of this virtual machine. This method makes no guarantee that write operations to this file system will succeed.
partition
- The name of the partition; required.Exception
- on errorlong getUsableSpace(String partition) throws Exception
The returned number of available bytes is a hint, but not a guarantee, that it is possible to use most or any of these bytes. The number of unallocated bytes is most likely to be accurate immediately after this call. It is likely to be made inaccurate by any external I/O operations including those made on the system outside of this virtual machine. This method makes no guarantee that write operations to this file system will succeed.
partition
- The name of the partition; required.Exception
- on errorboolean isDirectory(String directory) throws Exception
directory
- The name of the directory; required.Exception
- on errorboolean isFile(String file) throws Exception
file
- The name of the file; required.Exception
- on errorboolean isHidden(String source) throws Exception
source
- The name of the file; required.Exception
- on errorString lastModified(String Source) throws Exception
Source
- The file name or the directory name; required.Exception
- on errorString[] list(String source) throws Exception
If source does not denote a directory, then this method returns null. Otherwise an array of strings is returned, one for each file or directory in the directory. Names denoting the directory itself and the directory's parent directory are not included in the result. Each string is a file name rather than a complete path. This will not include files in the subdirectories under the source.
There is no guarantee that the name strings in the resulting array will appear in any specific order; they are not, in particular, guaranteed to appear in alphabetical order.
source
- The directory; required.Exception
- on errorboolean createDirectory(String directory) throws Exception
directory
- The directory to create; required.Exception
- on errorAQFileSet newFileSet()
void move(String source, String destination) throws Exception
source
- The file or directory to be moved; required.destination
- The destination file or directory; required.Exception
- on errorvoid moveFileSets(AQFileSet[] filesets, String destination) throws Exception
filesets
- A list of files to be moved as defined in the AQFileSet
object; required.destination
- The destination directory; required.Exception
- on errorvoid rename(String source, String destination) throws Exception
source
- The location and name of the file or directory to be renamed;
required.destination
- The new name of the file or directory; required.Exception
- on error, if destination existsvoid renameExtensions(String source, String from, String to) throws Exception
source
- Location of the files to be changed; required.from
- Files with this extension to be changed; required.to
- The new extension. E.g. "xls" for excel files, "txt" for text files; requiredException
- on errorvoid replace(String directory, String token, String value) throws Exception
value
is not specified.directory
- The location of the files to be changed; required.token
- The given string to be changed; required.value
- The new string value.Exception
- on errorvoid replaceRegExp(String directory, String expression, String substitution) throws Exception
directory
- The location of the files to be changed; required.expression
- A regular expression; required.substitution
- A substitution pattern; required.Exception
- on errorString[] scan(String directory) throws Exception
directory
- The name of the directory to be scanned; required.Exception
- on errorString[] scan(AQFileSet fileset) throws Exception
fileset
- The location and file pattern as defined in the AQFileSet
object; required.Exception
- on errorvoid sync(String source, String destination) throws Exception
Any file in the target directory that has not been matched by a file in the source gets removed. I.e. if you exclude a file in your sources and a file of that name is present in the target dir, it will get removed from the target. Files in the destination with the same name will be overwritten even if it has a more recent timestamp.
source
- The location of the files to be synchronized; required.destination
- The destination directory. If the directory doesn't exist, it
will be created.Exception
- on errorvoid touch(String file, String modificationTime) throws Exception
file
- The file to be touched. If the file doesn't exist, it will be
created.modificationTime
- The new modification time of the file. The string should be in
the following format "MM/DD/YYYY HH:MM AM or PM" or
"MM/DD/YYYY HH:MM:SS AM or PM".Exception
- on errorint fileCount(String location, boolean recurse) throws Exception
true
, it will count all files in the sub directories as well.location
- The location of the files to be counted; required. If location
is a file, an exception will be thrown.recurse
- If recurse is true, count files in the sub directory, otherwise
don't include files in the sub directory in the count; required.Exception
- If the location
is invalid or if location
is not a directory.int directoryCount(String location, boolean recurse) throws Exception
true
, it will count all directories in the sub directories as well.location
- The location of the directories to be counted; required. If location
is a file, an exception will be thrown.recurse
- If recurse is true, count directories in the sub directory, otherwise
don't include directories in the sub directory in the count; required.Exception
- If the location
is invalid or if location
is not a directory.long directorySize(String location, boolean recurse) throws Exception
location
- The location of the directory; required.recurse
- If recurse is true, count files in the sub directory, otherwise
don't include files in the sub directory in the count; requiredException
- on error
Copyright © 2017 AquaFold, Inc. All Rights Reserved. Use is subject to license terms.