org.mockftpserver.fake.filesystem
Class Permissions

java.lang.Object
  extended by org.mockftpserver.fake.filesystem.Permissions

public class Permissions
extends Object

Represents and encapsulates the read/write/execute permissions for a file or directory. This is conceptually (and somewhat loosely) based on the permissions flags within the Unix file system. An instance of this class is immutable.

Version:
$Revision: 182 $ - $Date: 2008-11-30 21:37:49 -0500 (Sun, 30 Nov 2008) $
Author:
Chris Mair

Field Summary
static Permissions ALL
           
static Permissions DEFAULT
           
static Permissions NONE
           
 
Constructor Summary
Permissions(String rwxString)
          Costruct a new instance for the specified read/write/execute specification String
 
Method Summary
 String asRwxString()
          Return the read/write/execute specification String representing the set of permissions.
 boolean canGroupExecute()
           
 boolean canGroupRead()
           
 boolean canGroupWrite()
           
 boolean canUserExecute()
           
 boolean canUserRead()
           
 boolean canUserWrite()
           
 boolean canWorldExecute()
           
 boolean canWorldRead()
           
 boolean canWorldWrite()
           
 boolean equals(Object object)
           
 String getRwxString()
           
 int hashCode()
          Return the hash code for this object.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ALL

public static final Permissions ALL

NONE

public static final Permissions NONE

DEFAULT

public static final Permissions DEFAULT
Constructor Detail

Permissions

public Permissions(String rwxString)
Costruct a new instance for the specified read/write/execute specification String

Parameters:
rwxString - - the read/write/execute specification String; must be 9 characters long, with chars at index 0,3,6 == '-' or 'r', chars at index 1,4,7 == '-' or 'w' and chars at index 2,5,8 == '-' or 'x'.
Method Detail

asRwxString

public String asRwxString()
Return the read/write/execute specification String representing the set of permissions. For example: "rwxrwxrwx" or "rw-r-----".

Returns:
the String containing 9 characters that represent the read/write/execute permissions.

getRwxString

public String getRwxString()
Returns:
the RWX string for this instance

equals

public boolean equals(Object object)
Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Return the hash code for this object.

Overrides:
hashCode in class Object
See Also:
Object.hashCode()

canUserRead

public boolean canUserRead()
Returns:
true if and only if the user has read permission

canUserWrite

public boolean canUserWrite()
Returns:
true if and only if the user has write permission

canUserExecute

public boolean canUserExecute()
Returns:
true if and only if the user has execute permission

canGroupRead

public boolean canGroupRead()
Returns:
true if and only if the group has read permission

canGroupWrite

public boolean canGroupWrite()
Returns:
true if and only if the group has write permission

canGroupExecute

public boolean canGroupExecute()
Returns:
true if and only if the group has execute permission

canWorldRead

public boolean canWorldRead()
Returns:
true if and only if the world has read permission

canWorldWrite

public boolean canWorldWrite()
Returns:
true if and only if the world has write permission

canWorldExecute

public boolean canWorldExecute()
Returns:
true if and only if the world has execute permission

toString

public String toString()
Overrides:
toString in class Object
Returns:
the String representation of this object.


Copyright © 2014. All rights reserved.