Search this site

 Home  I/O  Buffering  Character streams  NIO intro  Buffers  Channels  Buffer performance

Search this site:
Threads Database Profiling Regular expressions Random numbers Compression Exceptions C Equivalents in Java

 What do you think of this article? Did it help you? Found a mistake? Feedback and suggestions here

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 Java networking, with various of the stream classes from the java.io package integrating with the java.net package.
The java.nio package
NIO 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.

Other topics

Although not strictly related to the Java I/O packages, you may also be interested in the Arcmexer library, which allows reading from various archive files. At present, it supports ZIPs (encrypted and unencrypted) and TAR files (compressed and uncompressed).

comments powered by Disqus

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