NOTE

Java I/O Stream Basics

Byte streams, character streams, buffering, decorators, and explicit charset boundaries in Java I/O.

JavaCreated Updated 1 min readhistorical

This is a historical learning note and may contain outdated or incomplete understanding.

Java classic I/O separates byte streams (InputStream/OutputStream) from character-oriented readers/writers (Reader/Writer).

Use byte streams for binary protocols/files. Convert bytes to text with an explicit charset, for example through InputStreamReader; avoid relying on an environment default when data crosses systems.

Buffered wrappers reduce small underlying I/O calls. Many stream classes use the decorator pattern, so functionality such as buffering, compression, checksums, or data encoding can be layered.

Close resources deterministically with try-with-resources.

Loading helpful count