@InterfaceAudience.Public @InterfaceStability.Stable public class FileStatus extends Object implements Writable, Comparable<Object>, Serializable, ObjectInputValidation
Modifier and Type | Field and Description |
---|---|
static Set<org.apache.hadoop.fs.FileStatus.AttrFlags> |
NONE
Shared, empty set of attributes (a common case for FileStatus).
|
Constructor and Description |
---|
FileStatus() |
FileStatus(FileStatus other)
Copy constructor.
|
FileStatus(long length,
boolean isdir,
int block_replication,
long blocksize,
long modification_time,
long access_time,
FsPermission permission,
String owner,
String group,
Path path)
Constructor for file systems on which symbolic links are not supported
|
FileStatus(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) |
FileStatus(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) |
FileStatus(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<org.apache.hadoop.fs.FileStatus.AttrFlags> attr) |
FileStatus(long length,
boolean isdir,
int block_replication,
long blocksize,
long modification_time,
Path path) |
Modifier and Type | Method and Description |
---|---|
static Set<org.apache.hadoop.fs.FileStatus.AttrFlags> |
attributes(boolean acl,
boolean crypt,
boolean ec,
boolean sn)
Convert boolean attributes to a set of flags.
|
int |
compareTo(FileStatus o)
Compare this FileStatus to another FileStatus
|
int |
compareTo(Object o)
Compare this FileStatus to another FileStatus.
|
boolean |
equals(Object o)
Compare if this object is equal to another object
|
long |
getAccessTime()
Get the access time of the file.
|
long |
getBlockSize()
Get the block size of the file.
|
String |
getGroup()
Get the group associated with the file.
|
long |
getLen()
Get the length of this file, in bytes.
|
long |
getModificationTime()
Get the modification time of the file.
|
String |
getOwner()
Get the owner of the file.
|
Path |
getPath() |
FsPermission |
getPermission()
Get FsPermission associated with the file.
|
short |
getReplication()
Get the replication factor of a file.
|
Path |
getSymlink() |
boolean |
hasAcl()
Tell whether the underlying file or directory has ACLs set.
|
int |
hashCode()
Returns a hash code value for the object, which is defined as
the hash code of the path name.
|
boolean |
isDir()
Deprecated.
Use
isFile() ,
isDirectory() , and isSymlink()
instead. |
boolean |
isDirectory()
Is this a directory?
|
boolean |
isEncrypted()
Tell whether the underlying file or directory is encrypted or not.
|
boolean |
isErasureCoded()
Tell whether the underlying file or directory is erasure coded or not.
|
boolean |
isFile()
Is this a file?
|
boolean |
isSnapshotEnabled()
Check if directory is Snapshot enabled or not.
|
boolean |
isSymlink()
Is this a symbolic link?
|
void |
readFields(DataInput in)
Deprecated.
Use the
PBHelper and protobuf serialization directly. |
protected void |
setGroup(String group)
Sets group.
|
protected void |
setOwner(String owner)
Sets owner.
|
void |
setPath(Path p) |
protected void |
setPermission(FsPermission permission)
Sets permission.
|
void |
setSymlink(Path p) |
String |
toString() |
void |
validateObject() |
void |
write(DataOutput out)
Deprecated.
Use the
PBHelper and protobuf serialization directly. |
public static final Set<org.apache.hadoop.fs.FileStatus.AttrFlags> NONE
public FileStatus()
public FileStatus(long length, boolean isdir, int block_replication, long blocksize, long modification_time, Path path)
public FileStatus(long length, boolean isdir, int block_replication, long blocksize, long modification_time, long access_time, FsPermission permission, String owner, String group, Path path)
length
- length.isdir
- isdir.block_replication
- block replication.blocksize
- block size.modification_time
- modification time.access_time
- access_time.permission
- permission.owner
- owner.group
- group.path
- the path.public FileStatus(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)
public FileStatus(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)
public FileStatus(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<org.apache.hadoop.fs.FileStatus.AttrFlags> attr)
public FileStatus(FileStatus other) throws IOException
other
- FileStatus to copyIOException
- raised on errors performing I/O.public static Set<org.apache.hadoop.fs.FileStatus.AttrFlags> attributes(boolean acl, boolean crypt, boolean ec, boolean sn)
acl
- See FileStatus.AttrFlags.HAS_ACL
.crypt
- See FileStatus.AttrFlags.HAS_CRYPT
.ec
- See FileStatus.AttrFlags.HAS_EC
.sn
- See FileStatus.AttrFlags.SNAPSHOT_ENABLED
.public long getLen()
public boolean isFile()
public boolean isDirectory()
@Deprecated public final boolean isDir()
isFile()
,
isDirectory()
, and isSymlink()
instead.public boolean isSymlink()
public long getBlockSize()
public short getReplication()
public long getModificationTime()
public long getAccessTime()
public FsPermission getPermission()
public boolean hasAcl()
public boolean isEncrypted()
public boolean isErasureCoded()
public boolean isSnapshotEnabled()
public String getOwner()
public String getGroup()
public Path getPath()
public void setPath(Path p)
protected void setPermission(FsPermission permission)
permission
- if permission is null, default value is setprotected void setOwner(String owner)
owner
- if it is null, default value is setprotected void setGroup(String group)
group
- if it is null, default value is setpublic Path getSymlink() throws IOException
IOException
- raised on errors performing I/O.public void setSymlink(Path p)
public int compareTo(FileStatus o)
o
- the FileStatus to be compared.public int compareTo(Object o)
compareTo
in interface Comparable<Object>
o
- the FileStatus to be compared.ClassCastException
- if the specified object is not FileStatuspublic boolean equals(Object o)
public int hashCode()
@Deprecated public void readFields(DataInput in) throws IOException
PBHelper
and protobuf serialization directly.readFields
in interface Writable
in
- Input streamIOException
- any other problem for readFields.PBHelper.convert(FileStatus)
@Deprecated public void write(DataOutput out) throws IOException
PBHelper
and protobuf serialization directly.write
in interface Writable
out
- Output streamIOException
- any other problem for write.PBHelper.convert(FileStatus)
public void validateObject() throws InvalidObjectException
validateObject
in interface ObjectInputValidation
InvalidObjectException
Copyright © 2023 Apache Software Foundation. All rights reserved.