Java NIO
معرفی کتاب «Java NIO» نوشتهٔ Ron Hitchens، منتشرشده توسط نشر O'Reilly Media در سال 2002. این کتاب در 282 صفحه، فرمت pdf، زبان انگلیسی ارائه شده است. «Java NIO» در دستهٔ بدون دستهبندی قرار دارد.
Actually the small subtitle on the top of the front page "Regular Expressions and High-Performance I/O" would be the better title. "Java NIO" is incorrect. That suggest already that the mere 282 pages are not completely devoted to explaining usage of NIO package. The obvious conclusion is that this book is to terse to grant it the status of the sole source of information on NIO. But wait, there is more: The author feels the necessity to quote the Java package specifications, which we all have anyways on the net. This nonsensical waste of paper starts on the page 238, preceded by several pages of a similarly useless appendix B which quotes java.nio.channels.spi specifications. Thus the book has de facto approx. 230 pages. But wait, there is more! Already on the page 151 author abandons NIO and devotes himself to a talk about regular expression package, and... in his code examples uses boldly standard java.io. His examples are of a stunning banality and simplicity, to terse to be of any use beyond the regular Java instructional trail on the net. Regarding NIO, the 150 pages remaining, reader should rather take a look at "The JDK 1.4 Tutorial", 408 pages: The JDK 1.4 Tutorial. Travis'es chapter 1 and 2 clearly top this text in every aspect. Hitchens code examples seem very arbitrary, and often to verbose, dealing with, or constructing something not pertinent to IO itself. For example, pages 63/65, where author suggest to "wait" in a spinning while loop for write, without any sleep (hm..., is that really necessary?) and later on wastes an entire page on assembling some arbitrary text messages or sentences of a kind. Every reader will make many more such observations. Not a good call on O'Reilly's part... NIO is very complex indeed, and every practitioner has his/her own set of papers and snippets collected over the time, still waiting for "the ultimate" summary by someone. Last but not least, what annoys me in this book are the nonsensical and banal quotes of someone or something in the beginning of the chapters. This is a very nasty habit, copied over and over again by many authors. Only a few writers have the knowledge and ability to make such quotes, see Donald Knuth to contrast what you will find in this book. For example, "here, put this fish in you ear" by Ford Prefect. I have no clue what that means, and who or what Ford Prefect was. The said appendix with cut-and-paste of Java package specifications starts with a sentence by "U2", what ever that means. The equally useless appendix B starts with "If you build it, he will come" by... "An Iowa cornfield"! I have really no words to comment on this nonsense. Now let me pack the "NIO users manual" and ship it back to Amazon. Give me my money back! Many serious Java programmers, especially enterprise Java programmers, consider the new I/O API--called NIO for New Input/Output--the most important feature in the 1.4 version of the Java 2 Standard Edition. The NIO package includes many things that have been missing from previous editions of Java that are critical to writing high-performance, large-scale applications: improvements in the areas of buffer management, scalable network and file I/O, character-set support, and regular expression matching. Most of all, it boosts performance and speed dramatically.Java NIO explores the new I/O capabilities of version 1.4 in detail and shows you how to put these features to work to greatly improve the efficiency of the Java code you write. This compact volume examines the typical challenges that Java programmers face with I/O and shows you how to take advantage of the capabilities of the new I/O features. You?ll learn how to put these tools to work using examples of common, real-world I/O problems and see how the new features have a direct impact on responsiveness, scalability, and reliability. The book includes:A rundown of the new features in NIO Basic and advanced I/O Concepts Binary I/O and the new buffer classes Memory mapped files and file locking Character I/O: encoding, decoding and transforming character data Regular Expressions and the new java.util.regex package Muliplexing with java.nio Because the NIO APIs supplement the I/O features of version 1.3, rather than replace them, you'll also learn when to use new APIs and when the older 1.3 I/O APIs are better suited to your particular application.Java NIO is for any Java programmer who is interested in learning how to boost I/O performance, but if you're developing applications where performance is critical, such as game computing or large-scale enterprise applications, you'll want to give this book a permanent spot on your bookshelf. With the NIO APIs, Java no longer takes a backseat to any language when it comes to performance. Java NIO will help you realize the benefits of these exciting new features. The Java New I/O (NIO) packages in J2SE 1.4 introduce many new, indispensable features previously unavailable to Java programmers. These include APIs for high-performance I/O operations, regular expression processing, and character set coding. These new libraries are a treasure trove for Java developers. The NIO APIs are especially valuable where high-performance I/O is a requirement, but they can also be useful in a wide range of scenarios. The new APIs let you work directly with I/O buffers, multiplex nonblocking streams, do scattering reads and gathering writes, do channel-to-channel transfers, work with memory-mapped files, manage file locks, and much more. The new high-performance Regular Expression Library provides sophisticated, Perl-like regex-processing features such as pattern matching, search and replace, capture groups, look-ahead assertions, and many others. The Charset API gives you complete control over character set encoding and decoding, which are vital for properly managing the exchange of documents on the Web, for localization, or for other purposes. You can also create and install your own custom character sets.Staying current with the latest Java technology is never easy. NIO, new in Java 1.4, is quite possibly the most important new Java feature since Swing. Understanding it thoroughly is essential for any serious Java developer. NIO closes the gap between Java and natively compiled languages and enables Java applications to achieve maximum I/O performance by effectively leveraging operating-system services in a portable way. Java NIO is a comprehensive guide to the Java New I/O facilities. It lets you take full advantage of NIO features and shows you how they work, what they can do for you, and when you should use them. This book brings you up to speed on NIO and shows you how to bring your I/O-bound Java applications up to speed as well. Java NIO is an essential part of any Java professional's library. Cover......Page 1 Table of Contents......Page 3 Dedication......Page 5 Preface......Page 6 Organization......Page 7 Software and Versions......Page 9 Conventions Used in This Book......Page 10 How to Contact Us......Page 11 Acknowledgments......Page 12 1.1 I/O Versus CPU Time......Page 14 1.2 No Longer CPU Bound......Page 15 1.3 Getting to the Good Stuff......Page 16 1.4 I/O Concepts......Page 17 1.5 Summary......Page 25 2. Buffers......Page 26 2.1 Buffer Basics......Page 27 2.2 Creating Buffers......Page 40 2.3 Duplicating Buffers......Page 42 2.4 Byte Buffers......Page 44 2.5 Summary......Page 56 3. Channels......Page 58 3.1 Channel Basics......Page 59 3.2 Scatter/Gather......Page 66 3.3 File Channels......Page 71 3.4 Memory-Mapped Files......Page 84 3.5 Socket Channels......Page 95 3.6 Pipes......Page 113 3.7 The Channels Utility Class......Page 118 3.8 Summary......Page 119 4.1 Selector Basics......Page 121 4.2 Using Selection Keys......Page 129 4.3 Using Selectors......Page 132 4.4 Asynchronous Closability......Page 141 4.5 Selection Scaling......Page 142 4.6 Summary......Page 147 5.1 Regular Expression Basics......Page 149 5.2 The Java Regular Expression API......Page 151 5.3 Regular Expression Methods of the String Class......Page 172 5.4 Java Regular Expression Syntax......Page 173 5.5 An Object-Oriented File Grep......Page 176 5.6 Summary......Page 182 6.1 Character Set Basics......Page 184 6.2 Charsets......Page 186 6.3 The Charset Service Provider Interface......Page 205 6.4 Summary......Page 218 A. NIO and the JNI......Page 219 B. Selectable Channels SPI......Page 221 C.1 Package java.nio......Page 224 C.2 Package java.nio.channels......Page 231 C.3 Package java.nio.channels.spi......Page 244 C.4 Package java.nio.charset......Page 246 C.6 Package java.util.regex......Page 250 Colophon......Page 253 Many serious Java programmers, especially enterprise Java programmers, consider the new I/O API--called NIO for New Input/Output--the most important feature in the 1.4 version of the Java 2 Standard Edition. The NIO package includes many things that have been missing from previous editions of Java that are critical to writing high-performance, large-scale improvements in the areas of buffer management, scalable network and file I/O, character-set support, and regular expression matching. Most of all, it boosts performance and speed dramatically. Java NIO explores the new I/O capabilities of version 1.4 in detail and shows you how to put these features to work to greatly improve the efficiency of the Java code you write. This compact volume examines the typical challenges that Java programmers face with I/O and shows you how to take advantage of the capabilities of the new I/O features. You?ll learn how to put these tools to work using examples of common, real-world I/O problems and see how the new features have a direct impact on responsiveness, scalability, and reliability. The book Because the NIO APIs supplement the I/O features of version 1.3, rather than replace them, you'll also learn when to use new APIs and when the older 1.3 I/O APIs are better suited to your particular application. Java NIO is for any Java programmer who is interested in learning how to boost I/O performance, but if you're developing applications where performance is critical, such as game computing or large-scale enterprise applications, you'll want to give this book a permanent spot on your bookshelf. With the NIO APIs, Java no longer takes a backseat to any language when it comes to performance. Java NIO will help you realize the benefits of these exciting new features.
دانلود کتاب Java NIO