HdfsLocatedFileStatus (Apache Hadoop HDFS Client 3.5.0 API)
Description: declaration: package: org.apache.hadoop.hdfs.protocol, class: HdfsLocatedFileStatus

Package org.apache.hadoop.hdfs.protocol

# Class HdfsLocatedFileStatus

java.lang.Object
org.apache.hadoop.fs.FileStatus
org.apache.hadoop.fs.LocatedFileStatus
org.apache.hadoop.hdfs.protocol.HdfsLocatedFileStatus

All Implemented Interfaces:
  `ObjectInputValidation`, `Serializable`, `Comparable<Object>`, `HdfsFileStatus`, `org.apache.hadoop.io.Writable`

@Private @Evolving public class HdfsLocatedFileStatus extends org.apache.hadoop.fs.LocatedFileStatus implements HdfsFileStatus
HDFS metadata for an entity in the filesystem with locations. Note that symlinks and directories are returned as `HdfsLocatedFileStatus` for backwards compatibility.

See Also:
  - Serialized Form

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class org.apache.hadoop.fs.FileStatus

  `org.apache.hadoop.fs.FileStatus.AttrFlags`

  ## Nested classes/interfaces inherited from interface org.apache.hadoop.hdfs.protocol.HdfsFileStatus

  `HdfsFileStatus.Builder, HdfsFileStatus.Flags`

- ## Field Summary

  ### Fields inherited from class org.apache.hadoop.fs.FileStatus

  `NONE`

  ### Fields inherited from interface org.apache.hadoop.hdfs.protocol.HdfsFileStatus

  `EMPTY_NAME`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `equals(Object o)`
  `int`
  `getChildrenNum()`
  `ErasureCodingPolicy`
  `getErasureCodingPolicy()`
  Get the erasure coding policy if it's set.
  `org.apache.hadoop.fs.FileEncryptionInfo`
  `getFileEncryptionInfo()`
  Get metadata for encryption, if present.
  `long`
  `getFileId()`
  Inode ID for this entity, if a file.
  `byte[]`
  `getLocalNameInBytes()`
  Get the Java UTF8 representation of the local name.
  `LocatedBlocks`
  `getLocatedBlocks()`
  Get block locations for this entity, in HDFS format.
  `String`
  `getNamespace()`
  `byte`
  `getStoragePolicy()`
  `org.apache.hadoop.fs.Path`
  `getSymlink()`
  See `FileStatus.getSymlink()`.
  `byte[]`
  `getSymlinkInBytes()`
  Opaque referant for the symlink, to be resolved at the client.
  `int`
  `hashCode()`
  `boolean`
  `isSymlink()`
  See `FileStatus.isSymlink()`.
  `org.apache.hadoop.fs.LocatedFileStatus`
  `makeQualifiedLocated(URI defaultUri, org.apache.hadoop.fs.Path path)`
  This function is used to transform the underlying HDFS LocatedBlocks to BlockLocations.
  `void`
  `setGroup(String group)`
  See `FileStatus.setGroup(String)`.
  `void`
  `setNamespace(String namespace)`
  `void`
  `setOwner(String owner)`
  See `FileStatus.setOwner(String)`.
  `void`
  `setPermission(org.apache.hadoop.fs.permission.FsPermission permission)`
  See `FileStatus.setPermission(FsPermission)`.
  `void`
  `setSymlink(org.apache.hadoop.fs.Path sym)`
  See `FileStatus.setSymlink(Path sym)`.

  ### Methods inherited from class org.apache.hadoop.fs.LocatedFileStatus

  `compareTo, getBlockLocations, setBlockLocations`

  ### Methods inherited from class org.apache.hadoop.fs.FileStatus

  `attributes, compareTo, getAccessTime, getBlockSize, getGroup, getLen, getModificationTime, getOwner, getPath, getPermission, getReplication, hasAcl, isDir, isDirectory, isEncrypted, isErasureCoded, isFile, isSnapshotEnabled, readFields, setPath, toString, validateObject, write`

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

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

  ### Methods inherited from interface java.lang.Comparable

  `compareTo`

  ### Methods inherited from interface org.apache.hadoop.hdfs.protocol.HdfsFileStatus

  `compareTo, getAccessTime, getBlockSize, getFullName, getFullPath, getGroup, getLen, getLocalName, getModificationTime, getOwner, getPath, getPermission, getReplication, hasAcl, isDir, isDirectory, isEmptyLocalName, isEncrypted, isErasureCoded, isFile, isSnapshotEnabled, makeQualified, setPath`

  ### Methods inherited from interface java.io.ObjectInputValidation

  `validateObject`

  ### Methods inherited from interface org.apache.hadoop.io.Writable

  `readFields, write`

- ## Method Details

  - ### setOwner

    public void setOwner(String owner)
    Description copied from interface: `HdfsFileStatus`
    See `FileStatus.setOwner(String)`.
    Specified by:
      `setOwner` in interface `HdfsFileStatus`
    Overrides:
      `setOwner` in class `org.apache.hadoop.fs.FileStatus`

  - ### setGroup

    public void setGroup(String group)
    Description copied from interface: `HdfsFileStatus`
    See `FileStatus.setGroup(String)`.
    Specified by:
      `setGroup` in interface `HdfsFileStatus`
    Overrides:
      `setGroup` in class `org.apache.hadoop.fs.FileStatus`

  - ### isSymlink

    public boolean isSymlink()
    Description copied from interface: `HdfsFileStatus`
    See `FileStatus.isSymlink()`.
    Specified by:
      `isSymlink` in interface `HdfsFileStatus`
    Overrides:
      `isSymlink` in class `org.apache.hadoop.fs.FileStatus`

  - ### getSymlink

    public org.apache.hadoop.fs.Path getSymlink() throws IOException
    Description copied from interface: `HdfsFileStatus`
    See `FileStatus.getSymlink()`.
    Specified by:
      `getSymlink` in interface `HdfsFileStatus`
    Overrides:
      `getSymlink` in class `org.apache.hadoop.fs.FileStatus`
    Throws:
      `IOException`

  - ### setPermission

    public void setPermission(org.apache.hadoop.fs.permission.FsPermission permission)
    Description copied from interface: `HdfsFileStatus`
    See `FileStatus.setPermission(FsPermission)`.
    Specified by:
      `setPermission` in interface `HdfsFileStatus`
    Overrides:
      `setPermission` in class `org.apache.hadoop.fs.FileStatus`

  - ### getLocalNameInBytes

    public byte[] getLocalNameInBytes()
    Get the Java UTF8 representation of the local name.
    Specified by:
      `getLocalNameInBytes` in interface `HdfsFileStatus`
    Returns:
      the local name in java UTF8

  - ### setSymlink

    public void setSymlink(org.apache.hadoop.fs.Path sym)
    Description copied from interface: `HdfsFileStatus`
    See `FileStatus.setSymlink(Path sym)`.
    Specified by:
      `setSymlink` in interface `HdfsFileStatus`
    Overrides:
      `setSymlink` in class `org.apache.hadoop.fs.FileStatus`

  - ### getSymlinkInBytes

    public byte[] getSymlinkInBytes()
    Opaque referant for the symlink, to be resolved at the client.
    Specified by:
      `getSymlinkInBytes` in interface `HdfsFileStatus`

  - ### getFileId

    public long getFileId()
    Description copied from interface: `HdfsFileStatus`
    Inode ID for this entity, if a file.
    Specified by:
      `getFileId` in interface `HdfsFileStatus`
    Returns:
      inode ID.

  - ### getFileEncryptionInfo

    public org.apache.hadoop.fs.FileEncryptionInfo getFileEncryptionInfo()
    Description copied from interface: `HdfsFileStatus`
    Get metadata for encryption, if present.
    Specified by:
      `getFileEncryptionInfo` in interface `HdfsFileStatus`
    Returns:
      the `FileEncryptionInfo` for this stream, or null if not encrypted.

  - ### getErasureCodingPolicy

    public ErasureCodingPolicy getErasureCodingPolicy()
    Get the erasure coding policy if it's set.
    Specified by:
      `getErasureCodingPolicy` in interface `HdfsFileStatus`
    Returns:
      the erasure coding policy

  - ### getChildrenNum

    public int getChildrenNum()
    Specified by:
      `getChildrenNum` in interface `HdfsFileStatus`
    Returns:
      number of children for this inode.

  - ### getStoragePolicy

    public byte getStoragePolicy()
    Specified by:
      `getStoragePolicy` in interface `HdfsFileStatus`
    Returns:
      the storage policy id

  - ### equals

    public boolean equals(Object o)
    Overrides:
      `equals` in class `org.apache.hadoop.fs.LocatedFileStatus`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `org.apache.hadoop.fs.LocatedFileStatus`

  - ### getLocatedBlocks

    public LocatedBlocks getLocatedBlocks()
    Get block locations for this entity, in HDFS format. See `makeQualifiedLocated(URI, Path)`. See `DFSUtilClient.locatedBlocks2Locations(LocatedBlocks)`.
    Returns:
      block locations

  - ### makeQualifiedLocated

    public org.apache.hadoop.fs.LocatedFileStatus makeQualifiedLocated(URI defaultUri, org.apache.hadoop.fs.Path path)
    This function is used to transform the underlying HDFS LocatedBlocks to BlockLocations. This method must be invoked before `LocatedFileStatus.getBlockLocations()`. The returned BlockLocation will have different formats for replicated and erasure coded file. Please refer to `(FileStatus, long, long)` for examples.

  - ### getNamespace

    public String getNamespace()
    Specified by:
      `getNamespace` in interface `HdfsFileStatus`

  - ### setNamespace

    public void setNamespace(String namespace)
    Specified by:
      `setNamespace` in interface `HdfsFileStatus`