file,path,uri互相转换

uri 转 file :File file = new File(new URI(uri.toString()));

uri 转 path: Path path = Files.get(uri);

file 转 uri: URI uri = file.toURI();

file 转 path: Path path = Paths.get(file.getPath());

path 转 uri: URI uri = path.toUri()

path 转 file: File file = new File(path.toUri());

posted @ 2018-07-20 11:08  rayallenbj  阅读(4716)  评论(0编辑  收藏  举报