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
This class defines a FileStatus that includes a file's block locations.
- See Also:
-
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
ConstructorsConstructorDescriptionLocatedFileStatus(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 TypeMethodDescriptionintCompare this FileStatus to another FileStatusbooleanCompare if this object is equal to another objectGet the file's block locations In HDFS, the returned BlockLocation will have different formats for replicated and erasure coded file.inthashCode()Returns a hash code value for the object, which is defined as the hash code of the path name.protected voidsetBlockLocations(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
-
Constructor Details
-
LocatedFileStatus
public LocatedFileStatus() -
LocatedFileStatus
Constructor- Parameters:
stat- a file statuslocations- 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 lengthisdir- if the path is a directoryblock_replication- the file's replication factorblocksize- a file's block sizemodification_time- a file's modification timeaccess_time- a file's access timepermission- a file's permissionowner- a file's ownergroup- a file's groupsymlink- symlink if the path is a symbolic linkpath- the path's qualified namelocations- 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 lengthisdir- if the path is a directoryblock_replication- the file's replication factorblocksize- a file's block sizemodification_time- a file's modification timeaccess_time- a file's access timepermission- a file's permissionowner- a file's ownergroup- a file's groupsymlink- symlink if the path is a symbolic linkpath- the path's qualified namehasAcl- entity has associated ACLsisEncrypted- entity is encryptedisErasureCoded- entity is erasure codedlocations- 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 lengthisdir- if the path is a directoryblock_replication- the file's replication factorblocksize- a file's block sizemodification_time- a file's modification timeaccess_time- a file's access timepermission- a file's permissionowner- a file's ownergroup- a file's groupsymlink- symlink if the path is a symbolic linkpath- the path's qualified nameattr- Attribute flags (SeeFileStatus.AttrFlags).locations- a file's block locations
-
-
Method Details
-
getBlockLocations
Get the file's block locations In HDFS, the returned BlockLocation will have different formats for replicated and erasure coded file. Please refer toFileSystem.getFileBlockLocations(FileStatus, long, long)for more details.- Returns:
- the file's block locations
-
setBlockLocations
Hook for subclasses to lazily set block locations. Thelocationsfield should be null before this is called.- Parameters:
locations- Block locations for this instance.
-
compareTo
Compare this FileStatus to another FileStatus- Overrides:
compareToin classFileStatus- 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
Compare if this object is equal to another object- Overrides:
equalsin classFileStatus- 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:
hashCodein classFileStatus- Returns:
- a hash code value for the path name.
-