Using the Java NIO API
Java I/O is one of the four core APIs of the JDK, on which many others are built, including database access and REST Services. In this course, you will learn how to work with files on a file system, and how to access text files.
What you'll learn
The Java I/O API is a fundamental API of the JDK, at the core of database access APIs and web access APIs. In this course, Using the Java NIO API, you will learn how to handle files using the Files factory class, and how to deal with text files in Java. First, you will see how to manipulate files on the file system: how to create, copy, move, and delete them. Then, you will discover how to find files in a set of directories with two different approaches: visitor pattern, and the map / filter / reduce pattern, as implemented by the Stream API. Next, you will explore how to create and analyze text files. Finally, you will be shown how to deal with CharSets to handle exotic formats, as well as a real-world case study: the analysis of a CSV file. After watching this course, you will be ready to deal with file handling problems and you will be able to conduct advanced tasks to handle complex text files, which is essential for web and REST services.
Table of contents
- Version Check 0m
- Introducing the Course: Dealing with Text Files on a File System 2m
- Who Are You? What Should You Know to Follow this Course? 1m
- Introducing the Agenda of the Course and This Module 1m
- Making the Difference between Instance of File and Path 1m
- Using Instances of File to Access Files on a File System 1m
- Creating Path Object Using the Available Factory Methods 2m
- Getting More Information on a File from the File and Path Objects 1m
- Module Wrap Up 1m
- Introducing the Module and Its Agenda 1m
- Introducing the Possible Errors When Dealing with Text Files 1m
- Placing the Text File Support in the Context of Java I/O 1m
- Creating a BufferedReader to Read the Text Content of a File 2m
- Using a BufferedWriter to Write Text Content to a File 2m
- Introducing the Use Case Study of the Live Demo 0m
- Live Demo: Creating a BufferedReader to Read a File Line by Line 3m
- Live Demo: Handling Non-UTF-8 Texts Using the Correct CharSet 2m
- Live Demo: Closing a Writer with the Try With Resources Pattern 2m
- Live Demo: Flushing a Writer Properly to Avoid Missing Writes 2m
- Module Wrap Up 1m
- Introducing the Module and Its Agenda 1m
- Manipulating Files on a File System Using the Files Factory Class 1m
- Getting Information on a Hierarchy of Directories Using a Visitor 3m
- Analyzing a Hierarchy of Directories Using the Stream API 2m
- Live Demo: Visit Directories with the Files.walkFileTree Pattern 5m
- Live Demo: Filtering Directory Content Using Files.walk 2m
- Module and Course Wrap Up 2m