Java examples for File Path IO:File Attribute
Using the supportsFileAttributeView method with a String argument
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 {/*from w w w .j a v a 2 s . co m*/ 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: " + fileStore.supportsFileAttributeView("posix")); System.out.println("UserDefinedFileAttributeView supported: " + fileStore.supportsFileAttributeView("user")); System.out.println("DosFileAttributeView supported: " + fileStore.supportsFileAttributeView("dos")); } catch (IOException ex) { System.out.println("Attribute view not supported"); } } }