The J2SE (Java 2 Platform, Standard Edition) 1.4 beta -- the Merlin release -- unleashes hundreds of new classes. This article walks you through some of the platform's new I/O (input/output) capabilities: nonblocking I/O, character conversion, memory-mapped files, and buffer management. Using Merlin's new I/O classes, we will build a Web server that handles thousands of connections with just three threads. (4,700 words)
Java 2 Platform, Standard Edition (J2SE) 1.4 introduced the New Input/Output (NIO) libraries designed to allow extremely high-speed I/O within Java applications. NIO uses an I/O model that differs significantly from the one used in the original I/O libraries. This article guides you step by step through the select facility provided by NIO. select enables your server to process a great deal of data from a large number of connections. After a brief introduction to the NIO libraries, this article then covers the theory behind the select facility and examines source code for a working server that uses select. (2,000 words; April 11, 2003)