railo.commons.io
Class ModeUtil

java.lang.Object
  extended by railo.commons.io.ModeUtil

public final class ModeUtil
extends Object


Field Summary
static int PERM_EXECUTE
           
static int PERM_READ
           
static int PERM_WRITE
           
static int ROLE_GROUP
           
static int ROLE_OWNER
           
static int ROLE_WORLD
           
 
Constructor Summary
ModeUtil()
           
 
Method Summary
static boolean hasPermission(int role, int permission, int mode)
          check mode for a specific permission
static boolean isExecutable(int octalMode)
          check if mode is executable for owner
static boolean isReadable(int octalMode)
          check if mode is readable for owner
static boolean isWritable(int octalMode)
          check if mode is writeable for owner
static void main(String[] args)
           
static int setExecutable(int octalMode, boolean value)
           
static int setReadable(int octalMode, boolean value)
           
static int setWritable(int octalMode, boolean value)
           
static int toOctalMode(String strMode)
          translate a string mode (777 or drwxrwxrwx to a octal value)
static String toStringMode(int octalMode)
          translate a octal mode value (73) to a string representation ("111")
static int updateMode(int existingOctal, int updateOctal)
          update octal mode with a other
static String updateMode(String existing, String update)
          update a string mode with a other (111+222=333 or 333+111=333 or 113+202=313)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PERM_READ

public static final int PERM_READ
See Also:
Constant Field Values

PERM_WRITE

public static final int PERM_WRITE
See Also:
Constant Field Values

PERM_EXECUTE

public static final int PERM_EXECUTE
See Also:
Constant Field Values

ROLE_OWNER

public static final int ROLE_OWNER
See Also:
Constant Field Values

ROLE_GROUP

public static final int ROLE_GROUP
See Also:
Constant Field Values

ROLE_WORLD

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

ModeUtil

public ModeUtil()
Method Detail

toOctalMode

public static int toOctalMode(String strMode)
                       throws IOException
translate a string mode (777 or drwxrwxrwx to a octal value)

Parameters:
strMode -
Returns:
Throws:
IOException

toStringMode

public static String toStringMode(int octalMode)
translate a octal mode value (73) to a string representation ("111")

Parameters:
strMode -
Returns:

updateMode

public static String updateMode(String existing,
                                String update)
                         throws IOException
update a string mode with a other (111+222=333 or 333+111=333 or 113+202=313)

Parameters:
existing -
update -
Returns:
Throws:
IOException

updateMode

public static int updateMode(int existingOctal,
                             int updateOctal)
update octal mode with a other

Parameters:
existingOctal -
updateOctal -
Returns:

hasPermission

public static boolean hasPermission(int role,
                                    int permission,
                                    int mode)
check mode for a specific permission

Parameters:
role -
permission -
mode -
Returns:

isReadable

public static boolean isReadable(int octalMode)
check if mode is readable for owner

Parameters:
octalMode -
Returns:

isWritable

public static boolean isWritable(int octalMode)
check if mode is writeable for owner

Parameters:
octalMode -
Returns:

isExecutable

public static boolean isExecutable(int octalMode)
check if mode is executable for owner

Parameters:
octalMode -
Returns:

setReadable

public static int setReadable(int octalMode,
                              boolean value)

setWritable

public static int setWritable(int octalMode,
                              boolean value)

setExecutable

public static int setExecutable(int octalMode,
                                boolean value)

main

public static void main(String[] args)
                 throws IOException
Throws:
IOException


Copyright © 2012 Railo