Most Helpful Customer Reviews
|
|
20 of 21 people found the following review helpful:
5.0 out of 5 stars
A very good summary and explanation of the New I/O in Java, April 3, 2003
At only six chapters and 282 pages (including the index) one might think "Java NIO" (short for "New I/O") is little more than a cursory examination of the NIO packages introduced in J2SE 1.4 as a response to the Java Specification Request (JSR) #51. Yet, despite its relatively compact size, Mr. Hichens has done a very good job of introducing and explaining the many aspects of this New I/O. The book even includes parts of JSR 51 that are only tangentially related to I/O, such as the new regular expression processing found in java.util.regex and the new pluggable character set mappings.
Chapter 1 is a primer on general I/O concepts and mechanisms and provides a useful foundation for the following information. Beginning with the basics as a foundation is a strategy that Mr. Hichens uses in each of the subjects in the following chapters. It's an important first step, often omitted in books more interested in prose than instruction.
Chapter 2 is a thorough explanation of the various Buffer classes. As the means for data accumulation and manipulation, Buffers are a natural first step in explaining the NIO package. It begins with a fairly detailed basic description followed with sections labeled: Creating, Accessing, Filling, Flipping, Draining, Compacting, Marking, Comparing, Bulk Moves, Duplicating, etc. Each section provides simple yet useful examples of the various operations along with some helpful hints and warnings of potential pitfalls.
Chapter 3 adds about all you'd want to know about the channels used to convey the data into and out of buffer. As the book explains, Channels "are not an extension or enhancement, but a new, first-class Java I/O paradigm. ... A Channel is a conduit that transports data efficiently between byte buffers and the entity on the other end of the channel (usually a file or socket)." In the ensuing sections: Scatter/Gather, File Channels, Memory-Mapped Files, Socket Channels, Pipes and The Channel Utility Classes, the use of channels within the NIO paradigm are extensively explained.
Chapter 4 covers Selectors. Selectors add another completely new ability to Java 1.4. With selectors Java now has a much more sophisticated and integrated ability to do asynchronous and multiplexed I/O. This is obviously very important to anyone dealing with real-time and/or high-demand I/O and it is one of the main reasons for JSR 51.
The book does a very good job of explaining the concept and use of Selectors in chapter sections entitled: The Selection Process, Stopping the Selection Process, Managing Selection Keys, Concurrency, Asynchronous Closability and Selection Scaling.
Chapter 5 introduces Regular Expressions and explains the use of the new java.util.regex package. Regular expression processing was part of the JSR 51 and thus part of this book. While not strictly I/O related, as anyone familiar with Perl can attest, regular expression processing is very useful when it comes to manipulating any textual data used in I/O.
While it covers the Java Regular Expression API very well, it is not comprehensive enough to include the many intricacies of regular expressions. Of course O'Reilly has that covered in Jeffrey Friedl's book, "Mastering Regular Expressions."
The last chapter, Chapter 6, "Character Sets", is a pretty close examination of the actual data moved in I/O and demonstrates how Java 1.4 represents it in the class Charset.
If you've ever wondered about character sets and how they are involved in character encoding or how one character set might be compared with or encoded into another, this chapter will go a long way toward filling you in.
The book concludes with three appendices:
* NIO and the JNI - A more detailed explanation of a new Java ability to use system memory allocated with native (JNI) code. This is one way they managed to improve the performance of Java real-time 3D applications so dramatically.
* Selectable Channels Service Provider Interface (SPI) - Basically explains why this API is beyond the scope of the book and why it wouldn't be useful to anyone not programming a JVM or high-performance App server.
* NIO Quick Reference - Just as the name implies.
In summation, the concepts range from basic to advanced yet are presented in such a way that, even while being explained, the information is understandable and can be used for future reference purposes. The examples are simple yet useful in demonstrating the concepts and the implementation of them. The style is informative and complete yet very accessible and informal. Overall, a well written book useful to anyone needing to know the workings of the NIO packages of Java 1.4.
|
|
|
28 of 31 people found the following review helpful:
2.0 out of 5 stars
OK for beginners, January 18, 2003
I bought this book because of the lack of material on java.nio. The book is a good introduction to java.nio but that is the extent of it. Half the book is an api reference and regular expressions (why is this even covered in this book?). The rest tells you a little bit about the API, but not how to use it. There are examples, but you have to download them from the internet (ie no CD with the book).The best chapter you can download for free anyway, so don't bother buying the book. Just download the free chapter and the free examples. The material on the internet from this book covers 90% of what you need to know.
|
|
|
13 of 13 people found the following review helpful:
4.0 out of 5 stars
Pretty good overview but consider using a framework., October 29, 2004
This is a pretty good overview, particularly for those who have no previous experience with non-blocking IO. The author explains the concept of buffers very well, with useful diagrams illustrating the differences between position, limit, etc.
The material on selectors and readiness selection is also strong.
The problem is, there are idiosyncracies to NIO that make it difficult to use effectively for large-scale, high-performance applications without some in-depth knowledge.
If you're really looking to architect a substantial NIO server or client, read this book for the overview, but also be sure to take a look at the open source Netty framework by Trustin Lee, or Ember IO by Mike Spille to see good NIO implementations that you can use as a building block.
|
|
|
Most Recent Customer Reviews
|