java.nio.file


1. Create a Path:

Path path = Paths.get("my/file.txt");

2. Get Absolute Path:

Path absolutePath = path.toAbsolutePath();

3. Get Directory Name:

Path directory = path.getParent();

4. Get File Name:

Path fileName = path.getFileName();

5. Check if File Exists:

boolean exists = Files.exists(path);

6. Create a Directory:

Files.createDirectories(path);

7. Create a File:

Files.createFile(path);

8. Delete a File:

Files.delete(path);

9. Copy a File:

Files.copy(sourcePath, targetPath);

10. Move a File:

11. Read a Text File:

12. Write a Text File:

13. Create a Random Access File:

14. Read Bytes from a File:

15. Write Bytes to a File:

16. Check if File is Regular:

17. Check if File is Hidden:

18. Get File Size:

19. Get File Last Modified Time:

20. Set File Last Modified Time:

21. Create a Temp File:

22. Create a Temp Directory:

23. Walk a File Tree:

24. Find Files with a Glob:

25. Find Files with a Filter:

26. Copy a Directory:

27. Zip a Directory:

28. Unzip a File:

29. Download a File from a URL:

30. Upload a File to a Server:

31. Create a Symbolic Link:

32. Get File Owner:

33. Set File Owner:

34. Get File Permissions:

35. Set File Permissions:

36. Check if File is Symbolic Link:

37. Get File Symbolic Link Target:

38. Create a File Lock:

39. Check if File is Open:

40. Create a Watch Service:

41. Create a File Attribute View:

42. Get File System Root Directory:

43. Get File System Separator:

44. Get File System Name:

45. Create a Secure Channel:

46. Map a File to Memory:

47. Create a ByteChannel:

48. Get File Store:

49. Get Usable Space on File Store:

50. Get Total Space on File Store: