Reading and writing files are fundamental tasks in software development. The Java Development Kit (JDK) offers a comprehensive set of APIs that simplify working with files, directories, and various Input/Output operations, making it easier for programmers to handle these tasks efficiently. The tutorials below will guide you through Java’s File Input/Output operations step-by-step, helping you master these essential skills with ease:

 

1. Read Input from the User:

Learn to read user-entered input from keyboard in command line (console) with InputStreamReader, Console and Scanner classes:

 

2. Read and Write Files in Java:

The following articles show you how to read and write binary files with InputStream and OutputStream; and how to read and write text files with FileReader and FileWriter classes:

 

3. File and Directory Listing:

Find the Java code examples to list files and directories (including nested files and directories) in the following posts. You will also learn how to get hard disk's used and free space, and calculate the number of files and directories in any directory.

 

4. File and Directory Operations:

Learn how to perform common operations on files and directories, such as copy, move, rename, and delete - using both legacy File IO APIs and New IO APIs.

 

5. Java InputStream and OutputStream Examples:

The following articles help you get in-depth understanding about different implementations of InputStream and OutputStream so you'll understand exactly when a FileReader, DataInputStream or ObjectInputStream can be used.

 

6. Java Serialization:

Read the following articles to understand the concepts and usage of serialization in Java IO. I'll also explain externalization which is an advanced form of serialization. 

 

7. How to handle ZIP File with Java:

Using the Java IO APIs, programmers can easily write programs that work with compressed files in ZIP format. You can find in the following articles various code examples for reading (extracting) and writing (compressing) ZIP files:

 

8. Miscellaneous Java File IO Tutorials:

Learn how to format string in the standard output (console), read/write configuration file, execute operating system's commands and watch file change events:

 


About the Author:

is certified Java programmer (SCJP and SCWCD). He began programming with Java back in the days of Java 1.4 and has been passionate about it ever since. You can connect with him on Facebook and watch his Java videos on YouTube.