org.apache.hadoop.fs.permission
Class FsPermission

java.lang.Object
  extended by org.apache.hadoop.fs.permission.FsPermission
All Implemented Interfaces:
Writable

public class FsPermission
extends Object
implements Writable

A class for file/directory permissions.


Field Summary
static int DEFAULT_UMASK
           
static String UMASK_LABEL
          umask property label
 
Constructor Summary
FsPermission(FsAction u, FsAction g, FsAction o)
          Construct by the given FsAction.
FsPermission(FsPermission other)
          Copy constructor
FsPermission(short mode)
          Construct by the given mode.
 
Method Summary
 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.
 FsAction getGroupAction()
          Return group FsAction.
 FsAction getOtherAction()
          Return other FsAction.
static FsPermission getUMask(Configuration conf)
          Get the user file creation mask (umask)
 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.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

UMASK_LABEL

public static final String UMASK_LABEL
umask property label

See Also:
Constant Field Values

DEFAULT_UMASK

public static final int DEFAULT_UMASK
See Also:
Constant Field Values
Constructor Detail

FsPermission

public FsPermission(FsAction u,
                    FsAction g,
                    FsAction o)
Construct by the given FsAction.

Parameters:
u - user action
g - group action
o - other action

FsPermission

public FsPermission(short mode)
Construct by the given mode.

Parameters:
mode -
See Also:
toShort()

FsPermission

public FsPermission(FsPermission other)
Copy constructor

Parameters:
other - other permission
Method Detail

createImmutable

public static FsPermission createImmutable(short permission)
Create an immutable FsPermission object.


getUserAction

public FsAction getUserAction()
Return user FsAction.


getGroupAction

public FsAction getGroupAction()
Return group FsAction.


getOtherAction

public FsAction getOtherAction()
Return other FsAction.


fromShort

public void fromShort(short n)

write

public void write(DataOutput out)
           throws IOException
Serialize the fields of this object to out.

Specified by:
write in interface Writable
Parameters:
out - DataOuput to serialize this object into.
Throws:
IOException

readFields

public void readFields(DataInput in)
                throws IOException
Deserialize the fields of this object from in.

For efficiency, implementations should attempt to re-use storage in the existing object where possible.

Specified by:
readFields in interface Writable
Parameters:
in - DataInput to deseriablize this object from.
Throws:
IOException

read

public static FsPermission read(DataInput in)
                         throws IOException
Create and initialize a FsPermission from DataInput.

Throws:
IOException

toShort

public short toShort()
Encode the object to a short.


equals

public boolean equals(Object obj)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object

toString

public String toString()

Overrides:
toString in class Object

applyUMask

public FsPermission applyUMask(FsPermission umask)
Apply a umask to this permission and return a new one


getUMask

public static FsPermission getUMask(Configuration conf)
Get the user file creation mask (umask)


setUMask

public static void setUMask(Configuration conf,
                            FsPermission umask)
Set the user file creation mask (umask)


getDefault

public static FsPermission getDefault()
Get the default permission.


valueOf

public static FsPermission valueOf(String unixSymbolicPermission)
Create a FsPermission from a Unix symbolic permission string

Parameters:
unixSymbolicPermission - e.g. "-rw-rw-rw-"


Copyright © 2008 The Apache Software Foundation