org.apache.hadoop.fs

## Class AbstractFileSystem

- java.lang.Object
- - org.apache.hadoop.fs.AbstractFileSystem

- All Implemented Interfaces:
    PathCapabilities
  Direct Known Subclasses:
    org.apache.hadoop.fs.DelegateToFileSystem, ViewFs

      @InterfaceAudience.Public
       @InterfaceStability.Stable
      public abstract class AbstractFileSystem
      extends Object
      implements PathCapabilities

  This class provides an interface for implementors of a Hadoop file system (analogous to the VFS of Unix). Applications do not access this class; instead they access files across all file systems using `FileContext`. Pathnames passed to AbstractFileSystem can be fully qualified URI that matches the "this" file system (ie same scheme and authority) or a Slash-relative name that is assumed to be relative to the root of the "this" file system .

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected FileSystem.Statistics` | `statistics` The statistics for this file system.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractFileSystem(URI uri, String supportedScheme, boolean authorityNeeded, int defaultPort)` Constructor to be called by subclasses.

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `checkPath(Path path)` Check that a Path belongs to this FileSystem.
    `void` | `checkScheme(URI uri, String supportedScheme)` Check that the Uri's scheme matches
    `static void` | `clearStatistics()`
    `FSDataOutputStream` | `create(Path f, EnumSet<CreateFlag> createFlag, Options.CreateOpts... opts)` The specification of this method matches that of `FileContext.create(Path, EnumSet, Options.CreateOpts...)` except that the Path f must be fully qualified and the permission is absolute (i.e.
    `static AbstractFileSystem` | `createFileSystem(URI uri, Configuration conf)` Create a file system instance for the specified uri using the conf.
    `abstract FSDataOutputStream` | `createInternal(Path f, EnumSet<CreateFlag> flag, FsPermission absolutePermission, int bufferSize, short replication, long blockSize, Progressable progress, Options.ChecksumOpt checksumOpt, boolean createParent)` The specification of this method matches that of `create(Path, EnumSet, Options.CreateOpts...)` except that the opts have been declared explicitly.
    `Path` | `createSnapshot(Path path, String snapshotName)` The specification of this method matches that of `FileContext.createSnapshot(Path, String)`.
    `void` | `createSymlink(Path target, Path link, boolean createParent)` The specification of this method matches that of `FileContext.createSymlink(Path, Path, boolean)`;
    `abstract boolean` | `delete(Path f, boolean recursive)` The specification of this method matches that of `FileContext.delete(Path, boolean)` except that Path f must be for this file system.
    `void` | `deleteSnapshot(Path snapshotDir, String snapshotName)` The specification of this method matches that of `FileContext.deleteSnapshot(Path, String)`.
    `boolean` | `equals(Object other)`
    `static AbstractFileSystem` | `get(URI uri, Configuration conf)` The main factory method for creating a file system.
    `AclStatus` | `getAclStatus(Path path)` Gets the ACLs of files and directories.
    `protected static Map<URI,FileSystem.Statistics>` | `getAllStatistics()`
    `Collection<? extends BlockStoragePolicySpi>` | `getAllStoragePolicies()` Retrieve all the storage policies supported by this file system.
    `String` | `getCanonicalServiceName()` Get a canonical name for this file system.
    `abstract BlockLocation[]` | `getFileBlockLocations(Path f, long start, long len)` The specification of this method matches that of `FileContext.getFileBlockLocations(Path, long, long)` except that Path f must be for this file system.
    `abstract FileChecksum` | `getFileChecksum(Path f)` The specification of this method matches that of `FileContext.getFileChecksum(Path)` except that Path f must be for this file system.
    `FileStatus` | `getFileLinkStatus(Path f)` The specification of this method matches that of `FileContext.getFileLinkStatus(Path)` except that an UnresolvedLinkException may be thrown if a symlink is encountered in the path leading up to the final path component.
    `abstract FileStatus` | `getFileStatus(Path f)` The specification of this method matches that of `FileContext.getFileStatus(Path)` except that an UnresolvedLinkException may be thrown if a symlink is encountered in the path.
    `abstract FsStatus` | `getFsStatus()` The specification of this method matches that of `FileContext.getFsStatus(Path)`.
    `FsStatus` | `getFsStatus(Path f)` The specification of this method matches that of `FileContext.getFsStatus(Path)` except that Path f must be for this file system.
    `Path` | `getHomeDirectory()` Return the current user's home directory in this file system.
    `Path` | `getInitialWorkingDirectory()` Some file systems like LocalFileSystem have an initial workingDir that is used as the starting workingDir.
    `Path` | `getLinkTarget(Path f)` Partially resolves the path.
    `abstract FsServerDefaults` | `getServerDefaults()` Deprecated. use `getServerDefaults(Path)` instead
    `FsServerDefaults` | `getServerDefaults(Path f)` Return a set of server default configuration values based on path.
    `FileSystem.Statistics` | `getStatistics()`
    `protected static FileSystem.Statistics` | `getStatistics(URI uri)` Get the statistics for a particular file system.
    `BlockStoragePolicySpi` | `getStoragePolicy(Path src)` Retrieve the storage policy for a given file or directory.
    `URI` | `getUri()` Returns a URI whose scheme and authority identify this FileSystem.
    `abstract int` | `getUriDefaultPort()` The default port of this file system.
    `String` | `getUriPath(Path p)` Get the path-part of a pathname.
    `byte[]` | `getXAttr(Path path, String name)` Get an xattr for a file or directory.
    `Map<String,byte[]>` | `getXAttrs(Path path)` Get all of the xattrs for a file or directory.
    `Map<String,byte[]>` | `getXAttrs(Path path, List<String> names)` Get all of the xattrs for a file or directory.
    `int` | `hashCode()`
    `boolean` | `hasPathCapability(Path path, String capability)` Probe for a specific capability under the given path.
    `boolean` | `isValidName(String src)` Returns true if the specified string is considered valid in the path part of a URI by this file system.
    `RemoteIterator<Path>` | `listCorruptFileBlocks(Path path)`
    `RemoteIterator<LocatedFileStatus>` | `listLocatedStatus(Path f)` The specification of this method matches that of `FileContext.listLocatedStatus(Path)` except that Path f must be for this file system.
    `abstract FileStatus[]` | `listStatus(Path f)` The specification of this method matches that of `FileContext.Util.listStatus(Path)` except that Path f must be for this file system.
    `RemoteIterator<FileStatus>` | `listStatusIterator(Path f)` The specification of this method matches that of `FileContext.listStatus(Path)` except that Path f must be for this file system.
    `List<String>` | `listXAttrs(Path path)` Get all of the xattr names for a file or directory.
    `Path` | `makeQualified(Path path)` Make the path fully qualified to this file system
    `abstract void` | `mkdir(Path dir, FsPermission permission, boolean createParent)` The specification of this method matches that of `FileContext.mkdir(Path, FsPermission, boolean)` except that the Path f must be fully qualified and the permission is absolute (i.e.
    `void` | `modifyAclEntries(Path path, List<AclEntry> aclSpec)` Modifies ACL entries of files and directories.
    `void` | `msync()` Synchronize client metadata state.
    `FSDataInputStream` | `open(Path f)` The specification of this method matches that of `FileContext.open(Path)` except that Path f must be for this file system.
    `abstract FSDataInputStream` | `open(Path f, int bufferSize)` The specification of this method matches that of `FileContext.open(Path, int)` except that Path f must be for this file system.
    `static void` | `printStatistics()` Prints statistics for all file systems.
    `void` | `removeAcl(Path path)` Removes all but the base ACL entries of files and directories.
    `void` | `removeAclEntries(Path path, 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, String name)` Remove an xattr of a file or directory.
    `void` | `rename(Path src, Path dst, Options.Rename... options)` The specification of this method matches that of `FileContext.rename(Path, Path, Options.Rename...)` except that Path f must be for this file system.
    `abstract void` | `renameInternal(Path src, Path dst)` The specification of this method matches that of `FileContext.rename(Path, Path, Options.Rename...)` except that Path f must be for this file system and NO OVERWRITE is performed.
    `void` | `renameInternal(Path src, Path dst, boolean overwrite)` The specification of this method matches that of `FileContext.rename(Path, Path, Options.Rename...)` except that Path f must be for this file system.
    `void` | `renameSnapshot(Path path, String snapshotOldName, String snapshotNewName)` The specification of this method matches that of `FileContext.renameSnapshot(Path, String, String)`.
    `Path` | `resolvePath(Path p)` Return the fully-qualified path of path f resolving the path through any internal symlinks or mount point
    `void` | `satisfyStoragePolicy(Path path)` Set the source path to satisfy storage policy.
    `void` | `setAcl(Path path, List<AclEntry> aclSpec)` Fully replaces ACL of files and directories, discarding all existing entries.
    `abstract void` | `setOwner(Path f, String username, String groupname)` The specification of this method matches that of `FileContext.setOwner(Path, String, String)` except that Path f must be for this file system.
    `abstract void` | `setPermission(Path f, FsPermission permission)` The specification of this method matches that of `FileContext.setPermission(Path, FsPermission)` except that Path f must be for this file system.
    `abstract boolean` | `setReplication(Path f, short replication)` The specification of this method matches that of `FileContext.setReplication(Path, short)` except that Path f must be for this file system.
    `void` | `setStoragePolicy(Path path, String policyName)` Set the storage policy for a given file or directory.
    `abstract void` | `setTimes(Path f, long mtime, long atime)` The specification of this method matches that of `FileContext.setTimes(Path, long, long)` except that Path f must be for this file system.
    `abstract void` | `setVerifyChecksum(boolean verifyChecksum)` The specification of this method matches that of `FileContext.setVerifyChecksum(boolean, Path)` except that Path f must be for this file system.
    `void` | `setXAttr(Path path, String name, byte[] value)` Set an xattr of a file or directory.
    `void` | `setXAttr(Path path, String name, byte[] value, EnumSet<XAttrSetFlag> flag)` Set an xattr of a file or directory.
    `boolean` | `supportsSymlinks()` Returns true if the file system supports symlinks, false otherwise.
    `boolean` | `truncate(Path f, long newLength)` The specification of this method matches that of `FileContext.truncate(Path, long)` except that Path f must be for this file system.
    `void` | `unsetStoragePolicy(Path src)` Unset the storage policy set for a given file or directory.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### statistics

          protected FileSystem.Statistics statistics

      The statistics for this file system.

  - ### Constructor Detail

    - #### AbstractFileSystem

          public AbstractFileSystem(URI uri,
                                    String supportedScheme,
                                    boolean authorityNeeded,
                                    int defaultPort)
                             throws URISyntaxException

      Constructor to be called by subclasses.
      Parameters:
        `uri` - for this file system.
        `supportedScheme` - the scheme supported by the implementor
        `authorityNeeded` - if true then theURI must have authority, if false then the URI must have null authority.
      Throws:
        `URISyntaxException` - `uri` has syntax error

  - ### Method Detail

    - #### getStatistics

          public FileSystem.Statistics getStatistics()

    - #### isValidName

          public boolean isValidName(String src)

      Returns true if the specified string is considered valid in the path part of a URI by this file system. The default implementation enforces the rules of HDFS, but subclasses may override this method to implement specific validation rules for specific file systems.
      Parameters:
        `src` - String source filename to check, path part of the URI
      Returns:
        boolean true if the specified string is considered valid

    - #### createFileSystem

          public static AbstractFileSystem createFileSystem(URI uri,
                                                            Configuration conf)
                                                     throws UnsupportedFileSystemException

      Create a file system instance for the specified uri using the conf. The conf is used to find the class name that implements the file system. The conf is also passed to the file system for its configuration.
      Parameters:
        `uri` - URI of the file system
        `conf` - Configuration for the file system
      Returns:
        Returns the file system for the given URI
      Throws:
        `UnsupportedFileSystemException` - file system for `uri` is not found

    - #### getStatistics

          protected static FileSystem.Statistics getStatistics(URI uri)

      Get the statistics for a particular file system.
      Parameters:
        `uri` - used as key to lookup STATISTICS_TABLE. Only scheme and authority part of the uri are used.
      Returns:
        a statistics object

    - #### clearStatistics

          public static void clearStatistics()

    - #### printStatistics

          public static void printStatistics()

      Prints statistics for all file systems.

    - #### getAllStatistics

          protected static Map<URI,FileSystem.Statistics> getAllStatistics()

    - #### get

          public static AbstractFileSystem get(URI uri,
                                               Configuration conf)
                                        throws UnsupportedFileSystemException

      The main factory method for creating a file system. Get a file system for the URI's scheme and authority. The scheme of the `uri` determines a configuration property name, `fs.AbstractFileSystem.scheme.impl` whose value names the AbstractFileSystem class. The entire URI and conf is passed to the AbstractFileSystem factory method.
      Parameters:
        `uri` - for the file system to be created.
        `conf` - which is passed to the file system impl.
      Returns:
        file system for the given URI.
      Throws:
        `UnsupportedFileSystemException` - if the file system for `uri` is not supported.

    - #### checkScheme

          public void checkScheme(URI uri,
                                  String supportedScheme)

      Check that the Uri's scheme matches
      Parameters:
        `uri` -
        `supportedScheme` -

    - #### getUriDefaultPort

          public abstract int getUriDefaultPort()

      The default port of this file system.
      Returns:
        default port of this file system's Uri scheme A uri with a port of -1 => default port;

    - #### getUri

          public URI getUri()

      Returns a URI whose scheme and authority identify this FileSystem.
      Returns:
        the uri of this file system.

    - #### checkPath

          public void checkPath(Path path)

      Check that a Path belongs to this FileSystem. If the path is fully qualified URI, then its scheme and authority matches that of this file system. Otherwise the path must be slash-relative name.
      Throws:
        `InvalidPathException` - if the path is invalid

    - #### getUriPath

          public String getUriPath(Path p)

      Get the path-part of a pathname. Checks that URI matches this file system and that the path-part is a valid name.
      Parameters:
        `p` - path
      Returns:
        path-part of the Path p

    - #### makeQualified

          public Path makeQualified(Path path)

      Make the path fully qualified to this file system
      Parameters:
        `path` -
      Returns:
        the qualified path

    - #### getInitialWorkingDirectory

          public Path getInitialWorkingDirectory()

      Some file systems like LocalFileSystem have an initial workingDir that is used as the starting workingDir. For other file systems like HDFS there is no built in notion of an initial workingDir.
      Returns:
        the initial workingDir if the file system has such a notion otherwise return a null.

    - #### getHomeDirectory

          public Path getHomeDirectory()

      Return the current user's home directory in this file system. The default implementation returns "/user/$USER/".
      Returns:
        current user's home directory.

    - #### getServerDefaults

          @Deprecated
          public abstract FsServerDefaults getServerDefaults()
                                                                  throws IOException

      Deprecated. use `getServerDefaults(Path)` instead
      Return a set of server default configuration values.
      Returns:
        server default configuration values
      Throws:
        `IOException` - an I/O error occurred

    - #### getServerDefaults

          public FsServerDefaults getServerDefaults(Path f)
                                             throws IOException

      Return a set of server default configuration values based on path.
      Parameters:
        `f` - path to fetch server defaults
      Returns:
        server default configuration values for path
      Throws:
        `IOException` - an I/O error occurred

    - #### resolvePath

          public Path resolvePath(Path p)
                           throws FileNotFoundException,
                                  org.apache.hadoop.fs.UnresolvedLinkException,
                                  AccessControlException,
                                  IOException

      Return the fully-qualified path of path f resolving the path through any internal symlinks or mount point
      Parameters:
        `p` - path to be resolved
      Returns:
        fully qualified path
      Throws:
        `FileNotFoundException,` - AccessControlException, IOException UnresolvedLinkException if symbolic link on path cannot be resolved internally
        `FileNotFoundException`
        `org.apache.hadoop.fs.UnresolvedLinkException`
        `AccessControlException`
        `IOException`

    - #### create

          public final FSDataOutputStream create(Path f,
                                                 EnumSet<CreateFlag> createFlag,
                                                 Options.CreateOpts... opts)
                                          throws AccessControlException,
                                                 FileAlreadyExistsException,
                                                 FileNotFoundException,
                                                 ParentNotDirectoryException,
                                                 UnsupportedFileSystemException,
                                                 org.apache.hadoop.fs.UnresolvedLinkException,
                                                 IOException

      The specification of this method matches that of `FileContext.create(Path, EnumSet, Options.CreateOpts...)` except that the Path f must be fully qualified and the permission is absolute (i.e. umask has been applied).
      Throws:
        `AccessControlException`
        `FileAlreadyExistsException`
        `FileNotFoundException`
        `ParentNotDirectoryException`
        `UnsupportedFileSystemException`
        `org.apache.hadoop.fs.UnresolvedLinkException`
        `IOException`

    - #### createInternal

          public abstract FSDataOutputStream createInternal(Path f,
                                                            EnumSet<CreateFlag> flag,
                                                            FsPermission absolutePermission,
                                                            int bufferSize,
                                                            short replication,
                                                            long blockSize,
                                                            Progressable progress,
                                                            Options.ChecksumOpt checksumOpt,
                                                            boolean createParent)
                                                     throws AccessControlException,
                                                            FileAlreadyExistsException,
                                                            FileNotFoundException,
                                                            ParentNotDirectoryException,
                                                            UnsupportedFileSystemException,
                                                            org.apache.hadoop.fs.UnresolvedLinkException,
                                                            IOException

      The specification of this method matches that of `create(Path, EnumSet, Options.CreateOpts...)` except that the opts have been declared explicitly.
      Throws:
        `AccessControlException`
        `FileAlreadyExistsException`
        `FileNotFoundException`
        `ParentNotDirectoryException`
        `UnsupportedFileSystemException`
        `org.apache.hadoop.fs.UnresolvedLinkException`
        `IOException`

    - #### mkdir

          public abstract void mkdir(Path dir,
                                     FsPermission permission,
                                     boolean createParent)
                              throws AccessControlException,
                                     FileAlreadyExistsException,
                                     FileNotFoundException,
                                     org.apache.hadoop.fs.UnresolvedLinkException,
                                     IOException

      The specification of this method matches that of `FileContext.mkdir(Path, FsPermission, boolean)` except that the Path f must be fully qualified and the permission is absolute (i.e. umask has been applied).
      Throws:
        `AccessControlException`
        `FileAlreadyExistsException`
        `FileNotFoundException`
        `org.apache.hadoop.fs.UnresolvedLinkException`
        `IOException`

    - #### delete

          public abstract boolean delete(Path f,
                                         boolean recursive)
                                  throws AccessControlException,
                                         FileNotFoundException,
                                         org.apache.hadoop.fs.UnresolvedLinkException,
                                         IOException

      The specification of this method matches that of `FileContext.delete(Path, boolean)` except that Path f must be for this file system.
      Throws:
        `AccessControlException`
        `FileNotFoundException`
        `org.apache.hadoop.fs.UnresolvedLinkException`
        `IOException`

    - #### open

          public FSDataInputStream open(Path f)
                                 throws AccessControlException,
                                        FileNotFoundException,
                                        org.apache.hadoop.fs.UnresolvedLinkException,
                                        IOException

      The specification of this method matches that of `FileContext.open(Path)` except that Path f must be for this file system.
      Throws:
        `AccessControlException`
        `FileNotFoundException`
        `org.apache.hadoop.fs.UnresolvedLinkException`
        `IOException`

    - #### open

          public abstract FSDataInputStream open(Path f,
                                                 int bufferSize)
                                          throws AccessControlException,
                                                 FileNotFoundException,
                                                 org.apache.hadoop.fs.UnresolvedLinkException,
                                                 IOException

      The specification of this method matches that of `FileContext.open(Path, int)` except that Path f must be for this file system.
      Throws:
        `AccessControlException`
        `FileNotFoundException`
        `org.apache.hadoop.fs.UnresolvedLinkException`
        `IOException`

    - #### truncate

          public boolean truncate(Path f,
                                  long newLength)
                           throws AccessControlException,
                                  FileNotFoundException,
                                  org.apache.hadoop.fs.UnresolvedLinkException,
                                  IOException

      The specification of this method matches that of `FileContext.truncate(Path, long)` except that Path f must be for this file system.
      Throws:
        `AccessControlException`
        `FileNotFoundException`
        `org.apache.hadoop.fs.UnresolvedLinkException`
        `IOException`

    - #### setReplication

          public abstract boolean setReplication(Path f,
                                                 short replication)
                                          throws AccessControlException,
                                                 FileNotFoundException,
                                                 org.apache.hadoop.fs.UnresolvedLinkException,
                                                 IOException

      The specification of this method matches that of `FileContext.setReplication(Path, short)` except that Path f must be for this file system.
      Throws:
        `AccessControlException`
        `FileNotFoundException`
        `org.apache.hadoop.fs.UnresolvedLinkException`
        `IOException`

    - #### rename

          public final void rename(Path src,
                                   Path dst,
                                   Options.Rename... options)
                            throws AccessControlException,
                                   FileAlreadyExistsException,
                                   FileNotFoundException,
                                   ParentNotDirectoryException,
                                   org.apache.hadoop.fs.UnresolvedLinkException,
                                   IOException

      The specification of this method matches that of `FileContext.rename(Path, Path, Options.Rename...)` except that Path f must be for this file system.
      Throws:
        `AccessControlException`
        `FileAlreadyExistsException`
        `FileNotFoundException`
        `ParentNotDirectoryException`
        `org.apache.hadoop.fs.UnresolvedLinkException`
        `IOException`

    - #### renameInternal

          public abstract void renameInternal(Path src,
                                              Path dst)
                                       throws AccessControlException,
                                              FileAlreadyExistsException,
                                              FileNotFoundException,
                                              ParentNotDirectoryException,
                                              org.apache.hadoop.fs.UnresolvedLinkException,
                                              IOException

      The specification of this method matches that of `FileContext.rename(Path, Path, Options.Rename...)` except that Path f must be for this file system and NO OVERWRITE is performed. File systems that do not have a built in overwrite need implement only this method and can take advantage of the default impl of the other `renameInternal(Path, Path, boolean)`
      Throws:
        `AccessControlException`
        `FileAlreadyExistsException`
        `FileNotFoundException`
        `ParentNotDirectoryException`
        `org.apache.hadoop.fs.UnresolvedLinkException`
        `IOException`

    - #### renameInternal

          public void renameInternal(Path src,
                                     Path dst,
                                     boolean overwrite)
                              throws AccessControlException,
                                     FileAlreadyExistsException,
                                     FileNotFoundException,
                                     ParentNotDirectoryException,
                                     org.apache.hadoop.fs.UnresolvedLinkException,
                                     IOException

      The specification of this method matches that of `FileContext.rename(Path, Path, Options.Rename...)` except that Path f must be for this file system.
      Throws:
        `AccessControlException`
        `FileAlreadyExistsException`
        `FileNotFoundException`
        `ParentNotDirectoryException`
        `org.apache.hadoop.fs.UnresolvedLinkException`
        `IOException`

    - #### supportsSymlinks

          public boolean supportsSymlinks()

      Returns true if the file system supports symlinks, false otherwise.
      Returns:
        true if filesystem supports symlinks

    - #### createSymlink

          public void createSymlink(Path target,
                                    Path link,
                                    boolean createParent)
                             throws IOException,
                                    org.apache.hadoop.fs.UnresolvedLinkException

      The specification of this method matches that of `FileContext.createSymlink(Path, Path, boolean)`;
      Throws:
        `IOException`
        `org.apache.hadoop.fs.UnresolvedLinkException`

    - #### getLinkTarget

          public Path getLinkTarget(Path f)
                             throws IOException

      Partially resolves the path. This is used during symlink resolution in `FSLinkResolver`, and differs from the similarly named method `FileContext.getLinkTarget(Path)`.
      Throws:
        `IOException` - subclass implementations may throw IOException

    - #### setPermission

          public abstract void setPermission(Path f,
                                             FsPermission permission)
                                      throws AccessControlException,
                                             FileNotFoundException,
                                             org.apache.hadoop.fs.UnresolvedLinkException,
                                             IOException

      The specification of this method matches that of `FileContext.setPermission(Path, FsPermission)` except that Path f must be for this file system.
      Throws:
        `AccessControlException`
        `FileNotFoundException`
        `org.apache.hadoop.fs.UnresolvedLinkException`
        `IOException`

    - #### setOwner

          public abstract void setOwner(Path f,
                                        String username,
                                        String groupname)
                                 throws AccessControlException,
                                        FileNotFoundException,
                                        org.apache.hadoop.fs.UnresolvedLinkException,
                                        IOException

      The specification of this method matches that of `FileContext.setOwner(Path, String, String)` except that Path f must be for this file system.
      Throws:
        `AccessControlException`
        `FileNotFoundException`
        `org.apache.hadoop.fs.UnresolvedLinkException`
        `IOException`

    - #### setTimes

          public abstract void setTimes(Path f,
                                        long mtime,
                                        long atime)
                                 throws AccessControlException,
                                        FileNotFoundException,
                                        org.apache.hadoop.fs.UnresolvedLinkException,
                                        IOException

      The specification of this method matches that of `FileContext.setTimes(Path, long, long)` except that Path f must be for this file system.
      Throws:
        `AccessControlException`
        `FileNotFoundException`
        `org.apache.hadoop.fs.UnresolvedLinkException`
        `IOException`

    - #### getFileChecksum

          public abstract FileChecksum getFileChecksum(Path f)
                                                throws AccessControlException,
                                                       FileNotFoundException,
                                                       org.apache.hadoop.fs.UnresolvedLinkException,
                                                       IOException

      The specification of this method matches that of `FileContext.getFileChecksum(Path)` except that Path f must be for this file system.
      Throws:
        `AccessControlException`
        `FileNotFoundException`
        `org.apache.hadoop.fs.UnresolvedLinkException`
        `IOException`

    - #### getFileStatus

          public abstract FileStatus getFileStatus(Path f)
                                            throws AccessControlException,
                                                   FileNotFoundException,
                                                   org.apache.hadoop.fs.UnresolvedLinkException,
                                                   IOException

      The specification of this method matches that of `FileContext.getFileStatus(Path)` except that an UnresolvedLinkException may be thrown if a symlink is encountered in the path.
      Throws:
        `AccessControlException`
        `FileNotFoundException`
        `org.apache.hadoop.fs.UnresolvedLinkException`
        `IOException`

    - #### msync

          public void msync()
                     throws IOException,
                            UnsupportedOperationException

      Synchronize client metadata state.

      In some FileSystem implementations such as HDFS metadata synchronization is essential to guarantee consistency of read requests particularly in HA setting.

      Throws:
        `IOException`
        `UnsupportedOperationException`

    - #### getFileLinkStatus

          public FileStatus getFileLinkStatus(Path f)
                                       throws AccessControlException,
                                              FileNotFoundException,
                                              UnsupportedFileSystemException,
                                              IOException

      The specification of this method matches that of `FileContext.getFileLinkStatus(Path)` except that an UnresolvedLinkException may be thrown if a symlink is encountered in the path leading up to the final path component. If the file system does not support symlinks then the behavior is equivalent to `getFileStatus(Path)`.
      Throws:
        `AccessControlException`
        `FileNotFoundException`
        `UnsupportedFileSystemException`
        `IOException`

    - #### getFileBlockLocations

          public abstract BlockLocation[] getFileBlockLocations(Path f,
                                                                long start,
                                                                long len)
                                                         throws AccessControlException,
                                                                FileNotFoundException,
                                                                org.apache.hadoop.fs.UnresolvedLinkException,
                                                                IOException

      The specification of this method matches that of `FileContext.getFileBlockLocations(Path, long, long)` except that Path f must be for this file system.
      Throws:
        `AccessControlException`
        `FileNotFoundException`
        `org.apache.hadoop.fs.UnresolvedLinkException`
        `IOException`

    - #### getFsStatus

          public FsStatus getFsStatus(Path f)
                               throws AccessControlException,
                                      FileNotFoundException,
                                      org.apache.hadoop.fs.UnresolvedLinkException,
                                      IOException

      The specification of this method matches that of `FileContext.getFsStatus(Path)` except that Path f must be for this file system.
      Throws:
        `AccessControlException`
        `FileNotFoundException`
        `org.apache.hadoop.fs.UnresolvedLinkException`
        `IOException`

    - #### getFsStatus

          public abstract FsStatus getFsStatus()
                                        throws AccessControlException,
                                               FileNotFoundException,
                                               IOException

      The specification of this method matches that of `FileContext.getFsStatus(Path)`.
      Throws:
        `AccessControlException`
        `FileNotFoundException`
        `IOException`

    - #### listStatusIterator

          public RemoteIterator<FileStatus> listStatusIterator(Path f)
                                                        throws AccessControlException,
                                                               FileNotFoundException,
                                                               org.apache.hadoop.fs.UnresolvedLinkException,
                                                               IOException

      The specification of this method matches that of `FileContext.listStatus(Path)` except that Path f must be for this file system.
      Throws:
        `AccessControlException`
        `FileNotFoundException`
        `org.apache.hadoop.fs.UnresolvedLinkException`
        `IOException`

    - #### listLocatedStatus

          public RemoteIterator<LocatedFileStatus> listLocatedStatus(Path f)
                                                              throws AccessControlException,
                                                                     FileNotFoundException,
                                                                     org.apache.hadoop.fs.UnresolvedLinkException,
                                                                     IOException

      The specification of this method matches that of `FileContext.listLocatedStatus(Path)` except that Path f must be for this file system. In HDFS implementation, the BlockLocation of returned LocatedFileStatus will have different formats for replicated and erasure coded file. Please refer to `FileSystem.getFileBlockLocations(FileStatus, long, long)` for more details.
      Throws:
        `AccessControlException`
        `FileNotFoundException`
        `org.apache.hadoop.fs.UnresolvedLinkException`
        `IOException`

    - #### listStatus

          public abstract FileStatus[] listStatus(Path f)
                                           throws AccessControlException,
                                                  FileNotFoundException,
                                                  org.apache.hadoop.fs.UnresolvedLinkException,
                                                  IOException

      The specification of this method matches that of `FileContext.Util.listStatus(Path)` except that Path f must be for this file system.
      Throws:
        `AccessControlException`
        `FileNotFoundException`
        `org.apache.hadoop.fs.UnresolvedLinkException`
        `IOException`

    - #### listCorruptFileBlocks

          public RemoteIterator<Path> listCorruptFileBlocks(Path path)
                                                     throws IOException

      Returns:
        an iterator over the corrupt files under the given path (may contain duplicates if a file has more than one corrupt block)
      Throws:
        `IOException`

    - #### setVerifyChecksum

          public abstract void setVerifyChecksum(boolean verifyChecksum)
                                          throws AccessControlException,
                                                 IOException

      The specification of this method matches that of `FileContext.setVerifyChecksum(boolean, Path)` except that Path f must be for this file system.
      Throws:
        `AccessControlException`
        `IOException`

    - #### getCanonicalServiceName

          public String getCanonicalServiceName()

      Get a canonical name for this file system.
      Returns:
        a URI string that uniquely identifies this file system

    - #### modifyAclEntries

          public void modifyAclEntries(Path path,
                                       List<AclEntry> aclSpec)
                                throws IOException

      Modifies ACL entries of files and directories. This method can add new ACL entries or modify the permissions on existing ACL entries. All existing ACL entries that are not specified in this call are retained without changes. (Modifications are merged into the current ACL.)
      Parameters:
        `path` - Path to modify
        `aclSpec` - List describing modifications
      Throws:
        `IOException` - if an ACL could not be modified

    - #### removeAclEntries

          public void removeAclEntries(Path path,
                                       List<AclEntry> aclSpec)
                                throws IOException

      Removes ACL entries from files and directories. Other ACL entries are retained.
      Parameters:
        `path` - Path to modify
        `aclSpec` - List describing entries to remove
      Throws:
        `IOException` - if an ACL could not be modified

    - #### removeDefaultAcl

          public void removeDefaultAcl(Path path)
                                throws IOException

      Removes all default ACL entries from files and directories.
      Parameters:
        `path` - Path to modify
      Throws:
        `IOException` - if an ACL could not be modified

    - #### removeAcl

          public void removeAcl(Path path)
                         throws IOException

      Removes all but the base ACL entries of files and directories. The entries for user, group, and others are retained for compatibility with permission bits.
      Parameters:
        `path` - Path to modify
      Throws:
        `IOException` - if an ACL could not be removed

    - #### setAcl

          public void setAcl(Path path,
                             List<AclEntry> aclSpec)
                      throws IOException

      Fully replaces ACL of files and directories, discarding all existing entries.
      Parameters:
        `path` - Path to modify
        `aclSpec` - List describing modifications, must include entries for user, group, and others for compatibility with permission bits.
      Throws:
        `IOException` - if an ACL could not be modified

    - #### getAclStatus

          public AclStatus getAclStatus(Path path)
                                 throws IOException

      Gets the ACLs of files and directories.
      Parameters:
        `path` - Path to get
      Returns:
        RemoteIterator which returns each AclStatus
      Throws:
        `IOException` - if an ACL could not be read

    - #### setXAttr

          public void setXAttr(Path path,
                               String name,
                               byte[] value)
                        throws IOException

      Set an xattr of a file or directory. The name must be prefixed with the namespace followed by ".". For example, "user.attr".

      Refer to the HDFS extended attributes user documentation for details.
      Parameters:
        `path` - Path to modify
        `name` - xattr name.
        `value` - xattr value.
      Throws:
        `IOException`

    - #### setXAttr

          public void setXAttr(Path path,
                               String name,
                               byte[] value,
                               EnumSet<XAttrSetFlag> flag)
                        throws IOException

      Set an xattr of a file or directory. The name must be prefixed with the namespace followed by ".". For example, "user.attr".

      Refer to the HDFS extended attributes user documentation for details.
      Parameters:
        `path` - Path to modify
        `name` - xattr name.
        `value` - xattr value.
        `flag` - xattr set flag
      Throws:
        `IOException`

    - #### getXAttr

          public byte[] getXAttr(Path path,
                                 String name)
                          throws IOException

      Get an xattr for a file or directory. The name must be prefixed with the namespace followed by ".". For example, "user.attr".

      Refer to the HDFS extended attributes user documentation for details.
      Parameters:
        `path` - Path to get extended attribute
        `name` - xattr name.
      Returns:
        byte[] xattr value.
      Throws:
        `IOException`

    - #### getXAttrs

          public Map<String,byte[]> getXAttrs(Path path)
                                       throws IOException

      Get all of the xattrs for a file or directory. Only those xattrs for which the logged-in user has permissions to view are returned.

      Refer to the HDFS extended attributes user documentation for details.
      Parameters:
        `path` - Path to get extended attributes
      Returns:
        Map describing the XAttrs of the file or directory
      Throws:
        `IOException`

    - #### getXAttrs

          public Map<String,byte[]> getXAttrs(Path path,
                                              List<String> names)
                                       throws IOException

      Get all of the xattrs for a file or directory. Only those xattrs for which the logged-in user has permissions to view are returned.

      Refer to the HDFS extended attributes user documentation for details.
      Parameters:
        `path` - Path to get extended attributes
        `names` - XAttr names.
      Returns:
        Map describing the XAttrs of the file or directory
      Throws:
        `IOException`

    - #### listXAttrs

          public List<String> listXAttrs(Path path)
                                  throws IOException

      Get all of the xattr names for a file or directory. Only the xattr names for which the logged-in user has permissions to view are returned.

      Refer to the HDFS extended attributes user documentation for details.
      Parameters:
        `path` - Path to get extended attributes
      Returns:
        Map describing the XAttrs of the file or directory
      Throws:
        `IOException`

    - #### removeXAttr

          public void removeXAttr(Path path,
                                  String name)
                           throws IOException

      Remove an xattr of a file or directory. The name must be prefixed with the namespace followed by ".". For example, "user.attr".

      Refer to the HDFS extended attributes user documentation for details.
      Parameters:
        `path` - Path to remove extended attribute
        `name` - xattr name
      Throws:
        `IOException`

    - #### createSnapshot

          public Path createSnapshot(Path path,
                                     String snapshotName)
                              throws IOException

      The specification of this method matches that of `FileContext.createSnapshot(Path, String)`.
      Throws:
        `IOException`

    - #### renameSnapshot

          public void renameSnapshot(Path path,
                                     String snapshotOldName,
                                     String snapshotNewName)
                              throws IOException

      The specification of this method matches that of `FileContext.renameSnapshot(Path, String, String)`.
      Throws:
        `IOException`

    - #### deleteSnapshot

          public void deleteSnapshot(Path snapshotDir,
                                     String snapshotName)
                              throws IOException

      The specification of this method matches that of `FileContext.deleteSnapshot(Path, String)`.
      Throws:
        `IOException`

    - #### satisfyStoragePolicy

          public void satisfyStoragePolicy(Path path)
                                    throws IOException

      Set the source path to satisfy storage policy.
      Parameters:
        `path` - The source path referring to either a directory or a file.
      Throws:
        `IOException`

    - #### setStoragePolicy

          public void setStoragePolicy(Path path,
                                       String policyName)
                                throws IOException

      Set the storage policy for a given file or directory.
      Parameters:
        `path` - file or directory path.
        `policyName` - the name of the target storage policy. The list of supported Storage policies can be retrieved via `getAllStoragePolicies()`.
      Throws:
        `IOException`

    - #### unsetStoragePolicy

          public void unsetStoragePolicy(Path src)
                                  throws IOException

      Unset the storage policy set for a given file or directory.
      Parameters:
        `src` - file or directory path.
      Throws:
        `IOException`

    - #### getStoragePolicy

          public BlockStoragePolicySpi getStoragePolicy(Path src)
                                                 throws IOException

      Retrieve the storage policy for a given file or directory.
      Parameters:
        `src` - file or directory path.
      Returns:
        storage policy for give file.
      Throws:
        `IOException`

    - #### getAllStoragePolicies

          public Collection<? extends BlockStoragePolicySpi> getAllStoragePolicies()
                                                                            throws IOException

      Retrieve all the storage policies supported by this file system.
      Returns:
        all storage policies supported by this filesystem.
      Throws:
        `IOException`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object other)

      Overrides:
        `equals` in class `Object`

    - #### hasPathCapability

          public boolean hasPathCapability(Path path,
                                           String capability)
                                    throws IOException

      Description copied from interface: `PathCapabilities`
      Probe for a specific capability under the given path. If the function returns `true`, this instance is explicitly declaring that the capability is available. If the function returns `false`, it can mean one of:
      - The capability is not known.
      - The capability is known but it is not supported.
      - The capability is known but the filesystem does not know if it is supported under the supplied path.
      The core guarantee which a caller can rely on is: if the predicate returns true, then the specific operation/behavior can be expected to be supported. However a specific call may be rejected for permission reasons, the actual file/directory not being present, or some other failure during the attempted execution of the operation.

      Implementors: `PathCapabilitiesSupport` can be used to help implement this method.

      Specified by:
        `hasPathCapability` in interface `PathCapabilities`
      Parameters:
        `path` - path to query the capability of.
        `capability` - non-null, non-empty string to query the path for support.
      Returns:
        true if the capability is supported under that part of the FS.
      Throws:
        `IOException` - this should not be raised, except on problems resolving paths or relaying the call.

Copyright © 2008–2022 Apache Software Foundation. All rights reserved.