src/share/classes/java/nio/file/attribute/PosixFilePermissions.java

Print this page

        

*** 124,134 **** * @see #toString(Set) */ public static Set<PosixFilePermission> fromString(String perms) { if (perms.length() != 9) throw new IllegalArgumentException("Invalid mode"); ! Set<PosixFilePermission> result = new HashSet<PosixFilePermission>(); if (isR(perms.charAt(0))) result.add(OWNER_READ); if (isW(perms.charAt(1))) result.add(OWNER_WRITE); if (isX(perms.charAt(2))) result.add(OWNER_EXECUTE); if (isR(perms.charAt(3))) result.add(GROUP_READ); if (isW(perms.charAt(4))) result.add(GROUP_WRITE); --- 124,134 ---- * @see #toString(Set) */ public static Set<PosixFilePermission> fromString(String perms) { if (perms.length() != 9) throw new IllegalArgumentException("Invalid mode"); ! Set<PosixFilePermission> result = new HashSet<>(); if (isR(perms.charAt(0))) result.add(OWNER_READ); if (isW(perms.charAt(1))) result.add(OWNER_WRITE); if (isX(perms.charAt(2))) result.add(OWNER_EXECUTE); if (isR(perms.charAt(3))) result.add(GROUP_READ); if (isW(perms.charAt(4))) result.add(GROUP_WRITE);
*** 139,150 **** return result; } /** * Creates a {@link FileAttribute}, encapsulating a copy of the given file ! * permissions, suitable for passing to the {@link java.nio.file.Path#createFile ! * createFile} or {@link java.nio.file.Path#createDirectory createDirectory} * methods. * * @param perms * the set of permissions * --- 139,150 ---- return result; } /** * Creates a {@link FileAttribute}, encapsulating a copy of the given file ! * permissions, suitable for passing to the {@link java.nio.file.Files#createFile ! * createFile} or {@link java.nio.file.Files#createDirectory createDirectory} * methods. * * @param perms * the set of permissions *