Java Fundamentals: Input/Output

Java I/O is one of the four core APIs of the JDK, on which many others are built, including Database access, Web Services, and REST Services. In this course, you'll learn everything you need to write and understand Java I/O code.
Course info
Rating
(22)
Level
Intermediate
Updated
Dec 19, 2017
Duration
3h 56m
Table of contents
Course Overview
Introduction to Java I/O, Organization of the API
Reading Characters
Writing Characters
Reading and Writing Bytes
Reading and Writing Data and Objects
Dealing with Hybrid Streams of Text and Bytes
Description
Course info
Rating
(22)
Level
Intermediate
Updated
Dec 19, 2017
Duration
3h 56m
Description

The Java I/O API is a fundamental API of the JDK, at the basis of database access APIs and Web access APIs. In this course, Java Fundamentals: Input/Output, you'll learn all the details of this API, both the theoretical aspects on slides and the patterns during extended live coding sessions. First, you'll delve into code in action, showing you real life problem solving techniques. Next, you'll explore how to read and write characters, how to create complex files mixing text and raw bytes, and how to create archive files using the ZIP format. Finally, you'll discover how to use serialization efficiently and how to deal with errors due to obsolete serialized objects. By the end of this course, you'll have the necessary knowledge to deal with complex Java I/O problems in existing legacy applications and new developments.

About the author
About the author

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.

More from the author
Eclipse for Java Developers
Intermediate
3h 22m
Apr 5, 2018
More courses by Jose Paumard
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
Hi everyone. My name is José. I am very excited to present my new course on the Java. io API. I am talking to you from Paris, where I live and work as an assistant professor at the university. I am a Java Champion and Java Rock Star for JavaOne. Java. io is a fundamental API to access discs and nice works. Many other APIs are built on top of Java. io, including JDBC, Servlets, Web and REST services. In this course, we will see how to use Java. io to read and write characters of robots, primitive types, and objects using the serialization mechanism. Also, the standard ways to override this mechanism. We will also see how we can leverage decoration to read and write compressed files into zip format. About half of this course is life coding, so that you can see how Java. io works exactly. Before you move on, be sure to be familiar with the Java language, including the writing of basic number expressions. For that, you can check the pro site Java library. There are many technical elements covered in this course, but don't be afraid of that. Let me guide you through this fundamental API of the JDK.

Reading Characters
Hello and welcome back to this Java I/O course and to the module Reading Characters. Let us quickly browse through the agenda of this module. You are first going to see the concept of Reader. You already know that Reader is an abstract class, but you are going to see more things about it. First, you will learn how to read characters from text files, which is the basic operation exposed by the Reader object. Then, you will see how to read text files line by line. And for that, you are going to use the Decorator pattern. Then, you will read the text from in-memory arrays instead of files. And for that, you will also use the Decorator pattern. And at last, you will see how to set up a character set when reading a text file. You know that when dealing with text, there are always issues with character sets between Latin-1, UTF-8, and the like. So, this point will be covered here.

Writing Characters
Hello and welcome to the third module of this Java I/O course. My name is Jose. We just saw how to read characters. Let us see now how to write them. Let us quickly browse through the agenda of this module. We are going to see the concept of writer. Writer is an abstract class that has the same kind of status as the reader class in the Java I/O API. We will see how to write characters to files, and there are several things that are not working in the same way as the reading operation. And then, we will see how it works to in-memory arrays.

Reading and Writing Bytes
Hello and welcome back to this Java IO course. My name is Jose. This module is about reading and writing robytes of data. You will see things a little faster in this module than in the two modules about readers and writers just because the concepts translates directly from the reader and the writer to the input stream and output stream objects. The handling of exceptions, the construction, the use of factory methods, the closing, the flushing, all this is exactly the same just applied to different objects. So let us quickly browse through the agenda of this module. This module is all about binary streams, reading and writing robytes to binary streams. So you will see how to write and read bytes to streams on disks and in in-memory buffers and you will see how to leverage the decorated pattern to very easily deal with compressed streams in the zip format.

Reading and Writing Data and Objects
Hello and welcome back to this Java IO course my name is Jose. This module is about reading and writing data and objects to binary stream. Let us browse through the agenda of this module. First you will learn the concept of object serialization in Java IO and why do you need to serialize objects. Then you will see the technical details of creating binary images of objects to store them on the disc or to send them over the network. And you will also learn how to override the standard serialization mechanism offered by the JDK.

Dealing with Hybrid Streams of Text and Bytes
Hello, my name is Jose, welcome back to this Java IO Course, for this last module about Hybrid Streams of Text and Bytes. Let's quickly browse through the agenda of this module, what are you going to learn? Well, you will learn how to write text on binary streams, and how to mix both text and bytes on the same binary streams. Hybrid streams are extremely common in applications, just to give you one example, the JPEG image file format, is a binary stream, combining text and binary compressed information. And then, in the second part, you will see how your can use sockets with Java IO API, you are going to create service sockets, client sockets, and have them communicate together using Java IO code. You'll be taken through the examples, first in slides, very quickly, and then in two extended live coding sessions, so you will see a lot of code in action, in this last module.