java.io.Closeable, java.lang.AutoCloseable, Configurable, BulkDeleteSource, PathCapabilities, DelegationTokenIssuerViewFileSystemOverloadScheme@Public @Evolving public class ViewFileSystem extends FileSystem
ViewFs.| Modifier and Type | Class | Description |
|---|---|---|
static class |
ViewFileSystem.MountPoint |
MountPoint representation built from the configuration.
|
FileSystem.DirectoryEntries, FileSystem.DirListingIterator<T extends FileStatus>, FileSystem.StatisticsDEFAULT_FS, FS_DEFAULT_NAME_KEY, LOG, SHUTDOWN_HOOK_PRIORITY, statistics, TRASH_PREFIX, USER_HOME_PREFIXTOKEN_LOG| Constructor | Description |
|---|---|
ViewFileSystem() |
This is the constructor with the signature needed by
FileSystem.createFileSystem(URI, Configuration)
After this constructor is called initialize() is called. |
ViewFileSystem(Configuration conf) |
Convenience Constructor for apps to call directly.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
access(Path path,
FsAction mode) |
Checks if the user can access a path.
|
FSDataOutputStream |
append(Path f,
int bufferSize,
Progressable progress) |
Append to an existing file (optional operation).
|
void |
close() |
Close this FileSystem instance.
|
FSDataOutputStream |
create(Path f,
FsPermission permission,
boolean overwrite,
int bufferSize,
short replication,
long blockSize,
Progressable progress) |
Create an FSDataOutputStream at the indicated Path with write-progress
reporting.
|
FSDataOutputStream |
createNonRecursive(Path f,
FsPermission permission,
java.util.EnumSet<CreateFlag> flags,
int bufferSize,
short replication,
long blockSize,
Progressable progress) |
Opens an FSDataOutputStream at the indicated Path with write-progress
reporting.
|
Path |
createSnapshot(Path path,
java.lang.String snapshotName) |
Create a snapshot.
|
boolean |
delete(Path f) |
Delete a file/directory.
|
boolean |
delete(Path f,
boolean recursive) |
Delete a file.
|
void |
deleteSnapshot(Path path,
java.lang.String snapshotName) |
Delete a snapshot of a directory.
|
protected FsGetter |
fsGetter() |
Gets file system creator instance.
|
AclStatus |
getAclStatus(Path path) |
Gets the ACL of a file or directory.
|
java.util.Collection<? extends BlockStoragePolicySpi> |
getAllStoragePolicies() |
Retrieve all the storage policies supported by this file system.
|
FileSystem[] |
getChildFileSystems() |
Get all the immediate child FileSystems embedded in this FileSystem.
|
ContentSummary |
getContentSummary(Path f) |
Return the
ContentSummary of a given Path. |
long |
getDefaultBlockSize() |
Return the number of bytes that large input files should be optimally
be split into to minimize I/O time.
|
long |
getDefaultBlockSize(Path f) |
Return the number of bytes that large input files should be optimally
be split into to minimize I/O time.
|
short |
getDefaultReplication() |
Get the default replication.
|
short |
getDefaultReplication(Path f) |
Get the default replication for a path.
|
Path |
getEnclosingRoot(Path path) |
Return path of the enclosing root for a given path.
|
BlockLocation[] |
getFileBlockLocations(FileStatus fs,
long start,
long len) |
Return an array containing hostnames, offset and size of
portions of the given file.
|
FileChecksum |
getFileChecksum(Path f) |
Get the checksum of a file, if the FS supports checksums.
|
FileChecksum |
getFileChecksum(Path f,
long length) |
Get the checksum of a file, from the beginning of the file till the
specific length.
|
FileStatus |
getFileStatus(Path f) |
Return a file status object that represents the path.
|
Path |
getHomeDirectory() |
Return the current user's home directory in this FileSystem.
|
Path |
getLinkTarget(Path path) |
|
ViewFileSystem.MountPoint[] |
getMountPoints() |
|
QuotaUsage |
getQuotaUsage(Path f) |
Return the
QuotaUsage of a given Path. |
java.lang.String |
getScheme() |
Return the protocol scheme for the FileSystem.
|
FsServerDefaults |
getServerDefaults() |
Return a set of server default configuration values.
|
FsServerDefaults |
getServerDefaults(Path f) |
Return a set of server default configuration values.
|
FsStatus |
getStatus() |
Returns a status object describing the use and capacity of the
filesystem.
|
FsStatus |
getStatus(Path p) |
Returns a status object describing the use and capacity of the
filesystem.
|
BlockStoragePolicySpi |
getStoragePolicy(Path src) |
Query the effective storage policy ID for the given file or directory.
|
Path |
getTrashRoot(Path path) |
Get the trash root directory for current user when the path
specified is deleted.
|
java.util.Collection<FileStatus> |
getTrashRoots(boolean allUsers) |
Get all the trash roots for current user or all users.
|
java.net.URI |
getUri() |
Returns a URI which identifies this FileSystem.
|
long |
getUsed() |
Return the total size of all files under "/", if
Constants.CONFIG_VIEWFS_LINK_MERGE_SLASH is supported and is a valid
mount point. |
Path |
getWorkingDirectory() |
Get the current working directory for the given FileSystem
|
byte[] |
getXAttr(Path path,
java.lang.String name) |
Get an xattr name and value for a file or directory.
|
java.util.Map<java.lang.String,byte[]> |
getXAttrs(Path path) |
Get all of the xattr name/value pairs for a file or directory.
|
java.util.Map<java.lang.String,byte[]> |
getXAttrs(Path path,
java.util.List<java.lang.String> names) |
Get all of the xattrs name/value pairs for a file or directory.
|
boolean |
hasPathCapability(Path path,
java.lang.String capability) |
Reject the concat operation; forward the rest to the viewed FS.
|
void |
initialize(java.net.URI theUri,
Configuration conf) |
Called after a new FileSystem instance is constructed.
|
RemoteIterator<LocatedFileStatus> |
listLocatedStatus(Path f,
PathFilter filter) |
List a directory.
|
FileStatus[] |
listStatus(Path f) |
List the statuses of the files/directories in the given path if the path is
a directory.
|
java.util.List<java.lang.String> |
listXAttrs(Path path) |
Get all of the xattr names for a file or directory.
|
boolean |
mkdirs(Path dir) |
Call
FileSystem.mkdirs(Path, FsPermission) with default permission. |
boolean |
mkdirs(Path dir,
FsPermission permission) |
Make the given file and all non-existent parents into
directories.
|
void |
modifyAclEntries(Path path,
java.util.List<AclEntry> aclSpec) |
Modifies ACL entries of files and directories.
|
FSDataInputStream |
open(Path f,
int bufferSize) |
Opens an FSDataInputStream at the indicated Path.
|
void |
removeAcl(Path path) |
Removes all but the base ACL entries of files and directories.
|
void |
removeAclEntries(Path path,
java.util.List<AclEntry> aclSpec) |
Removes ACL entries from files and directories.
|
void |
removeDefaultAcl(Path path) |
Removes all default ACL entries from files and directories.
|
void |
removeXAttr(Path path,
java.lang.String name) |
Remove an xattr of a file or directory.
|
boolean |
rename(Path src,
Path dst) |
Renames Path src to Path dst.
|
void |
renameSnapshot(Path path,
java.lang.String snapshotOldName,
java.lang.String snapshotNewName) |
Rename a snapshot.
|
Path |
resolvePath(Path f) |
Return the fully-qualified path of path, resolving the path
through any symlinks or mount point.
|
void |
satisfyStoragePolicy(Path src) |
Set the source path to satisfy storage policy.
|
void |
setAcl(Path path,
java.util.List<AclEntry> aclSpec) |
Fully replaces ACL of files and directories, discarding all existing
entries.
|
void |
setOwner(Path f,
java.lang.String username,
java.lang.String groupname) |
Set owner of a path (i.e.
|
void |
setPermission(Path f,
FsPermission permission) |
Set permission of a path.
|
boolean |
setReplication(Path f,
short replication) |
Set the replication for an existing file.
|
void |
setStoragePolicy(Path src,
java.lang.String policyName) |
Set the storage policy for a given file or directory.
|
void |
setTimes(Path f,
long mtime,
long atime) |
Set access time of a file.
|
void |
setVerifyChecksum(boolean verifyChecksum) |
Set the verify checksum flag.
|
void |
setWorkingDirectory(Path new_dir) |
Set the current working directory for the given FileSystem.
|
void |
setWriteChecksum(boolean writeChecksum) |
Set the write checksum flag.
|
void |
setXAttr(Path path,
java.lang.String name,
byte[] value,
java.util.EnumSet<XAttrSetFlag> flag) |
Set an xattr of a file or directory.
|
boolean |
truncate(Path f,
long newLength) |
Truncate the file in the indicated path to the indicated size.
|
void |
unsetStoragePolicy(Path src) |
Unset the storage policy set for a given file or directory.
|
append, append, append, append, appendFile, areSymlinksEnabled, cancelDeleteOnExit, canonicalizeUri, checkPath, clearStatistics, closeAll, closeAllForUGI, completeLocalOutput, concat, copyFromLocalFile, copyFromLocalFile, copyFromLocalFile, copyFromLocalFile, copyToLocalFile, copyToLocalFile, copyToLocalFile, create, create, create, create, create, create, create, create, create, create, create, create, createBulkDelete, createDataInputStreamBuilder, createDataInputStreamBuilder, createDataOutputStreamBuilder, createFid, createFile, createMultipartUploader, createNewFile, createNonRecursive, createNonRecursive, createPathHandle, createPathId, createSnapshot, createSymlink, deleteFid, deleteOnExit, enableSymlinks, exists, fixRelativePart, get, get, get, getAdditionalTokenIssuers, getAllStatistics, getBlockSize, getCanonicalServiceName, getCanonicalUri, getDefaultPort, getDefaultUri, getDelegationToken, getFileBlockLocations, getFileLinkStatus, getFileSystemClass, getFSofPath, getGlobalStorageStatistics, getInitialWorkingDirectory, getJobTrackerAddrs, getLength, getLocal, getName, getNamed, getPathHandle, getReplication, getStatistics, getStatistics, getStorageStatistics, getUsed, getZkConnectString, globStatus, globStatus, isDirectory, isFile, listCorruptFileBlocks, listFiles, listLocatedStatus, listStatus, listStatus, listStatus, listStatusBatch, listStatusIterator, makeQualified, mkdirs, mkdirsFid, mkdirsFid, moveFromLocalFile, moveFromLocalFile, moveToLocalFile, msync, newInstance, newInstance, newInstance, newInstanceLocal, open, open, open, openFid, openFid, openFid2, openFile, openFile, openFileWithOptions, openFileWithOptions, primitiveCreate, primitiveMkdir, primitiveMkdir, printStatistics, processDeleteOnExit, rename, resolveLink, setDefaultUri, setDefaultUri, setOwnerFid, setQuota, setQuotaByStorageType, setXAttr, startLocalOutput, supportsSymlinksgetConf, setConfclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddDelegationTokenspublic ViewFileSystem()
throws java.io.IOException
FileSystem.createFileSystem(URI, Configuration)
After this constructor is called initialize() is called.java.io.IOException - raised on errors performing I/O.public ViewFileSystem(Configuration conf) throws java.io.IOException
conf - configuration.java.io.IOException - raised on errors performing I/O.protected FsGetter fsGetter()
public java.lang.String getScheme()
getScheme in class FileSystemviewfspublic void initialize(java.net.URI theUri,
Configuration conf)
throws java.io.IOException
initialize in class FileSystemtheUri - a uri whose authority section names the host, port, etc. for
this FileSystemconf - the configurationjava.io.IOException - on any failure to initialize this instance.public java.net.URI getUri()
FileSystemgetUri in class FileSystempublic Path resolvePath(Path f) throws java.io.IOException
FileSystemresolvePath in class FileSystemf - path to be resolvedjava.io.FileNotFoundException - if the path is not presentjava.io.IOException - for any other errorpublic Path getHomeDirectory()
FileSystem"/user/$USER/".getHomeDirectory in class FileSystempublic Path getWorkingDirectory()
FileSystemgetWorkingDirectory in class FileSystempublic void setWorkingDirectory(Path new_dir)
FileSystemsetWorkingDirectory in class FileSystemnew_dir - Path of new working directorypublic FSDataOutputStream append(Path f, int bufferSize, Progressable progress) throws java.io.IOException
FileSystemappend in class FileSystemf - the existing file to be appended.bufferSize - the size of the buffer to be used.progress - for reporting progress if it is not null.java.io.IOException - IO failurepublic FSDataOutputStream createNonRecursive(Path f, FsPermission permission, java.util.EnumSet<CreateFlag> flags, int bufferSize, short replication, long blockSize, Progressable progress) throws java.io.IOException
FileSystemcreateNonRecursive in class FileSystemf - the file name to openpermission - file permissionflags - CreateFlags to use for this stream.bufferSize - the size of the buffer to be used.replication - required block replication for the file.blockSize - block sizeprogress - the progress reporterjava.io.IOException - IO failureFileSystem.setPermission(Path, FsPermission)public FSDataOutputStream create(Path f, FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress) throws java.io.IOException
FileSystemcreate in class FileSystemf - the file name to openpermission - file permissionoverwrite - if a file with this name already exists, then if true,
the file will be overwritten, and if false an error will be thrown.bufferSize - the size of the buffer to be used.replication - required block replication for the file.blockSize - block sizeprogress - the progress reporterjava.io.IOException - IO failureFileSystem.setPermission(Path, FsPermission)public boolean delete(Path f, boolean recursive) throws AccessControlException, java.io.FileNotFoundException, java.io.IOException
FileSystemdelete in class FileSystemf - the path to delete.recursive - if path is a directory and set to
true, the directory is deleted else throws an exception. In
case of a file the recursive can be set to either true or false.java.io.IOException - IO failureAccessControlExceptionjava.io.FileNotFoundExceptionpublic boolean delete(Path f) throws AccessControlException, java.io.FileNotFoundException, java.io.IOException
FileSystemdelete in class FileSystemf - the path.java.io.IOException - IO failure.AccessControlExceptionjava.io.FileNotFoundExceptionpublic BlockLocation[] getFileBlockLocations(FileStatus fs, long start, long len) throws java.io.IOException
FileSystemnull is returned.
if f == null :
result = null
elif f.getLen() <= start:
result = []
else result = [ locations(FS, b) for b in blocks(FS, p, s, s+l)]
This call is most helpful with and distributed filesystem
where the hostnames of machines that contain blocks of the given file
can be determined.
The default implementation returns an array containing one element:
BlockLocation( { "localhost:9866" }, { "localhost" }, 0, file.getLen())
In HDFS, if file is three-replicated, the returned array contains
elements like:
BlockLocation(offset: 0, length: BLOCK_SIZE,
hosts: {"host1:9866", "host2:9866, host3:9866"})
BlockLocation(offset: BLOCK_SIZE, length: BLOCK_SIZE,
hosts: {"host2:9866", "host3:9866, host4:9866"})
And if a file is erasure-coded, the returned BlockLocation are logical
block groups.
Suppose we have a RS_3_2 coded file (3 data units and 2 parity units).
1. If the file size is less than one stripe size, say 2 * CELL_SIZE, then
there will be one BlockLocation returned, with 0 offset, actual file size
and 4 hosts (2 data blocks and 2 parity blocks) hosting the actual blocks.
3. If the file size is less than one group size but greater than one
stripe size, then there will be one BlockLocation returned, with 0 offset,
actual file size with 5 hosts (3 data blocks and 2 parity blocks) hosting
the actual blocks.
4. If the file size is greater than one group size, 3 * BLOCK_SIZE + 123
for example, then the result will be like:
BlockLocation(offset: 0, length: 3 * BLOCK_SIZE, hosts: {"host1:9866",
"host2:9866","host3:9866","host4:9866","host5:9866"})
BlockLocation(offset: 3 * BLOCK_SIZE, length: 123, hosts: {"host1:9866",
"host4:9866", "host5:9866"})
getFileBlockLocations in class FileSystemfs - FilesStatus to get data fromstart - offset into the given filelen - length for which to get locations forjava.io.IOException - IO failurepublic FileChecksum getFileChecksum(Path f) throws AccessControlException, java.io.FileNotFoundException, java.io.IOException
FileSystemgetFileChecksum in class FileSystemf - The file pathjava.io.IOException - IO failureAccessControlExceptionjava.io.FileNotFoundExceptionpublic FileChecksum getFileChecksum(Path f, long length) throws AccessControlException, java.io.FileNotFoundException, java.io.IOException
FileSystemgetFileChecksum in class FileSystemf - The file pathlength - The length of the file range for checksum calculationjava.io.IOException - IO failureAccessControlExceptionjava.io.FileNotFoundExceptionpublic FileStatus getFileStatus(Path f) throws AccessControlException, java.io.FileNotFoundException, java.io.IOException
getFileStatus in class FileSystemf - The path we want information fromjava.io.FileNotFoundException - when the path does not existjava.io.IOException - see specific implementationAccessControlExceptionpublic void access(Path path, FsAction mode) throws AccessControlException, java.io.FileNotFoundException, java.io.IOException
FileSystemAccessControlException.
The default implementation calls FileSystem.getFileStatus(Path)
and checks the returned permissions against the requested permissions.
Note that the FileSystem.getFileStatus(Path) call will be subject to
authorization checks.
Typically, this requires search (execute) permissions on each directory in
the path's prefix, but this is implementation-defined. Any file system
that provides a richer authorization model (such as ACLs) may override the
default implementation so that it checks against that model instead.
In general, applications should avoid using this method, due to the risk of
time-of-check/time-of-use race conditions. The permissions on a file may
change immediately after the access call returns. Most applications should
prefer running specific file system actions as the desired user represented
by a UserGroupInformation.
access in class FileSystempath - Path to checkmode - type of access to checkAccessControlException - if access is deniedjava.io.FileNotFoundException - if the path does not existjava.io.IOException - see specific implementationpublic FileStatus[] listStatus(Path f) throws AccessControlException, java.io.FileNotFoundException, java.io.IOException
Does not guarantee to return the List of files/directories status in a sorted order.
Will not return null. Expect IOException upon access error.
Note: listStatus considers listing from fallbackLink if available. If the
same directory path is present in configured mount path as well as in
fallback fs, then only the fallback path will be listed in the returned
result except for link.
If any of the the immediate children of the given path f is a symlink(mount
link), the returned FileStatus object of that children would be represented
as a symlink. It will not be resolved to the target path and will not get
the target path FileStatus object. The target path will be available via
getSymlink on that children's FileStatus object. Since it represents as
symlink, isDirectory on that children's FileStatus will return false.
This behavior can be changed by setting an advanced configuration
fs.viewfs.mount.links.as.symlinks to false. In this case, mount points will
be represented as non-symlinks and all the file/directory attributes like
permissions, isDirectory etc will be assigned from it's resolved target
directory/file.
If you want to get the FileStatus of target path for that children, you may
want to use GetFileStatus API with that children's symlink path. Please see
getFileStatus(Path f)
Note: In ViewFileSystem, by default the mount links are represented as
symlinks.
listStatus in class FileSystemf - given pathjava.io.FileNotFoundException - when the path does not existjava.io.IOException - see specific implementationAccessControlExceptionpublic RemoteIterator<LocatedFileStatus> listLocatedStatus(Path f, PathFilter filter) throws java.io.FileNotFoundException, java.io.IOException
FileSystemlistLocatedStatus in class FileSystemf - a pathfilter - a path filterjava.io.FileNotFoundException - if f does not existjava.io.IOException - if any I/O error occurredpublic boolean mkdirs(Path dir) throws java.io.IOException
FileSystemFileSystem.mkdirs(Path, FsPermission) with default permission.mkdirs in class FileSystemdir - pathjava.io.IOException - IO failurepublic boolean mkdirs(Path dir, FsPermission permission) throws java.io.IOException
FileSystemmkdirs in class FileSystemdir - path to createpermission - to apply to fjava.io.IOException - IO failurepublic FSDataInputStream open(Path f, int bufferSize) throws AccessControlException, java.io.FileNotFoundException, java.io.IOException
FileSystemopen in class FileSystemf - the file name to openbufferSize - the size of the buffer to be used.java.io.IOException - IO failureAccessControlExceptionjava.io.FileNotFoundExceptionpublic boolean rename(Path src, Path dst) throws java.io.IOException
FileSystemrename in class FileSystemsrc - path to be renameddst - new path after renamejava.io.IOException - on failurepublic boolean truncate(Path f, long newLength) throws java.io.IOException
FileSystemtruncate in class FileSystemf - The path to the file to be truncatednewLength - The size the file is to be truncated totrue if the file has been truncated to the desired
newLength and is immediately available to be reused for
write operations such as append, or
false if a background process of adjusting the length of
the last block has been started, and clients should wait for it to
complete before proceeding with further file updates.java.io.IOException - IO failurepublic void setOwner(Path f, java.lang.String username, java.lang.String groupname) throws AccessControlException, java.io.FileNotFoundException, java.io.IOException
FileSystemsetOwner in class FileSystemf - The pathusername - If it is null, the original username remains unchanged.groupname - If it is null, the original groupname remains unchanged.java.io.IOException - IO failureAccessControlExceptionjava.io.FileNotFoundExceptionpublic void setPermission(Path f, FsPermission permission) throws AccessControlException, java.io.FileNotFoundException, java.io.IOException
FileSystemsetPermission in class FileSystemf - The pathpermission - permissionjava.io.IOException - IO failureAccessControlExceptionjava.io.FileNotFoundExceptionpublic boolean setReplication(Path f, short replication) throws AccessControlException, java.io.FileNotFoundException, java.io.IOException
FileSystemsetReplication in class FileSystemf - file namereplication - new replicationjava.io.IOException - an IO failure.AccessControlExceptionjava.io.FileNotFoundExceptionpublic void setTimes(Path f, long mtime, long atime) throws AccessControlException, java.io.FileNotFoundException, java.io.IOException
FileSystemsetTimes in class FileSystemf - The pathmtime - Set the modification time of this file.
The number of milliseconds since Jan 1, 1970.
A value of -1 means that this call should not set modification time.atime - Set the access time of this file.
The number of milliseconds since Jan 1, 1970.
A value of -1 means that this call should not set access time.java.io.IOException - IO failureAccessControlExceptionjava.io.FileNotFoundExceptionpublic void modifyAclEntries(Path path, java.util.List<AclEntry> aclSpec) throws java.io.IOException
FileSystemmodifyAclEntries in class FileSystempath - Path to modifyaclSpec - List<AclEntry> describing modificationsjava.io.IOException - if an ACL could not be modifiedpublic void removeAclEntries(Path path, java.util.List<AclEntry> aclSpec) throws java.io.IOException
FileSystemremoveAclEntries in class FileSystempath - Path to modifyaclSpec - List describing entries to removejava.io.IOException - if an ACL could not be modifiedpublic void removeDefaultAcl(Path path) throws java.io.IOException
FileSystemremoveDefaultAcl in class FileSystempath - Path to modifyjava.io.IOException - if an ACL could not be modifiedpublic void removeAcl(Path path) throws java.io.IOException
FileSystemremoveAcl in class FileSystempath - Path to modifyjava.io.IOException - if an ACL could not be removedpublic void setAcl(Path path, java.util.List<AclEntry> aclSpec) throws java.io.IOException
FileSystemsetAcl in class FileSystempath - Path to modifyaclSpec - List describing modifications, which must include entries
for user, group, and others for compatibility with permission bits.java.io.IOException - if an ACL could not be modifiedpublic AclStatus getAclStatus(Path path) throws java.io.IOException
FileSystemgetAclStatus in class FileSystempath - Path to getjava.io.IOException - if an ACL could not be readpublic void setXAttr(Path path, java.lang.String name, byte[] value, java.util.EnumSet<XAttrSetFlag> flag) throws java.io.IOException
FileSystemRefer to the HDFS extended attributes user documentation for details.
setXAttr in class FileSystempath - Path to modifyname - xattr name.value - xattr value.flag - xattr set flagjava.io.IOException - IO failurepublic byte[] getXAttr(Path path, java.lang.String name) throws java.io.IOException
FileSystemRefer to the HDFS extended attributes user documentation for details.
getXAttr in class FileSystempath - Path to get extended attributename - xattr name.java.io.IOException - IO failurepublic java.util.Map<java.lang.String,byte[]> getXAttrs(Path path) throws java.io.IOException
FileSystemRefer to the HDFS extended attributes user documentation for details.
getXAttrs in class FileSystempath - Path to get extended attributesjava.io.IOException - IO failurepublic java.util.Map<java.lang.String,byte[]> getXAttrs(Path path, java.util.List<java.lang.String> names) throws java.io.IOException
FileSystemRefer to the HDFS extended attributes user documentation for details.
getXAttrs in class FileSystempath - Path to get extended attributesnames - XAttr names.java.io.IOException - IO failurepublic java.util.List<java.lang.String> listXAttrs(Path path) throws java.io.IOException
FileSystemRefer to the HDFS extended attributes user documentation for details.
listXAttrs in class FileSystempath - Path to get extended attributesjava.io.IOException - IO failurepublic void removeXAttr(Path path, java.lang.String name) throws java.io.IOException
FileSystemRefer to the HDFS extended attributes user documentation for details.
removeXAttr in class FileSystempath - Path to remove extended attributename - xattr namejava.io.IOException - IO failurepublic void setVerifyChecksum(boolean verifyChecksum)
FileSystemsetVerifyChecksum in class FileSystemverifyChecksum - Verify checksum flagpublic long getDefaultBlockSize()
FileSystemgetDefaultBlockSize in class FileSystempublic short getDefaultReplication()
FileSystemgetDefaultReplication in class FileSystempublic FsServerDefaults getServerDefaults() throws java.io.IOException
FileSystemgetServerDefaults in class FileSystemjava.io.IOException - IO failurepublic long getDefaultBlockSize(Path f)
FileSystemgetDefaultBlockSize in class FileSystemf - path of filepublic short getDefaultReplication(Path f)
FileSystemgetDefaultReplication in class FileSystemf - of the filepublic FsServerDefaults getServerDefaults(Path f) throws java.io.IOException
FileSystemgetServerDefaults in class FileSystemf - path is used to identify an FS since an FS could have
another FS that it could be delegating the call tojava.io.IOException - IO failurepublic ContentSummary getContentSummary(Path f) throws java.io.IOException
FileSystemContentSummary of a given Path.getContentSummary in class FileSystemf - path to usejava.io.FileNotFoundException - if the path does not resolvejava.io.IOException - IO failurepublic QuotaUsage getQuotaUsage(Path f) throws java.io.IOException
FileSystemQuotaUsage of a given Path.getQuotaUsage in class FileSystemf - path to usejava.io.IOException - IO failurepublic void setWriteChecksum(boolean writeChecksum)
FileSystemsetWriteChecksum in class FileSystemwriteChecksum - Write checksum flagpublic FileSystem[] getChildFileSystems()
FileSystemgetChildFileSystems in class FileSystempublic ViewFileSystem.MountPoint[] getMountPoints()
public Path createSnapshot(Path path, java.lang.String snapshotName) throws java.io.IOException
FileSystemcreateSnapshot in class FileSystempath - The directory where snapshots will be taken.snapshotName - The name of the snapshotjava.io.IOException - IO failurepublic void renameSnapshot(Path path, java.lang.String snapshotOldName, java.lang.String snapshotNewName) throws java.io.IOException
FileSystemrenameSnapshot in class FileSystempath - The directory path where the snapshot was takensnapshotOldName - Old name of the snapshotsnapshotNewName - New name of the snapshotjava.io.IOException - IO failurepublic void deleteSnapshot(Path path, java.lang.String snapshotName) throws java.io.IOException
FileSystemdeleteSnapshot in class FileSystempath - The directory that the to-be-deleted snapshot belongs tosnapshotName - The name of the snapshotjava.io.IOException - IO failurepublic void satisfyStoragePolicy(Path src) throws java.io.IOException
FileSystemsatisfyStoragePolicy in class FileSystemsrc - The source path referring to either a directory or a file.java.io.IOException - If an I/O error occurred.public void setStoragePolicy(Path src, java.lang.String policyName) throws java.io.IOException
FileSystemsetStoragePolicy in class FileSystemsrc - file or directory path.policyName - the name of the target storage policy. The list
of supported Storage policies can be retrieved
via FileSystem.getAllStoragePolicies().java.io.IOException - IO failurepublic void unsetStoragePolicy(Path src) throws java.io.IOException
FileSystemunsetStoragePolicy in class FileSystemsrc - file or directory path.java.io.IOException - IO failurepublic BlockStoragePolicySpi getStoragePolicy(Path src) throws java.io.IOException
FileSystemgetStoragePolicy in class FileSystemsrc - file or directory path.java.io.IOException - IO failurepublic java.util.Collection<? extends BlockStoragePolicySpi> getAllStoragePolicies() throws java.io.IOException
FileSystemgetAllStoragePolicies in class FileSystemjava.io.IOException - IO failurepublic Path getTrashRoot(Path path)
getTrashRoot in class FileSystempath - the trash root of the path to be determined.public java.util.Collection<FileStatus> getTrashRoots(boolean allUsers)
getTrashRoots in class FileSystemallUsers - return trash roots for all users if true.public FsStatus getStatus() throws java.io.IOException
FileSystemgetStatus in class FileSystemjava.io.IOException - see specific implementationpublic FsStatus getStatus(Path p) throws java.io.IOException
FileSystemgetStatus in class FileSystemp - Path for which status should be obtained. null means
the default partition.java.io.IOException - see specific implementationpublic long getUsed()
throws java.io.IOException
Constants.CONFIG_VIEWFS_LINK_MERGE_SLASH is supported and is a valid
mount point. Else, throw NotInMountpointException.getUsed in class FileSystemjava.io.IOException - raised on errors performing I/O.public Path getLinkTarget(Path path) throws java.io.IOException
FileSystemgetLinkTarget in class FileSystempath - the path.java.io.IOException - IO failure.public boolean hasPathCapability(Path path, java.lang.String capability) throws java.io.IOException
hasPathCapability in interface PathCapabilitieshasPathCapability in class FileSystempath - path to query the capability of.capability - string to query the stream support for.java.io.IOException - if there is no resolved FS, or it raises an IOE.public Path getEnclosingRoot(Path path) throws java.io.IOException
FileSystemgetEnclosingRoot in class FileSystempath - file path to find the enclosing root path forjava.io.IOException - early checks like failure to resolve path cause IO failurespublic void close()
throws java.io.IOException
FileSystemFileSystem.deleteOnExit(Path), and remove this FS instance
from the cache, if cached.
After this operation, the outcome of any method call on this FileSystem
instance, or any input/output stream created by it is undefined.close in interface java.lang.AutoCloseableclose in interface java.io.Closeableclose in class FileSystemjava.io.IOException - IO failureCopyright © 2008–2025 Apache Software Foundation. All rights reserved.