Java PosixFilePermissions .toString (Set < PosixFilePermission > perms)

Syntax

PosixFilePermissions.toString(Set < PosixFilePermission > perms) has the following syntax.

public static String toString(Set < PosixFilePermission > perms)

Example

In the following code shows how to use PosixFilePermissions.toString(Set < PosixFilePermission > perms) method.


/* w  w  w .jav a 2s. c o  m*/
import java.nio.file.attribute.PosixFilePermission;
import java.nio.file.attribute.PosixFilePermissions;
import java.util.Set;

public class Main {

  public static void main(String[] args) throws Exception {
    
    Set<PosixFilePermission> permissions = PosixFilePermissions.fromString("rw-r--r--");
    System.out.println(PosixFilePermissions.toString(permissions)); 
        
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.nio.file.attribute »




BasicFileAttributes
BasicFileAttributeView
DosFileAttributes
FileTime
PosixFileAttributes
PosixFilePermissions