
Explore why 70–80 percent of app time is spent on input and output, and learn to write efficient Java IO, NIO, and NIO2 code with streams, serialization, and compression.
Identify prerequisites for efficient java io, including object oriented programming concepts, the collection framework, and threads, to start the course and optimize input and output to save execution time.
Explore what io is and why Java io enables reading and writing data to files, networks, or memory by converting data to bytes, with Java io and io2 enhancements.
Navigate classic IO, NIO, and NIO2 with streams, readers, data streams, and serialization. Explore utilities for compression, filesystem API, directory listing, and watching directory events.
Explore the classic java i/o landscape with stream classes, reader and writer text i/o, and data streams, then learn filesystem methods to check, create, delete, or modify files.
Understand how the file object represents files or directories on disk, and how four constructors create it from a pathname, a parent and child, or a URI, without guaranteeing existence.
Explore file object operations in java io, including creating files and directories, checking existence, and listing directory contents. Understand absolute and canonical paths, and how to inspect size and parent.
Explore the file system, create file objects with constructors, and apply essential file api methods, while noting additional operations in the javadoc.
Explore byte streams, the foundational input and output streams in Java I/O, and how bytes flow from source to destination. Learn byte-by-byte reading and writing and why concrete implementations matter.
Explore the bitstream hierarchy by examining in stream and upstream base classes, their implementation nodes, and key classes for disk and in-memory byte arrays, guided by a mind map.
Read bytes from a file with file input stream and write with file output stream. Explore byte-by-byte reading and buffering to copy data between files and handle end-of-file.
Explore in-memory byte streams using byte array input and output streams to read and write data within in-memory arrays, with an initial 32-byte buffer that grows as needed.
Learn to work with in memory streams and byte streams in Java IO, using buffers to read bytes, handle end-of-stream (-1), and apply mark and reset with a read-ahead limit.
Learn to handle checked exceptions in java i/o operations, using try-catch blocks and proper resource management to prevent leaks with close calls or try-with-resources.
Explore piped streams that enable concurrent reading and writing by connecting piped input and output streams, sharing a 1024-byte buffer for producer–consumer data exchange.
Demonstrate a pipe using piped input and output streams to transfer bytes between producer and consumer threads, with a file source and a file sink.
Explore how sequence input stream merges multiple IO sources into a single continuous stream by reading them in a defined order, via constructors that accept input streams or an enumeration.
The lecture demonstrates how to combine multiple streams using sequence input stream to read bytes from files and in-memory data, demonstrating chaining two streams and extending to more than two.
Explain why StringBufferInputStream is deprecated for reading bytes from a string, highlight conversion issues, and introduce string reader as the recommended alternative in the character streams section.
Discover how filter streams wrap underlying input and output streams to add functionality in Java IO, NIO, and NIO2, using delegating subclasses.
Explore buffered streams to boost performance by using internal buffers that read and write data in large blocks, reducing native API calls and disk or network access.
Decorate a file input stream with a buffered input stream to read data in chunks, reducing I/O calls, and manage resources automatically using the try-with-resources pattern.
Explore how the decorator pattern wraps a base input stream with wrappers that add functionality at runtime, enabling flexible chaining of decorations.
Explore pushback streams in Java IO, enabling lookahead by unread bytes in a pushback buffer. Learn about one-byte and custom buffer size constructors.
Discover how a pushback stream helps distinguish between logical and operator and bitwise and operator while parsing a byte stream, using a buffer and pushback to return bytes.
Discover LineNumberInputStream that tracks the current line and handles line terminators (cr, lf, or crlf), why it was deprecated, and LineNumberReader as its character-based alternative.
Explore print stream, a stream tool that formats data and writes it to a stream. Create it by wrapping a stream, with constructors for files or streams, and auto flush.
Explore the print stream demo in Java, showing printing strings, ints, and floats with print and println on system.out, and using append and checkError for formatting and error handling.
Recap of Java I/O, covering byte streams, file and in-memory streams, pipe and sequence streams, buffered and pushback streams, data and object streams, with decorator patterns.
Explore how character streams enable precise reading and writing of text data in Java, addressing character encodings and how readers and writers wrap byte streams.
Explore how character sets like ASCII, extended ASCII, and Unicode define characters, while UTF-8 encodings describe how those characters are stored in memory with multibyte rules and backward compatibility.
Explore the mind map of reading and writing characters with the reader and writer abstractions and their file and string implementations. Learn key operations: character-by-character I/O, buffering, and closing resources.
Learn how to read and write characters in Java using FileReader and FileWriter, explore character streams and encodings, and apply best practices for exception handling and closing resources.
Read text from a file using file reader with utf-8 encoding, printing characters until end of file. Write content with a writer, using try-with-resources to close automatically.
Read characters by filling a buffer with a read(buffer) call, and retrieve them later; end-of-file is indicated by -1, while the buffer size caps the maximum characters read each time.
Demonstrate reading from a source file and writing to a destination file using a character buffer, with various read and write overloads, offsets, and direct buffer transfer.
Learn how to use the skip operation to move reading forward, and how mark, reset, and read-ahead limit enable repositioning in character streams.
Demonstrates skipping characters in a file reader to process structured data, writing the remaining content to a destination, and notes that mark and reset are not supported.
Master writer operations in java i/o, including writing by character or string, using offset and length, and appending characters or sequences, plus a java 11 factory writer that discards input.
Explore in-memory character I/O with CharArrayReader and CharArrayWriter. Learn to set start position and length, and use mark and reset while CharArrayWriter returns a copy of internal data.
Explore how CharArrayReader reads from a char array and CharArrayWriter writes to an in-memory buffer, illustrating buffer usage, mark and reset, and exception on read after close.
Explore string reader and string writer, Java character streams that read from and write to in-memory strings. They use Unicode and offer content via toString or getBuffer.
Explore string reader and string writer demos by directly using strings to create readers and writers, capturing results, and printing outputs in a streamlined input and output flow.
Buffered reader and buffered writer wrap underlying streams to speed up character i/o with an 8192-character buffer; reads come from the buffer and writes flush when full, decorating other streams.
Explore how buffered readers and writers improve i/o performance and simplicity by reading lines with readLine, writing with write and newLine, and using lines(), map, and filter for processing.
Explore line number tracking in LineNumberReader, a buffered reader that adds line numbering via getLineNumber and setLineNumber, starting at zero and increasing at line terminators: line feed and carriage return.
Explore piped character streams by wiring a piped writer and a piped reader to exchange characters through a blocking queue, with one end writing and the other reading.
Observe a piped reader-writer demo with separate threads and a blocking queue mediating data between reader and writer for independent text-file I/O, including a typewriter-style transfer.
Wrap readers and writers with filter readers and filter writers to decorate and filter the underlying data streams during reading and writing, and extend filter classes to create custom filters.
Learn to build a custom filter reader that extracts Instagram or social media hashtags from a file, using a buffered reader and a read hashtag method, and print them sequentially.
Explore how print writer writes data to files or streams in Java, using constructors for file name or file object, auto flush, and its print and format methods for types.
Explore efficient reading and writing of characters in Java IO. Learn about file readers and writers, character sets and encodings, and buffering for performance.
Explore data streams in Java, focusing on data input and data output interfaces, data input and data output streams, and the byte-oriented vs character stream differences, including random access file.
Demonstrate writing and reading shopping items using DataOutputStream and DataInputStream, preserving serial numbers, item names, and costs, then calculate and print the total.
Explore the random access file API to read and write data at arbitrary file positions using a cursor, with modes like r and rw that control synchronization and metadata updates.
Demonstrate using random access file to read and write integer codes at arbitrary positions by moving the file pointer with seek or skip, then replace and verify values.
Recap the use cases for data streams in Java IO, NIO, and NIO2, compare them with other streams, include hands-on coding examples, and cover random access to file content.
Explore serialization and deserialization using Java object input and object output streams. Learn the serializable interface and serialize a demo object to persist object state in a binary stream.
Explore how to serialize objects with Java object streams, persisting state for later use or network transfer, including Serializable, serialVersionUID, ObjectOutputStream, and ObjectInputStream.
Demonstrate serializable interface by serializing an object to a binary file using file and object output streams, then deserialize it with an object input stream to recover its state.
Explore how object streams serialize and deserialize objects in Java, the role of serialVersionUID, and how transient fields affect serialization, including handling non serializable fields.
Explore object stream classes to read and write objects from files or sources, learn object persistence and network transmission, and implement serialization with the serializable interface, serialVersionUID, and transient keyword.
Explore why and how to override Java serialization to customize object behavior, introduce the Externalizable interface, and use object streams to read and write objects.
Explore why overriding serialization is needed, including limitations of default serialization, handling transient fields, and security concerns, and learn three approaches—custom write/read object, externalization, and proxy objects.
Learn how to customize Java object serialization with readObject and writeObject, including private methods, default vs custom logic, and handling encrypted fields and transient data.
Learn externalization by implementing the externalizable interface to control readExternal and writeExternal with complete persistence responsibility and constructor behavior, and compare with serializable to decide when to serialize selective fields.
Applies the proxy object pattern to serialize with a proxy, using writeReplace and readResolve to swap between proxy and real objects, enhancing security and enabling legacy class handling.
Learn when to override writeObject and readObject for custom serialization, implement externalizable with writeExternal and readExternal, and use writeReplace/readResolve for proxy objects and legacy classes in object streams.
Explore converting between unicode character streams and byte streams using input stream reader and output stream writer to read characters from bitstreams and write bytes from character streams.
Explore a use case that pairs byte and character streams to read text, html, and images from a page using a url connection and binary buffers.
Explains writing hybrid streams of characters and bytes by recording meta information with offset and limit, then writing text and image parts to a binary stream and later read back.
Read hybrid data, combining bytes and characters, by locating a part’s offset and length, bridging input streams to a reader, and processing text and image sections.
Explore Java IO concepts that convert between Unicode character streams and byte streams of non Unicode text, using bitstream reader and character-to-byte translators.
Explore additional input/output methods beyond input streams and readers/writers, and examine standard streams with the console. The module introduces new communication approaches and previews upcoming sections.
Explore Java's standard streams—System.in, System.out, and System.err—and learn to redirect input and output to files with System.setIn, System.setOut, and System.setErr, and use print streams and readers for reading and writing.
Learn to use the system console as an advanced alternative to standard streams for secure password entry, with read password, read line, and reader-writer interactions, and handle unavailable consoles.
Discover how the scanner reads primitive types and strings from standard input or files using next, nextLong, nextDouble, and nextLine, while noting BufferedReader is faster and not synchronized.
Master standard streams for console I/O, enable secure password entry with the console, and read diverse data using the scanning class.
If you have ever worked on a real life production application you might have noticed that 70 to 80% of the time, applications are busy doing IO or Input Output.
IO in the sense : Reading, writing from and to Databases, Files, Disks, calling some APIs etcetera.
Why so ? Because Data needs to be persisted somewhere to be used in Future. While an application runs it loads the data in RAM but you know that It's not permanent.
So, To make the application perform better, You need to understand three things?
1. Computing should be done efficiently to save the CPU
2. Space or RAM should be used effectively and efficiently because that is limited and expensive
And Third and most important thing is
3. IO should be done in an efficient way.
Why am I calling 3rd one most important ? Because if you believe my several years of experience in building large scale production ready applications, Most of the applications spend 70% time doing IO.
So In this course what we gonna learn ? We are going to learn Effective Java IO, NIO and NIO2
And what is java way of handling IO?
Let me quickly brief the agenda of the course to you...
In first few sections of the course... we will learn ...
I/O Basics and classic IO
IO was introduced in 1996 (Java 1).
Which is the classic version.
IO was pretty popular then, and then modern systems started getting more performant.
And then The next IO upgrade came with java version 4 (2002), which is called NIO.
To add support for non-blocking IO for modern operating systems.
And then in 2011, we got new functionalities in Java NIO.
Don't worry if you are not familiar with NIO or with the non-blocking stuff,
Or even not familiar to IO. we will discuss everything in this course. We will start with the classic io,
Here We will talk about file handling, the basic patterns to read and write raw bytes,
which is done using InputStream-Output Stream, we will talk about how we read characters while using classic IO, we have Reader and writers for that.
And we will talk about few more important things from Classic IO,
We will learn to read and write structured data, in quite similar fashion to how we do reads and writes in database, for this we will discuss Data streams.
We are going to cover Random access File for that.
Then how to read write a mix of different kinds of data, for example a mix of bytes and characters.
After that we will discuss a very important concept, called serialization-Deserialization, to store state of a java object.
And right after that, we gonna discuss some utility kind of stuff that supports Java IO.
Whenever I say classic IO, I mean the stuff under io package but when I say Java IO, It includes everything that supports Input-output, whether it is ClassicIO, NIO or NIO2.
So, here will see some utility stuff.
Like how we can improve performance of our code, even if we are not using NIO, for that we will discuss compression techniques. Compression techniques are not io package specific, they are added under the util package in java 7. we can use compression wherever it's needed.
So, we will use compressions to enhance the performance while working with IO.
We will also discuss few classes which support io and are used in day to day programming.
So, that's what we gonna cover under classic IO.
Next comes NIO.
We are not going to start with understanding what NIO is, rather we will first discuss The path utility provided by NIO. It's a utility interface and is used almost everywhere, It's kind of replacement to file utility in today's java.
The reason to discuss it earlier is that, before actually starting NIO, we will be familiar with the very basic pattern of Java IO to access the files and to smoothly work with them.
Then we will jump to NIO,
Here we will understand what Non-blocking IO is and
Then we will be all set to understand the APIs under nio.
Will see how they work.
And then the enhancements and the new stuff that came with nio2.
And all this will come with hands-on Coding. I strongly recommend to program along with me if you want to understand the things better. We are going to write a lot of programs!!
Still in doubt ? Don't worry the course comes with a 30 days money back guarantee! So if you are not happy you may return the course.
If you want to become a Great Java programmer.. this is a must learn stuff for you and I strongly believe after completing the course you will be able to write efficient programs in terms of IO.
Welcome you again to the Journey see you in the course...