gpt4 book ai didi

Java 7 - LinkOption - 为什么 NOFOLLOW_LINKS 是唯一可用的选项?

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:21:40 24 4
gpt4 key购买 nike

我认为标题说明了一切。我将如何指定 FOLLOW_LINKS?为什么要创建一个只有一个选项的枚举?例如,方法 java.nio.file.Files.getLastModifiedTime(Path, LinkOption...) 将 LinkOption-s 数组作为参数。你必须通过一些东西,但你只能通过一个可用的选项。这让我很吃惊,很想了解更多。

最佳答案

跟随链接是默认行为。即,如果您不指定 NOFOLLOW_LINKS,则会跟踪链接。

来自documentation Files.getLastModifiedTime() 方法(强调我的):

The options array may be used to indicate how symbolic links are handled for the case that the file is a symbolic link. By default, symbolic links are followed and the file attribute of the final target of the link is read. If the option NOFOLLOW_LINKS is present then symbolic links are not followed.

关于Java 7 - LinkOption - 为什么 NOFOLLOW_LINKS 是唯一可用的选项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20052653/

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