Paths
拼接和标准化文件路径、URL 字符串。Java 导入 com.ouroboros.util.Paths。
Paths.File
import com.ouroboros.util.Paths;
var path = Paths.File.of("workspace", "app", "config.json");
String name = path.getName(); // config.json
String suffix = path.getSuffix(); // json
boolean exists = path.exists();
| 方法 | 返回值 |
|---|---|
Paths.File.of(String... segments) | Paths.File |
getPath() / getParent() / getName() | 路径、父路径和文件名 |
getSuffix() | 小写扩展名 |
toFile() | java.io.File |
exists() / isFile() / isDirectory() | 文件状态 |
文件路径从系统根分隔符开始拼接,例如 Unix 上得到 /workspace/app/config.json。需要相对于工作目录解析时,使用 java.nio.file.Path.of(...);不要假定这两个 API 的相对路径语义相同。