@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 String |
UMASK_LABEL |
Constructor and Description |
---|
FsPermission(org.apache.hadoop.fs.permission.FsAction u,
org.apache.hadoop.fs.permission.FsAction g,
org.apache.hadoop.fs.permission.FsAction o)
Construct by the given
FsAction . |
FsPermission(org.apache.hadoop.fs.permission.FsAction u,
org.apache.hadoop.fs.permission.FsAction g,
org.apache.hadoop.fs.permission.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) |
static FsPermission |
getDefault()
Get the default permission for directory and symlink.
|
static FsPermission |
getDirDefault()
Get the default permission for directory.
|
static FsPermission |
getFileDefault()
Get the default permission for file.
|
org.apache.hadoop.fs.permission.FsAction |
getGroupAction()
Return group
FsAction . |
org.apache.hadoop.fs.permission.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. |
org.apache.hadoop.fs.permission.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 |
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 String DEPRECATED_UMASK_LABEL
public static final String UMASK_LABEL
public static final int DEFAULT_UMASK
public FsPermission(org.apache.hadoop.fs.permission.FsAction u, org.apache.hadoop.fs.permission.FsAction g, org.apache.hadoop.fs.permission.FsAction o)
FsAction
.u
- user actiong
- group actiono
- other actionpublic FsPermission(org.apache.hadoop.fs.permission.FsAction u, org.apache.hadoop.fs.permission.FsAction g, org.apache.hadoop.fs.permission.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 org.apache.hadoop.fs.permission.FsAction getUserAction()
FsAction
.public org.apache.hadoop.fs.permission.FsAction getGroupAction()
FsAction
.public org.apache.hadoop.fs.permission.FsAction getOtherAction()
FsAction
.public void fromShort(short n)
public void write(DataOutput out) throws IOException
out
.write
in interface Writable
out
- DataOuput
to serialize this object into.IOException
public void readFields(DataInput in) throws IOException
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 FsPermission applyUMask(FsPermission umask)
public 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 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 valueOf(String unixSymbolicPermission)
unixSymbolicPermission
- e.g. "-rw-rw-rw-"Copyright © 2014 Apache Software Foundation. All Rights Reserved.