Class Permissions


  • public final class Permissions
    extends java.lang.Object
    Parser for Permission values. This class provides static methods to parse string and integer based permission modes into a set of permissions.
    Since:
    2.0
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Set<Permission> fromModeString​(java.lang.String modeStr)
      Parses the permissions from the given mode string.
      static java.util.Set<Permission> fromOctal​(int mode)
      Parses the permissions from the given octal mode value.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • UNIX_SYMBOLIC_MODE_PATTERN

        public static final java.util.regex.Pattern UNIX_SYMBOLIC_MODE_PATTERN
      • SIMPLE_SYMBOLIC_MODE_PATTERN

        public static final java.util.regex.Pattern SIMPLE_SYMBOLIC_MODE_PATTERN
    • Method Detail

      • fromModeString

        public static java.util.Set<Permission> fromModeString​(java.lang.String modeStr)
        Parses the permissions from the given mode string. The string can either be in one of two formats:
        1. Unix Symbolic format as given to 'chmod' on Unix/Linux
        2. Simple Symbolic format e.g. "rwxr-xr-x"
        Parameters:
        modeStr - the mode to be parsed
        Returns:
        the set of parsed permissions
        Throws:
        java.lang.IllegalArgumentException - if the given mode string is in the wrong format
      • fromOctal

        public static java.util.Set<Permission> fromOctal​(int mode)
        Parses the permissions from the given octal mode value.
        Parameters:
        mode - the octal permission mode
        Returns:
        the set of parsed permissions