Java NIO and NIO2 are two evolutions of the Java I/O API. It does not make Java I/O obsolete in any way, but merely bring more functionalities, leveraging the capabilities of file systems, not used by Java I/O.
Java NIO and NIO2 have been added to the JDK to add more functionalities offered by the file systems that aren't used by Java I/O. In this course, Java Fundamentals: NIO and NIO2, you'll learn how to use Java NIO to read and write data efficiently in bulk mode, and asynchronously to handle more operations simultaneously. First, you'll explore the fundamental objects of this API, including Buffer, Channel, and Selector to precisely set up performant I/O applications for disk or network access. Next, you'll discover how to efficiently navigate through very large directory structures, and how to trigger actions on directory events plugged on the native capabilities of the file systems for better performance. Finally, you'll delve into all of these APIs in action in extended live coding sessions, showing you how to properly use the patterns and how to deal with errors. By the end of this course, you'll have the necessary knowledge to design and create robust and performant I/O systems by following the right patterns, whether you want to access file systems or networks.
Passionate about programming computers for over 20 years, Jose made his debut in assembler and C, C for SIMD parallel machines before adopting Java as an object-oriented language. Assistant professor in Paris North University for more than 15 years, Jose also brings his expertise to many projects, in various industrial fields.
Course Overview Hi, everyone, my name is Jose. I am very glad to present my new course about Java NIO and NIO2. I am talking to you from Paris, where I live and work as an assistant professor here at the university. I'm a Java Champion and Java Rockstar for Java (mumbles). Java Non-blocking IO or NIO is about adding features to Java IO for better performances. It provides the support for very large buffers or asynchronous capabilities. All those topics are precisely explained with real life use cases presented in live coding for both disk and network access. On the other hand, NIO2 brings native access to the file system with API to explore very large directory trees and to respond to file creations, deletions, and modifications events. This is also precisely explained in slides and live coding sessions. Before following this course, be sure to be familiar with the Java language, including the writing of basic lambda expressions and basic Java I/O notions. For that, you can check the Pluralsight Java library. This course is very technical, so I put many examples in it, first explained in slides and then D mode and live coding sessions to make things easy to understand for you.
Setting up Asynchronous Operations with NIO Hello, my name is Jose. Welcome back to this Java NIO, NIO. 2 course. And welcome to this module, setting up asynchronous operations with non-blocking input/output. Here is your agenda for this module. The goal is to introduce asynchronous operations using Java NIO. First, you will see the difference between synchronous and asynchronous operations. And then you will learn about selectors and the bare minimum you need to know about socket channels. Then you will see how to set up asynchronous network operations using selectors. This is the use case you will see in detail, both in slides and in the live coding session of this module.
Using FileSystems in Java NIO2 Hello, and welcome back to this Java NIO, NIO2 course. My name is Jose. This module is about using file systems in Java NIO2. The agenda of this course is the following: as we mentioned in the introduction of this course, NIO2 has been introduced in 2011 in Java 7. It provides classes to access the file system directly, and implements file systems dependent operations not provided in Java input/output. The FileSystemProvider class, the FileSystem class, and the FileStore class are three of those classes that we are going to cover after a quick introduction on why those classes have been created, and why they have been introduced in the JDK. All this is highly operating system and file system dependent. And it's really a great change in the philosophy of the design of the JDK, since the JDK at first aimed to be completely operating system and file system independent.
Visiting Directory Trees Hello and welcome back to this Java NIO and NIO. 2 course. My name is Jose. In this module, you will learn how to visit directory trees using Java NIO. 2. Let us quickly see the agenda of this module. The goal of this module is to present the API from NIO2 to explore the content of directories. And there are three of them. The question remains the same. Why do we need a new API for that since we can already do that with plain Java IO coder. The answer is simple. Increased efficiency. NIO2 gives better performances than plain Java IO coder. You will see the path matchers that are used to filter paths from a directory tree and how to filter the content of a tree with regular expressions and control over the depth of exploration. And at least you will see how to visit a directory tree using the visit pattern introduced in NIO2.
Listening to Directory Events Hello, my name is Jose. I am very happy to welcome you back for the last module of the Java NIO. 2 course about listening to directory events. What are you going to learn in this module? Well, this module is about observing what is happening in a directory. So the question is: what can happen in a directory? Well, we can have file creation or directory creation or deletion or modification. And this is what this module is about, using the Java NIO. 2 API to be able to catch those events and to react on them in a way that is reliable, portable, and performant since the API you are going to see is bound to the native APIs of the file system.