Java examples for File Path IO:ACL File
You can also use the getAttribute() method to read an ACL:
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 . j av a2 s. c om acllist = (List<AclEntry>) Files.getAttribute(path, "acl:acl", LinkOption.NOFOLLOW_LINKS); } catch (IOException e) { System.err.println(e); } } }
ACL attributes can be required with the following names:
The generally accepted form is [view-name:]attribute-name.
The view-name is acl.