Java IO Tutorial - 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  ww.  ja  v  a  2s .com*/
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.