结合使用带有字符串参数的supportsFileAttributeView方法
/** 时 代 J a v a 提 供 **/ import java.io.IOException; import java.nio.file.FileStore; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; public class Main { public static void main(String[] args) { try { Path path = Paths.get("C:/home/docs/users.txt"); FileStore fileStore = Files.getFileStore(path); System.out.println("FileAttributeView supported: " + fileStore.supportsFileAttributeView("file")); System.out.println("BasicFileAttributeView supported: " + fileStore.supportsFileAttributeView("basic")); System.out.println("FileOwnerAttributeView supported: " + fileStore.supportsFileAttributeView("owner")); System.out.println("AclFileAttributeView supported: " + fileStore.supportsFileAttributeView("acl")); System.out.println("PosixFileAttributeView supported: " /** 时 代 J a v a 公 众 号 **/ + fileStore.supportsFileAttributeView("posix")); System.out.println("UserDefinedFileAttributeView supported: " + fileStore.supportsFileAttributeView("user"));