java.io

Java's original input and output package: byte streams, character readers and writers, and object serialization.

In more detail

InputStream and OutputStream move bytes, Reader and Writer move characters, and wrappers such as BufferedReader add buffering and readLine. InputStreamReader and OutputStreamWriter bridge bytes to characters. Most methods throw IOException.

Example

try (var in = new BufferedReader(new FileReader("a.txt"))) {
    System.out.println(in.readLine());
}

Related terms

Taught in

References

Certification courses