Get java.nio.file.Path object from java.io.File

前端 未结 4 781
广开言路
广开言路 2020-12-23 15:36

Is it possible to get a Path object from a java.io.File?

I know you can convert a path to a file using toFile() method, but I couldn\'t fin

4条回答
  •  Happy的楠姐
    2020-12-23 16:10

    Yes, you can get it from the File object by using File.toPath(). Keep in mind that this is only for Java 7+. Java versions 6 and below do not have it.

提交回复
热议问题