Example usage for java.nio.file FileStore supportsFileAttributeView

List of usage examples for java.nio.file FileStore supportsFileAttributeView

Introduction

In this page you can find the example usage for java.nio.file FileStore supportsFileAttributeView.

Prototype

public abstract boolean supportsFileAttributeView(String name);

Source Link

Document

Tells whether or not this file store supports the file attributes identified by the given file attribute view.

Usage

From source file:Main.java

public static void main(String[] args) throws IOException {
    FileSystem fileSystem = FileSystems.getDefault();

    for (FileStore store : fileSystem.getFileStores()) {
        boolean supported = store.supportsFileAttributeView("basic");
        System.out.println(store.name() + " ---" + supported);
    }/*from w w w.  j  a  v  a  2s  .  co  m*/
}

From source file:Main.java

public static void main(String[] args) throws IOException {
    FileSystem fileSystem = FileSystems.getDefault();

    for (FileStore store : fileSystem.getFileStores()) {
        boolean supported = store.supportsFileAttributeView(BasicFileAttributeView.class);
        System.out.println(store.name() + " ---" + supported);
    }/*from  ww w  . j  a  v  a 2 s  .c  o  m*/
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Path path = Paths.get("");
    FileStore fs = Files.getFileStore(path);

    // Check if POSIX file attribute is supported by the file store
    boolean supported = fs.supportsFileAttributeView(PosixFileAttributeView.class);
    if (supported) {
        System.out.println("POSIX file attribute view  is supported.");
    } else {//w  ww .  j a  v  a2 s.c om
        System.out.println("POSIX file attribute view  is not  supported.");
    }

}

From source file:Test.java

public static void main(String[] args) throws Exception {
    Path path = Paths.get("C:/home/docs/users.txt");
    FileStore fileStore = Files.getFileStore(path);
    System.out.println(//  w  ww  . j a  va  2  s  .c om
            "FileAttributeView supported: " + fileStore.supportsFileAttributeView(FileAttributeView.class));
    System.out.println("BasicFileAttributeView supported: "
            + fileStore.supportsFileAttributeView(BasicFileAttributeView.class));
    System.out.println("FileOwnerAttributeView supported: "
            + fileStore.supportsFileAttributeView(FileOwnerAttributeView.class));
    System.out.println("AclFileAttributeView supported: "
            + fileStore.supportsFileAttributeView(AclFileAttributeView.class));
    System.out.println("PosixFileAttributeView supported: "
            + fileStore.supportsFileAttributeView(PosixFileAttributeView.class));
    System.out.println("UserDefinedFileAttributeView supported: "
            + fileStore.supportsFileAttributeView(UserDefinedFileAttributeView.class));
    System.out.println("DosFileAttributeView supported: "
            + fileStore.supportsFileAttributeView(DosFileAttributeView.class));

    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"));
}

From source file:Main.java

public static void printDetails(FileStore fs, Class<? extends FileAttributeView> attribClass) {
    boolean supported = fs.supportsFileAttributeView(attribClass);
    System.out.format("%s is  supported: %s%n", attribClass.getSimpleName(), supported);
}