集册 Java实例教程 使用带有字符串参数的supportsFileAttributeView方法

使用带有字符串参数的supportsFileAttributeView方法

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

554
结合使用带有字符串参数的supportsFileAttributeView方法
/** 时 代 J a v a 提 供 **/

import java.io.IOException;

import java.nio.file.FileStore;

import java.nio.file.Files;

import java.nio.file.Path;

import java.nio.file.Paths;


public class Main {

  public static void main(String[] args) {

    try {


      Path path = Paths.get("C:/home/docs/users.txt");

      FileStore fileStore = Files.getFileStore(path);

      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: "
      /**
      时 代 J a v a 公 众 号
      **/

          + fileStore.supportsFileAttributeView("posix"));

      System.out.println("UserDefinedFileAttributeView supported: "

          + fileStore.supportsFileAttributeView("user"));

      
展开阅读全文