Java examples for File Path IO:ACL File
Iterate over the list and extract each Read ACL entry's components
import java.io.IOException; import java.nio.file.Files; import java.nio.file.LinkOption; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.attribute.AclEntry; import java.util.List; public class Main { public static void main(String[] args) { List<AclEntry> acllist = null; Path path = Paths.get("C:/folder1/folder2/folder4", "test.txt"); try {//from w w w .jav a 2s .co m acllist = (List<AclEntry>) Files.getAttribute(path, "acl:acl", LinkOption.NOFOLLOW_LINKS); } catch (IOException e) { System.err.println(e); } for (AclEntry aclentry : acllist) { System.out.println("Principal: " + aclentry.principal().getName()); System.out.println("Type: " + aclentry.type().toString()); System.out.println("Permissions: " + aclentry.permissions().toString()); System.out.println("Flags: " + aclentry.flags().toString()); } } }