【问题标题】:Is it possible to set the POSIX group of a file?是否可以设置文件的 POSIX 组?
【发布时间】:2013-09-08 16:39:29
【问题描述】:

我知道可以使用Files.setOwner 设置文件的所有者:

Files.setOwner(Path path, UserPrincipal owner);

但是 POSIX group 呢? API 中没有such Files.setGroup() 方法,甚至使用FileOwnerAttributeView 也不起作用,因为也只有setOwner

有可能吗?

【问题讨论】:

    标签: java file posix nio


    【解决方案1】:

    如果您的应用仅在 POSIX 系统上运行,则有 PosixFileAttributeView.setGroup()

    【讨论】:

    • @Rollerball:好问题。根据to this,可能,但不一定。
    猜你喜欢
    • 2010-12-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多