NMK30703 Lab2: Streams
Java I/O streams handle sequential data flow between programs and sources/sinks (files, networks, etc.). Byte streams (InputStream/OutputStream) process raw bytes, while character streams (Reader/Writer) manage text. Buffering and chaining streams (e.g., BufferedInputStream, DataInputStream) optimize performance. JDK 7’s try-with-resources ensures automatic cleanup. Proper charset handling (e.g., UTF-8) is critical for internationalization. Labs demonstrate unbuffered/buffered copying, stream chaining, and charset encoding/decoding.
Exercise