public interface AQHadoopDistributedFileSystem
All methods operate on remote location except when explicitly named "local".
Modifier and Type | Method and Description |
---|---|
void |
chgrp(String source,
String group)
Changes the group ownership of a file or all files inside the directory.
|
void |
chmod(String source,
String permissions)
Changes the permissions of a file or all files inside the specified
directory.
|
void |
chown(String source,
String owner)
Changes the owner of a file or all files inside the specified directory.
|
void |
copy(String source,
String destination)
Copies a single file to another file or a directory to another directory.
|
void |
copyFromLocalFile(String source,
String destination)
Copies a local file or directory to a new file, or a directory to a new
FS directory.
|
void |
copyFromLocalFileSets(AQFileSet[] filesets,
String destination)
Copies local files as specified in the AQFileSet object to a new FS location.
|
void |
copyToLocalFile(String source,
String destination)
Copies FS files as specified to a new local location.
|
boolean |
createDirectory(String directory)
Creates a directory.
|
boolean |
deleteDirectory(String directory,
boolean recursive)
Deletes a directory.
|
boolean |
deleteFile(String file)
Deletes a single file.
|
int |
directoryCount(String location,
boolean recurse)
To count the number of directories under a directory.
|
long |
directorySize(String location,
boolean recurse)
Returns the size of a directory denoted by this location name.
|
boolean |
exists(String source)
Tests whether a file or directory exists.
|
int |
fileCount(String location,
boolean recurse)
To count the number of files under a directory.
|
long |
fileSize(String source)
Returns the length of the file denoted by this file name.
|
String[] |
glob(String pattern)
Returns all the files that match filePattern and are not checksum
files.
|
String[] |
glob(String pattern,
AQPathFilter filter)
Returns an array of FileStatus objects whose path names match pathPattern
and is accepted by the user-supplied path filter.
|
boolean |
isDirectory(String directory)
Tests whether the directory specified exists.
|
boolean |
isFile(String file)
Tests whether the file specified exists.
|
String |
lastModified(String Source)
Returns the time that the file or directory denoted by source was last modified.
|
String[] |
list(String source)
Returns an array of strings naming the files and directories in the
directory denoted by this abstract pathname.
|
void |
move(String source,
String destination)
Moves a file or directory to a new file, or a directory to a new
directory.
|
void |
moveFromLocalFile(String source,
String destination)
Moves a local file or directory to a new file, or a directory to a new
FS directory.
|
void |
moveFromLocalFileSets(AQFileSet[] filesets,
String destination)
Moves local files as specified in the AQFileSet object to a new FS location.
|
void |
moveToLocalFile(String source,
String destination)
Moves FS files as specified to a new local location.
|
AQFileSet |
newFileSet()
Returns a new instance of local FileSet.
|
AQPathFilter |
newRegexExcludeFilter(String regex)
Returns a new instance of filter that passes only files that don't match the regular expression.
|
void |
rename(String source,
String destination)
Renames a file or a directory.
|
void |
touch(String file,
String modificationTime)
Changes the modification time of a file and possibly creates it at the
same time.
|
void chgrp(String source, String group) throws Exception
source
- The file or directory to perform the task; required.group
- The name of the group; required.Exception
- on errorvoid chmod(String source, String permissions) throws Exception
source
- The file or directory to perform the task; required.permissions
- The Unix symbolic permission string e.g. "-rw-rw-rw-"; required.Exception
- If the file or directory does not exist. Also if source
is null or and empty string.void chown(String source, String owner) throws Exception
source
- The file or directory to perform the task; required.owner
- The name of the new owner; required.Exception
- on errorvoid copy(String source, String destination) throws Exception
source
- The source file or directory to be copied; required.destination
- The location of where the file will be copied; required.Exception
- on errorvoid copyFromLocalFile(String source, String destination) throws Exception
source
- The file or directory to be copied; required.destination
- The destination file or directory; required.Exception
- on errorvoid copyFromLocalFileSets(AQFileSet[] filesets, String destination) throws Exception
filesets
- A list of files to be copied as defined in the AQFileSet
object; required. Use Unix glob pattern for filesets.destination
- The destination directory; required.Exception
- on errorvoid copyToLocalFile(String source, String destination) throws Exception
Note: This method requires the UNIX chmod shell command on the client system.
source
- The file or directory to be copied; required.
object; required. Use Unix glob pattern for filesets.destination
- The destination file or directory; 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, boolean recursive) throws Exception
directory
- The name of the directory to be deleted; required.recursive
- recursiveException
- 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 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 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.
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()
AQPathFilter newRegexExcludeFilter(String regex)
regex
- The regular expressionvoid 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 moveFromLocalFile(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 moveFromLocalFileSets(AQFileSet[] filesets, String destination) throws Exception
filesets
- A list of files to be moved as defined in the AQFileSet
object; required. Use Unix glob pattern for filesets.destination
- The destination directory; required.Exception
- on errorvoid moveToLocalFile(String source, String destination) throws Exception
Note: This method requires the UNIX chmod shell command on the client system.
source
- The file or directory to be moved; required.
object; required. Use Unix glob pattern for filesets.destination
- The destination file or 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 existsString[] glob(String pattern) throws Exception
Returns all the files that match filePattern and are not checksum files. Results are sorted by their names.
A filename pattern is composed of regular characters and special pattern matching characters, which are:
pattern
- a regular expression specifying a path patternException
- on errorString[] glob(String pattern, AQPathFilter filter) throws Exception
Returns null if pathPattern has no glob and the path does not exist. Returns an empty array if pathPattern has a glob and no path matches it.
pattern
- The Unix glob pattern.filter
- A user-supplied filterException
- 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.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.