Java I/O
19 lessons in this section of the Java tutorial. Work through them in order, or jump to the one you need.
- 1.I/O Basics
Java I/O is built on a small set of abstract concepts that underlie every I/O operation in the language: streams, readers, writers, channels, and buffers.
- 2.Byte Streams
Byte streams are the fundamental I/O abstraction in Java for reading and writing raw binary data.
- 3.Character Streams
Character streams, represented by the Reader and Writer abstract base classes, handle text data by abstracting away the encoding and decoding between Java's internal…
- 4.File Handling
File handling in Java spans two generations of API: the legacy java.io.File class introduced in Java 1.0, and the modern java.nio.file package (NIO.2) introduced in Java…
- 5.File Class
The java.io.File class is Java's original file system abstraction, present since Java 1.0.
- 6.FileInputStream
FileInputStream is a concrete InputStream subclass that reads raw bytes from a file on the file system.
- 7.FileOutputStream
FileOutputStream is a concrete OutputStream subclass that writes raw bytes to a file on the file system.
- 8.Buffered Streams
Buffered streams wrap an underlying unbuffered stream with an in-memory buffer, dramatically reducing the number of native I/O system calls by batching reads and writes.
- 9.FileReader
FileReader is a convenience class for reading character files, extending InputStreamReader with a FileInputStream underneath.
- 10.FileWriter
FileWriter is a convenience class for writing characters to a file, extending OutputStreamWriter with a FileOutputStream underneath.
- 11.BufferedReader
BufferedReader wraps any Reader with an in-memory character buffer, dramatically reducing system calls for character-by-character or line-by-line reading.
- 12.BufferedWriter
BufferedWriter wraps any Writer with an in-memory character buffer, reducing system calls by accumulating characters until the buffer fills, flush() is called, or…
- 13.PrintWriter
PrintWriter is a character-based output class that wraps any Writer or OutputStream and adds convenience methods for printing formatted representations of all Java…
- 14.DataInputStream
DataInputStream wraps any InputStream and adds methods for reading Java primitive types in a machine-independent binary format.
- 15.DataOutputStream
DataOutputStream wraps any OutputStream and adds methods for writing Java primitive types in a machine-independent binary format using big-endian byte order.
- 16.Serialization
Java serialization is the mechanism for converting an object graph into a sequence of bytes that can be stored to a file, transmitted over a network, or persisted in a…
- 17.Deserialization
Deserialization is the process of reconstructing a Java object from a byte stream previously produced by serialization.
- 18.transient
The transient keyword marks an instance field as excluded from Java's default serialization mechanism.
- 19.Externalization
Externalization is Java's mechanism for giving a class complete, explicit control over its serialized form.