Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JimFS: how to get File from Path

Tags:

java

jimfs

I started using google jimfs and I can't understand how I can get file from path. In source code I see that Path.toFile throws UnsupportedOperationException. But how then can I use it without files? For example if my application need to know if some path is folder or file.

like image 502
Pavel_K Avatar asked Jul 02 '15 11:07

Pavel_K


1 Answers

The JSR 203 API has all the tools you need for that; and in this case, the Files class.

In spite of its name, it handles everything Path. For instance, you can use:

Files.isDirectory(thePath)

to test whether a file is a directory. But there are also other ways to test for the same thing.

like image 160
fge Avatar answered Oct 15 '22 00:10

fge