0

How to get some information about Path object?

Share:

The java.nio.Path provides some methods to obtain information about the Path. For example you can get information about the file name, the parent and the root path. For these you can call the getFileName(), getParent() and getRoot() method respectively.

You can also get the number of elements that make up this Path using the getNameCount() method. And to get the subpath you can use the subpath() method and specify the starting and ending indexes. The code snippet below demonstrate to you how to get these informations.

This code will print something like:

Filed in: Java IO

Leave a Reply

Submit Comment

© 2014 Java Examples - Developed with