org.apache.hadoop.fs

## Class LocalFileSystem

- java.lang.Object
- - org.apache.hadoop.conf.Configured
  - - org.apache.hadoop.fs.FileSystem
    - - org.apache.hadoop.fs.FilterFileSystem
      - - org.apache.hadoop.fs.ChecksumFileSystem
        - - org.apache.hadoop.fs.LocalFileSystem

- All Implemented Interfaces:
    Closeable, AutoCloseable, Configurable, org.apache.hadoop.fs.PathCapabilities, org.apache.hadoop.security.token.DelegationTokenIssuer

      @InterfaceAudience.Public
       @InterfaceStability.Stable
      public class LocalFileSystem
      extends ChecksumFileSystem

  Implement the FileSystem API for the checksumed local filesystem.

- - ### Field Summary

    - ### Fields inherited from class org.apache.hadoop.fs.FilterFileSystem

      `fs, swapScheme`

    - ### Fields inherited from class org.apache.hadoop.fs.FileSystem

      `DEFAULT_FS, FS_DEFAULT_NAME_KEY, SHUTDOWN_HOOK_PRIORITY, statistics, TRASH_PREFIX, USER_HOME_PREFIX`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LocalFileSystem()`
    `LocalFileSystem(FileSystem rawLocalFileSystem)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `copyFromLocalFile(boolean delSrc, Path src, Path dst)` The src file is on the local disk.
    `void` | `copyToLocalFile(boolean delSrc, Path src, Path dst)` The src file is under FS, and the dst is on the local disk.
    `void` | `createSymlink(Path target, Path link, boolean createParent)` See `FileContext.createSymlink(Path, Path, boolean)`.
    `FileStatus` | `getFileLinkStatus(Path f)` See `FileContext.getFileLinkStatus(Path)`.
    `Path` | `getLinkTarget(Path f)` See `FileContext.getLinkTarget(Path)`.
    `FileSystem` | `getRaw()`
    `String` | `getScheme()` Return the protocol scheme for the FileSystem.
    `void` | `initialize(URI name, Configuration conf)` Called after a new FileSystem instance is constructed.
    `File` | `pathToFile(Path path)` Convert a path to a File.
    `boolean` | `reportChecksumFailure(Path p, FSDataInputStream in, long inPos, FSDataInputStream sums, long sumsPos)` Moves files to a bad file directory on the same device, so that their storage will not be reused.
    `boolean` | `supportsSymlinks()` See `AbstractFileSystem.supportsSymlinks()`.

    - ### Methods inherited from class org.apache.hadoop.fs.ChecksumFileSystem

      `append, completeLocalOutput, copyToLocalFile, create, createNonRecursive, delete, getApproxChkSumLength, getBytesPerSum, getChecksumFile, getChecksumFileLength, getChecksumLength, getRawFileSystem, hasPathCapability, isChecksumFile, listLocatedStatus, listStatus, listStatusIterator, mkdirs, modifyAclEntries, open, removeAcl, removeAclEntries, removeDefaultAcl, rename, setAcl, setConf, setOwner, setPermission, setReplication, setVerifyChecksum, setWriteChecksum, startLocalOutput, truncate`

    - ### Methods inherited from class org.apache.hadoop.fs.FilterFileSystem

      `access, appendFile, canonicalizeUri, checkPath, close, concat, copyFromLocalFile, copyFromLocalFile, create, createFile, createNonRecursive, createPathHandle, createSnapshot, deleteSnapshot, getAclStatus, getAllStoragePolicies, getCanonicalUri, getChildFileSystems, getConf, getDefaultBlockSize, getDefaultBlockSize, getDefaultReplication, getDefaultReplication, getFileBlockLocations, getFileChecksum, getFileChecksum, getFileStatus, getHomeDirectory, getInitialWorkingDirectory, getServerDefaults, getServerDefaults, getStatus, getStoragePolicy, getTrashRoot, getTrashRoots, getUri, getUsed, getUsed, getWorkingDirectory, getXAttr, getXAttrs, getXAttrs, listCorruptFileBlocks, listLocatedStatus, listXAttrs, makeQualified, mkdirs, msync, open, primitiveCreate, primitiveMkdir, removeXAttr, rename, renameSnapshot, resolveLink, resolvePath, satisfyStoragePolicy, setStoragePolicy, setTimes, setWorkingDirectory, setXAttr, setXAttr, unsetStoragePolicy`

    - ### Methods inherited from class org.apache.hadoop.fs.FileSystem

      `append, append, areSymlinksEnabled, cancelDeleteOnExit, clearStatistics, closeAll, closeAllForUGI, copyFromLocalFile, copyToLocalFile, copyToLocalFile, create, create, create, create, create, create, create, create, create, create, create, createNewFile, createNonRecursive, createSnapshot, delete, deleteOnExit, enableSymlinks, exists, fixRelativePart, get, get, get, getAllStatistics, getBlockSize, getCanonicalServiceName, getContentSummary, getDefaultPort, getDefaultUri, getFileBlockLocations, getFileSystemClass, getFSofPath, getGlobalStorageStatistics, getLength, getLocal, getName, getNamed, getPathHandle, getQuotaUsage, getReplication, getStatistics, getStatistics, getStatus, getStorageStatistics, globStatus, globStatus, isDirectory, isFile, listFiles, listStatus, listStatus, listStatus, mkdirs, moveFromLocalFile, moveFromLocalFile, moveToLocalFile, newInstance, newInstance, newInstance, newInstanceLocal, open, open, primitiveMkdir, printStatistics, processDeleteOnExit, setDefaultUri, setDefaultUri, setQuota, setQuotaByStorageType`

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

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

    - ### Methods inherited from interface org.apache.hadoop.security.token.DelegationTokenIssuer

      `addDelegationTokens, getAdditionalTokenIssuers, getDelegationToken`

- - ### Constructor Detail

    - #### LocalFileSystem

          public LocalFileSystem()

    - #### LocalFileSystem

          public LocalFileSystem(FileSystem rawLocalFileSystem)

  - ### Method Detail

    - #### initialize

          public void initialize(URI name,
                                 Configuration conf)
                          throws IOException

      Description copied from class: `FilterFileSystem`
      Called after a new FileSystem instance is constructed.
      Overrides:
        `initialize` in class `FilterFileSystem`
      Parameters:
        `name` - a uri whose authority section names the host, port, etc. for this FileSystem
        `conf` - the configuration
      Throws:
        `IOException` - on any failure to initialize this instance.

    - #### getScheme

          public String getScheme()

      Return the protocol scheme for the FileSystem.

      Overrides:
        `getScheme` in class `FileSystem`
      Returns:
        `file`

    - #### getRaw

          public FileSystem getRaw()

    - #### pathToFile

          public File pathToFile(Path path)

      Convert a path to a File.

    - #### copyFromLocalFile

          public void copyFromLocalFile(boolean delSrc,
                                        Path src,
                                        Path dst)
                                 throws IOException

      Description copied from class: `FilterFileSystem`
      The src file is on the local disk. Add it to FS at the given dst name. delSrc indicates if the source should be removed
      Overrides:
        `copyFromLocalFile` in class `ChecksumFileSystem`
      Parameters:
        `delSrc` - whether to delete the src
        `src` - path
        `dst` - path
      Throws:
        `IOException`

    - #### copyToLocalFile

          public void copyToLocalFile(boolean delSrc,
                                      Path src,
                                      Path dst)
                               throws IOException

      Description copied from class: `ChecksumFileSystem`
      The src file is under FS, and the dst is on the local disk. Copy it from FS control to the local dst name.
      Overrides:
        `copyToLocalFile` in class `ChecksumFileSystem`
      Parameters:
        `delSrc` - whether to delete the src
        `src` - path src file in the remote filesystem
        `dst` - path local destination
      Throws:
        `IOException` - IO failure

    - #### reportChecksumFailure

          public boolean reportChecksumFailure(Path p,
                                               FSDataInputStream in,
                                               long inPos,
                                               FSDataInputStream sums,
                                               long sumsPos)

      Moves files to a bad file directory on the same device, so that their storage will not be reused.
      Overrides:
        `reportChecksumFailure` in class `ChecksumFileSystem`
      Parameters:
        `p` - the file name containing the error
        `in` - the stream open on the file
        `inPos` - the position of the beginning of the bad data in the file
        `sums` - the stream open on the checksum file
        `sumsPos` - the position of the beginning of the bad data in the checksum file
      Returns:
        if retry is necessary

    - #### supportsSymlinks

          public boolean supportsSymlinks()

      Description copied from class: `FileSystem`
      See `AbstractFileSystem.supportsSymlinks()`.
      Overrides:
        `supportsSymlinks` in class `FilterFileSystem`

    - #### createSymlink

          public void createSymlink(Path target,
                                    Path link,
                                    boolean createParent)
                             throws IOException

      Description copied from class: `FileSystem`
      See `FileContext.createSymlink(Path, Path, boolean)`.
      Overrides:
        `createSymlink` in class `FilterFileSystem`
      Throws:
        `IOException`

    - #### getFileLinkStatus

          public FileStatus getFileLinkStatus(Path f)
                                       throws IOException

      Description copied from class: `FileSystem`
      See `FileContext.getFileLinkStatus(Path)`.
      Overrides:
        `getFileLinkStatus` in class `FilterFileSystem`
      Throws:
        `FileNotFoundException` - when the path does not exist
        `IOException` - see specific implementation

    - #### getLinkTarget

          public Path getLinkTarget(Path f)
                             throws IOException

      Description copied from class: `FileSystem`
      See `FileContext.getLinkTarget(Path)`.
      Overrides:
        `getLinkTarget` in class `FilterFileSystem`
      Throws:
        `IOException`

Copyright © 2022 Apache Software Foundation. All rights reserved.