Skip to content
KnowledgeCity

Advanced Java: I/O

Discover Oracle’s new NIO library for creating, reading and writing files and see how it can streamline your programming tasks
Preview the first lesson free — get full access to all 3 lessons.
Course: On-Demand
Advanced Provider Scott Stanlick  3 Lessons ·  9m  in Arabic, German, English, Spanish, French, Portuguese, Chinese 

Course Description

In these lessons, we will look at the new NIO library for reading and writing files. Many Java applications require that you interact with various input/output devices. Java I/O is the flow of data that you can either read from, or you can write to. It is used to perform read and write operations in file permanently. Java uses I/O streams to perform these tasks. The I/O streams are how we will demonstrate reading and writing files. Lastly, we will peer into file system using metadata methods.

What You'll Learn

  • Describe the Java NIO library and its file-handling capabilities
  • Read from and write to the file system using Java I/O
  • Use java.nio.file.Path in place of the legacy java.io.File API
  • Work with the java.nio.file.Files class for common file and directory operations
  • Handle file metadata, attributes, ACLs, and symlinks
  • Create temporary files using the NIO library

Key Takeaways

  • The legacy java.io.File API is not deprecated and still works with the latest Java versions.
  • java.nio.file.Path does everything java.io.File can and generally does it better, supporting symlinks, file attributes, metadata, and ACLs.
  • The java.nio.file.Files class provides many common functions that operate on files and directories.
  • Input and output cover a broad range of sources, requiring handling of both character and byte file contents.
  • The course covers reading, writing, and working with file metadata.

Frequently Asked Questions

What does this course cover?

It covers how to read and write to and from the file system in Java, including the NIO library, the java.nio.file.Path and java.nio.file.Files classes, file metadata, and creating temporary files. Lessons include Reading, Writing, and File Metadata.

Does this course teach the legacy file API or the newer NIO library?

Both. It explains the legacy file API, which is still usable and not deprecated, while showing how java.nio.file.Path and the NIO library generally do the same work better, with support for symlinks, file attributes, metadata, and ACLs.

What skills will I gain from this course?

You will gain skills in File I/O, I/O processing, Java 11, Java Advanced Imaging, Java APIs, and Non-Blocking I/O in Java.

What are the learning objectives?

The objectives are to describe the new NIO library, understand how to read and write to the file system, and explain how to create temporary files.