gpt4 book ai didi

java - 如何导入 UnixFileAttributes?

转载 作者:行者123 更新时间:2023-12-02 07:03:19 25 4
gpt4 key购买 nike

当我执行此代码片段时:

 FileSystem fs = FileSystems.getDefault();
for (String s : fs.supportedFileAttributeViews())
{
System.out.println(s);
}

我得到这个结果:“基本所有者用户 unix dos posix”

然后,当我实际尝试使用 UnixFileAttributeView() 时,它似乎不存在。我通过导入 java.nio.file.attribute.*; 导入了整个包,还尝试直接导入java.nio.file.attributes.UnixFileAttributeView;而且它似乎不存在。

而我可以导入从fs.supportedFileAttributeViews()获得的所有其他attributeViews .

你知道为什么会这样吗?而且我该如何解决它?

提前致谢。

最佳答案

来自文档

PosixFileAttributeView – Extends the basic attribute view with attributes supported on file systems that support the POSIX family of standards, such as UNIX. These attributes include file owner, group owner, and the nine related access permissions.

关于java - 如何导入 UnixFileAttributes?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16382809/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com