LocatedFileStatus (Apache Hadoop Common 3.5.0 API)
Description: declaration: package: org.apache.hadoop.fs, class: LocatedFileStatus

Package org.apache.hadoop.fs

# Class LocatedFileStatus

java.lang.Object
org.apache.hadoop.fs.FileStatus
org.apache.hadoop.fs.LocatedFileStatus

All Implemented Interfaces:
  `ObjectInputValidation`, `Serializable`, `Comparable<Object>`, `Writable`

@Public @Evolving public class LocatedFileStatus extends FileStatus
This class defines a FileStatus that includes a file's block locations.

See Also:
  - Serialized Form

- ## Nested Class Summary

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

  `FileStatus.AttrFlags`

- ## Field Summary

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

  `NONE`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `LocatedFileStatus()`
  `LocatedFileStatus(long length, boolean isdir, int block_replication, long blocksize, long modification_time, long access_time, FsPermission permission, String owner, String group, Path symlink, Path path, boolean hasAcl, boolean isEncrypted, boolean isErasureCoded, BlockLocation[] locations)`
  Constructor.
  `LocatedFileStatus(long length, boolean isdir, int block_replication, long blocksize, long modification_time, long access_time, FsPermission permission, String owner, String group, Path symlink, Path path, Set<FileStatus.AttrFlags> attr, BlockLocation[] locations)`
  Constructor.
  `LocatedFileStatus(long length, boolean isdir, int block_replication, long blocksize, long modification_time, long access_time, FsPermission permission, String owner, String group, Path symlink, Path path, BlockLocation[] locations)`
  Deprecated.
  `LocatedFileStatus(FileStatus stat, BlockLocation[] locations)`
  Constructor

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `compareTo(FileStatus o)`
  Compare this FileStatus to another FileStatus
  `boolean`
  `equals(Object o)`
  Compare if this object is equal to another object
  `BlockLocation[]`
  `getBlockLocations()`
  Get the file's block locations In HDFS, the returned BlockLocation will have different formats for replicated and erasure coded file.
  `int`
  `hashCode()`
  Returns a hash code value for the object, which is defined as the hash code of the path name.
  `protected void`
  `setBlockLocations(BlockLocation[] locations)`
  Hook for subclasses to lazily set block locations.

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

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

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

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

- ## Constructor Details

  - ### LocatedFileStatus

    public LocatedFileStatus()

  - ### LocatedFileStatus

    public LocatedFileStatus(FileStatus stat, BlockLocation[] locations)
    Constructor
    Parameters:
      `stat` - a file status
      `locations` - a file's block locations

  - ### LocatedFileStatus

    @Deprecated public LocatedFileStatus(long length, boolean isdir, int block_replication, long blocksize, long modification_time, long access_time, FsPermission permission, String owner, String group, Path symlink, Path path, BlockLocation[] locations)
    Deprecated.
    Constructor
    Parameters:
      `length` - a file's length
      `isdir` - if the path is a directory
      `block_replication` - the file's replication factor
      `blocksize` - a file's block size
      `modification_time` - a file's modification time
      `access_time` - a file's access time
      `permission` - a file's permission
      `owner` - a file's owner
      `group` - a file's group
      `symlink` - symlink if the path is a symbolic link
      `path` - the path's qualified name
      `locations` - a file's block locations

  - ### LocatedFileStatus

    public LocatedFileStatus(long length, boolean isdir, int block_replication, long blocksize, long modification_time, long access_time, FsPermission permission, String owner, String group, Path symlink, Path path, boolean hasAcl, boolean isEncrypted, boolean isErasureCoded, BlockLocation[] locations)
    Constructor.
    Parameters:
      `length` - a file's length
      `isdir` - if the path is a directory
      `block_replication` - the file's replication factor
      `blocksize` - a file's block size
      `modification_time` - a file's modification time
      `access_time` - a file's access time
      `permission` - a file's permission
      `owner` - a file's owner
      `group` - a file's group
      `symlink` - symlink if the path is a symbolic link
      `path` - the path's qualified name
      `hasAcl` - entity has associated ACLs
      `isEncrypted` - entity is encrypted
      `isErasureCoded` - entity is erasure coded
      `locations` - a file's block locations

  - ### LocatedFileStatus

    public LocatedFileStatus(long length, boolean isdir, int block_replication, long blocksize, long modification_time, long access_time, FsPermission permission, String owner, String group, Path symlink, Path path, Set<FileStatus.AttrFlags> attr, BlockLocation[] locations)
    Constructor.
    Parameters:
      `length` - a file's length
      `isdir` - if the path is a directory
      `block_replication` - the file's replication factor
      `blocksize` - a file's block size
      `modification_time` - a file's modification time
      `access_time` - a file's access time
      `permission` - a file's permission
      `owner` - a file's owner
      `group` - a file's group
      `symlink` - symlink if the path is a symbolic link
      `path` - the path's qualified name
      `attr` - Attribute flags (See `FileStatus.AttrFlags`).
      `locations` - a file's block locations

- ## Method Details

  - ### getBlockLocations

    public BlockLocation[] getBlockLocations()
    Get the file's block locations In HDFS, the returned BlockLocation will have different formats for replicated and erasure coded file. Please refer to `FileSystem.getFileBlockLocations(FileStatus, long, long)` for more details.
    Returns:
      the file's block locations

  - ### setBlockLocations

    protected void setBlockLocations(BlockLocation[] locations)
    Hook for subclasses to lazily set block locations. The `locations` field should be null before this is called.
    Parameters:
      `locations` - Block locations for this instance.

  - ### compareTo

    public int compareTo(FileStatus o)
    Compare this FileStatus to another FileStatus
    Overrides:
      `compareTo` in class `FileStatus`
    Parameters:
      `o` - the FileStatus to be compared.
    Returns:
      a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

  - ### equals

    public boolean equals(Object o)
    Compare if this object is equal to another object
    Overrides:
      `equals` in class `FileStatus`
    Parameters:
      `o` - the object to be compared.
    Returns:
      true if two file status has the same path name; false if not.

  - ### hashCode

    public int hashCode()
    Returns a hash code value for the object, which is defined as the hash code of the path name.
    Overrides:
      `hashCode` in class `FileStatus`
    Returns:
      a hash code value for the path name.