@InterfaceAudience.Public @InterfaceStability.Stable public class FsPermission extends Object implements Writable
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_UMASK |
static String |
DEPRECATED_UMASK_LABEL
umask property label deprecated key and code in getUMask method
to accommodate it may be removed in version .23
|
static int |
MAX_PERMISSION_LENGTH
Maximum acceptable length of a permission string to parse
|
static String |
UMASK_LABEL |
Constructor and Description |
---|
FsPermission(FsAction u,
FsAction g,
FsAction o)
Construct by the given
FsAction . |
FsPermission(FsAction u,
FsAction g,
FsAction o,
boolean sb) |
FsPermission(FsPermission other)
Copy constructor
|
FsPermission(short mode)
Construct by the given mode.
|
FsPermission(String mode)
Construct by given mode, either in octal or symbolic format.
|
Modifier and Type | Method and Description |
---|---|
FsPermission |
applyUMask(FsPermission umask)
Apply a umask to this permission and return a new one.
|
static FsPermission |
createImmutable(short permission)
Create an immutable
FsPermission object. |
boolean |
equals(Object obj) |
void |
fromShort(short n) |
boolean |
getAclBit()
Returns true if there is also an ACL (access control list).
|
static FsPermission |
getCachePoolDefault()
Get the default permission for cache pools.
|
static FsPermission |
getDefault()
Get the default permission for directory and symlink.
|
static FsPermission |
getDirDefault()
Get the default permission for directory.
|
boolean |
getEncryptedBit()
Returns true if the file is encrypted or directory is in an encryption zone
|
static FsPermission |
getFileDefault()
Get the default permission for file.
|
FsAction |
getGroupAction()
Return group
FsAction . |
FsAction |
getOtherAction()
Return other
FsAction . |
boolean |
getStickyBit() |
static FsPermission |
getUMask(Configuration conf)
Get the user file creation mask (umask)
UMASK_LABEL config param has umask value that is either symbolic
or octal. |
FsAction |
getUserAction()
Return user
FsAction . |
int |
hashCode() |
static FsPermission |
read(DataInput in)
Create and initialize a
FsPermission from DataInput . |
void |
readFields(DataInput in)
Deserialize the fields of this object from
in . |
static void |
setUMask(Configuration conf,
FsPermission umask)
Set the user file creation mask (umask)
|
short |
toExtendedShort()
Encodes the object to a short.
|
short |
toShort()
Encode the object to a short.
|
String |
toString() |
static FsPermission |
valueOf(String unixSymbolicPermission)
Create a FsPermission from a Unix symbolic permission string
|
void |
write(DataOutput out)
Serialize the fields of this object to
out . |
public static final int MAX_PERMISSION_LENGTH
public static final String DEPRECATED_UMASK_LABEL
public static final String UMASK_LABEL
public static final int DEFAULT_UMASK
public FsPermission(FsAction u, FsAction g, FsAction o)
FsAction
.u
- user actiong
- group actiono
- other actionpublic FsPermission(FsAction u, FsAction g, FsAction o, boolean sb)
public FsPermission(short mode)
mode
- toShort()
public FsPermission(FsPermission other)
other
- other permissionpublic FsPermission(String mode)
mode
- mode as a string, either in octal or symbolic formatIllegalArgumentException
- if mode
is invalidpublic static FsPermission createImmutable(short permission)
FsPermission
object.public FsAction getUserAction()
FsAction
.public FsAction getGroupAction()
FsAction
.public FsAction getOtherAction()
FsAction
.public void fromShort(short n)
public void write(DataOutput out) throws IOException
Writable
out
.write
in interface Writable
out
- DataOuput
to serialize this object into.IOException
public void readFields(DataInput in) throws IOException
Writable
in
.
For efficiency, implementations should attempt to re-use storage in the existing object where possible.
readFields
in interface Writable
in
- DataInput
to deseriablize this object from.IOException
public static FsPermission read(DataInput in) throws IOException
FsPermission
from DataInput
.IOException
public short toShort()
public short toExtendedShort()
toShort()
, this method may
return values outside the fixed range 00000 - 01777 if extended features
are encoded into this permission, such as the ACL bit.public FsPermission applyUMask(FsPermission umask)
umask
- The umask to usepublic static FsPermission getUMask(Configuration conf)
UMASK_LABEL
config param has umask value that is either symbolic
or octal.
Symbolic umask is applied relative to file mode creation mask;
the permission op characters '+' clears the corresponding bit in the mask,
'-' sets bits in the mask.
Octal umask, the specified bits are set in the file mode creation mask.
DEPRECATED_UMASK_LABEL
config param has umask value set to decimal.public boolean getStickyBit()
public boolean getAclBit()
public boolean getEncryptedBit()
public static void setUMask(Configuration conf, FsPermission umask)
public static FsPermission getDefault()
getDirDefault()
for directory, and use
getFileDefault()
for file.
This method is kept for compatibility.public static FsPermission getDirDefault()
public static FsPermission getFileDefault()
public static FsPermission getCachePoolDefault()
public static FsPermission valueOf(String unixSymbolicPermission)
unixSymbolicPermission
- e.g. "-rw-rw-rw-"Copyright © 2017 Apache Software Foundation. All Rights Reserved.