Home  I/O  Buffering  Character streams

Tutorial: introduction to I/O in Java

Java provides quite flexible libraries for dealing with input/output operations such as reading and writing to files or network sockets. A number of key classes and packages are provided as part of the JDK for dealing with I/O in Java:

The java.io package
This is the standard Java I/O package. It focusses primarily on stream-based I/O. It also provides methods for querying the file system.
The java.net package
Provides some extra support classes specifically for networked I/O.
The java.nio package
This is the "new I/O" package introduced in Java 1.4; it adds facilities for efficient buffer-based I/O and selector-based I/O which is particularly useful for handling multiple simultaneous connections on a server.

Written by Neil Coffey. Copyright © Javamex UK 2008. All rights reserved.