集册 Java实例教程 特定于DOS文件系统的DOS视图

特定于DOS文件系统的DOS视图

欢马劈雪     最近更新时间:2020-01-02 10:19:05

391
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(
展开阅读全文