hdfs-protolib/src/main/java/com/streamsets/pipeline/stage/destination/hdfs/util/HdfsUtils.java
public static FsPermission parseFsPermission(String permissions) throws IllegalArgumentException {
    try {
      // Octal or symbolic representation
      return new FsPermission(permissions);
    } catch (IllegalArgumentException e) {
      // FsPermission.valueOf will work with unix style permissions which is 10 characters
      // where the first character says the type of file
      if (permissions.length() == 9) {
        // This means it is a posix standard without the first character for file type
        // We will simply set it to '-' suggesting regular file
        permissions = "-" + permissions;
      }

      // Try to parse unix style format.
      return FsPermission.valueOf(permissions);
    }
  }
public static FsPermission parseFsPermission(String permissions) throws IllegalArgumentException {
    try {
      // Octal or symbolic representation
      return new FsPermission(permissions);
    } catch (IllegalArgumentException e) {
      // FsPermission.valueOf will work with unix style permissions which is 10 characters
      // where the first character says the type of file
      if (permissions.length() == 9) {
        // This means it is a posix standard without the first character for file type
        // We will simply set it to '-' suggesting regular file
        permissions = "-" + permissions;
      }

      // Try to parse unix style format.
      return FsPermission.valueOf(permissions);
    }
  }
Parse String representation of permissions into HDFS FsPermission class.

This method accepts the following formats:
* Octal like '777' or '770'
* HDFS style changes like 'a-rwx'
* Unix style write up with 9 characters like 'rwxrwx---'

@param permissions String representing the permissions
@return Parsed FsPermission object