code: protected int getMode(int mode) {
      int type = FILE_FLAG;
      if (isLink()) {
        type = LINK_FLAG;
      }
      else if (isDirectory()) {
        type = DIR_FLAG;
      }
      return type | (mode & PERM_MASK);
    }
docs: Get the file mode for given permissions with the correct file type.
  
  @param mode the mode
  @return the type with the mode
  @since 1.1