Skip to content
KnowledgeCity

Advanced Java: Files and Directories

Get acquainted with Oracle’s new NIO library and how to use it to work with files, directories and the file system
Preview the first lesson free — get full access to all 3 lessons.
Course: On-Demand
Advanced Provider Scott Stanlick  3 Lessons ·  19m  in Arabic, German, English, Spanish, French, Portuguese, Chinese 

Course Description

In these lessons you will see how the new NIO library augments—and can even replace—the legacy I/O classes that have existed since the early days of Java. The old file API is used for many older projects, frameworks, and libraries; and despite its age, the legacy file API is not deprecated. In this way, you can still use it with any of the latest Java versions.

Learn how the new classes support symlinks, proper file attributes, metadata, ACLs and more. You will also learn how to create directories, files, and temporary storage, and we will compare and contrast the legacy support for these operations alongside the new and improved NIO library, which is far more intuitive and robust, and is compatible with the legacy classes, allowing you to incrementally evolve existing code.

New developments will likely use the NIO library without ever looking back, and after these lessons, you’ll know how to take full advantage of it.

What You'll Learn

  • Describe the new NIO library and how it augments or replaces the legacy I/O classes
  • Explain how the legacy I/O and NIO packages can coexist and remain compatible
  • Create directories, files, and temporary storage using the new and legacy approaches
  • Recognize the new Files and Paths helper classes
  • Compare Java.io.File against Java.nio.Path for file operations
  • Use NIO support for symlinks, file attributes, metadata, and ACLs

Key Takeaways

  • The new NIO library augments and can even replace the legacy I/O classes that have existed since the early days of Java.
  • Despite its age, the legacy file API is not deprecated and can still be used with any of the latest Java versions.
  • The NIO library is more intuitive and robust and is compatible with the legacy classes, allowing existing code to evolve incrementally.
  • The new NIO classes support symlinks, proper file attributes, metadata, and ACLs.
  • New development will likely use the NIO library, while the legacy file API remains in use across many older projects, frameworks, and libraries.

Frequently Asked Questions

What does this course cover?

It covers how the new NIO library augments and can replace the legacy I/O classes, how the I/O and NIO packages coexist, how to create directories, files, and temporary storage, and the new Files and Paths helper classes. It also compares Java.io.File with Java.nio.Path.

Is the legacy Java file API still usable?

Yes. The legacy file API is not deprecated despite its age and can still be used with any of the latest Java versions, and it is used in many older projects, frameworks, and libraries.

Why use the NIO library over the legacy classes?

The NIO library is far more intuitive and robust, supports symlinks, proper file attributes, metadata, and ACLs, and is compatible with the legacy classes so you can incrementally evolve existing code.

What skills will I gain from this course?

The course covers directory structure, file I/O, file structure, Java 11, Java Naming and Directory Interface, and Javadoc.

What lessons are included?

The lessons are Java.io.File vs. Java.nio.Path; Java.io.File and Java.nio.Path; and Creating and Manipulating Temporary Storage.