Java FileStore check if file attribute support BasicFileAttributeView
import java.io.IOException; import java.nio.file.FileStore; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.attribute.BasicFileAttributeView; import java.nio.file.attribute.FileAttributeView; public class Main { public static void main(String[] args) { Path path = Paths.get("C:/Java_dev"); try {// w ww.j ava 2 s. co m FileStore fs = Files.getFileStore(path); Class<? extends FileAttributeView> attribClass = BasicFileAttributeView.class; // Check if the file attribute view is supported boolean supported = fs.supportsFileAttributeView(attribClass); System.out.format("%s is supported: %s%n", attribClass.getSimpleName(), supported); } catch (IOException ex) { ex.printStackTrace(); } } }