DosFileAttributeView视图使用DOS属性扩展了基本视图。
import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; /* n o w j a v a . c o m 提 供 */ import java.nio.file.attribute.DosFileAttributes; public class Main { public static void main(String[] args) { DosFileAttributes attr = null; Path path = Paths.get("C:/folder1/folder2/folder4", "test.txt"); try { attr = Files.readAttributes(path, DosFileAttributes.class); } catch (IOException e) {/** 来 自 N o w J a v a . c o m**/ System.err.println(e); } System.out.println("Is read only ? " + attr.isReadOnly()); System.out.println(