java - "resolve"路径到底意味着什么?

标签 java path resolver

我现在已经阅读了许多有关 Java somePath.resolve( someOtherPath ) 使用的文章,但我找不到准确的定义以及有用的示例,确切地说 “解析”路径的意思。每个人似乎都假设你知道。 有人可以非循环地定义它吗?或者给我指出一个(非循环)解释器?

最佳答案

这个问题的答案在 documentation 中定义。 ,它很好地表明了该方法的作用。

Converts a given path string to a Path and resolves it against this Path in exactly the manner specified by the resolve method. For example, suppose that the name separator is "/" and a path represents "foo/bar", then invoking this method with the path string "gus" will result in the Path "foo/bar/gus".

换句话说,如果路径C:/Program Files/Foo/是当前Path并且Bar存在于中Foo,您可以执行以下操作:

Path parent = Paths.get("C:", "Program Files", "Foo");

Path child = parent.resolve("Bar");

关于java - "resolve"路径到底意味着什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67187401/

相关文章:

python - 从变量创建文件路径

angular - 如何让 Angular2 在渲染组件之前等待 promise

java - 即使应用程序完全关闭后,如何将按钮的状态(例如按钮的可见性)保存在 RecyclerView 项内?

java - 沿直线移动对象

python - Django 路径不匹配

android - 由于异常 : System. MissingMethodException : UnityEditor. VersionControl.Task 而停止轮询作业

javascript - Angular2,测试和解析数据 : How to test ngOnInit?

java - 在java中使用串行端口进行设备通信

java - Android Studio 将 Firebase 中的日期子项与日期设备进行比较

java - Kafka - 传输大媒体内容