2.2.2 从 Path 中获取信息
发布时间:2016-01-06 11:00:27
Demo:import java.nio.file.Path;import java.nio.file.Paths;public class PathInfoTest { public static void main(String[] args) { // ...
Demo:
import java.nio.file.Path;import java.nio.file.Paths;public class PathInfoTest { public static void main(String[] args) { // 创建绝对路径(位置) Path listing = Paths.get("/Users/jinxing/Documents/pathtest"); System.out.println("File Name: " + // 位置(文件)名称 listing.getFileName()); System.out.println("Number of Name Elements in the Path: " + // (位置)路径层级 / 元素数量 listing.getNameCount()); System.out.println("Parent Path: " + // 上级位置 / 上级文件路径 listing.getParent()); System.out.println("Root of Path: " + // 跟位置(路径) listing.getRoot()); System.out.println("Subpath from Root,2 elements deep: " + // 截断路径——从第1个反斜杠开始截取到第3个反斜杠——反斜杠计数从0开始——结果不包含头尾反斜杠 // /Users/jinxing/Documents/pathtest --> jinxing/Documents listing.subpath(1, 3)); }}
原标题:2.2.2 从 Path 中获取信息
关键词:
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。
锦木信息:https://www.goluckyvip.com/tag/11467.html
境外资讯交流:https://www.goluckyvip.com/tag/11468.html
Automatic:https://www.goluckyvip.com/tag/11469.html
大促降至:https://www.goluckyvip.com/tag/1147.html
Manual:https://www.goluckyvip.com/tag/11470.html
Zalora:https://www.goluckyvip.com/tag/11471.html
永康白云风景区怎么走 白云山风景区怎么去??:https://www.vstour.cn/a/363181.html
2022世界杯门票如何买?:https://www.vstour.cn/a/363182.html