Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Before you attempt to access a view's attributes, make sure that your file system supports the corresponding view. NIO.2 lets you either view the entire list of supported views by name or check if a file store—represented by the FileStore class that maps any type of store, such as partitions, devices, volumes, and so on—supports a particular view.
Once you obtain access to the default file system—by calling the FileSystems.getDefault() method—you can easily iterate over the supported views returned by the FileSystem.supportedFileAttributeViews() method. The following code snippet shows how to do this:
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.util.Set;
…
FileSystem fs = FileSystems.getDefault();
Set<String> views = fs.supportedFileAttributeViews();
for (String view : views) {
System.out.println(view);
}