Java I/O (Input/Output)
• What is Java I/O?
• - Read data into a program and write data
from a program
• - Works using streams (like pipes that carry
data in/out)
• - All classes are in [Link] package
• Purpose: Efficient input/output operations in
Java
Text I/O
• - Works with letters, numbers, and text
(human-readable)
• - Uses Reader and Writer classes (FileReader,
BufferedReader, FileWriter, PrintWriter)
• - Examples: [Link], [Link]
• - Remember: Text = readable by humans
Binary I/O
• - Works with non-text files like images, audio,
videos, or objects
• - Uses InputStream and OutputStream classes
(FileInputStream, BufferedInputStream,
FileOutputStream, ObjectOutputStream)
• - Examples: [Link], song.mp3
• - Remember: Binary = raw bytes
Key Points to Remember
• - Streams are used for all I/O operations
• - Text I/O → readable text files
• - Binary I/O → raw files like photos, music,
objects
• - Simple way to remember: Text = readable,
Binary = bytes