NIO 2 File API

From NovaOrdis Knowledge Base
Revision as of 07:51, 6 August 2020 by Ovidiu (talk | contribs)
Jump to navigation Jump to search

External

Internal

Subjects

Recipes

Create one directory:

Path parent = ...;
Path dir = Files.createDirectory(Paths.get(parent.toString(), "my-dir"));

Create a directory hierarchy:

Path parent = ...;
Path dir = Files.createDirectories(Paths.get(parent.toString(), "dir1/dir2/dir3"));

Get file name:

Path file = ...;
String fileName = file.getFileName().toString();