Java Nio by Ron Hitchens

By Ron Hitchens

Many severe Java programmers, particularly firm Java programmers, reflect on the recent I/O API--called NIO for brand new Input/Output--the most vital characteristic within the 1.4 model of the Java 2 regular version. The NIO package deal contains many stuff which were lacking from past variations of Java which are serious to writing high-performance, large-scale purposes: advancements within the components of buffer administration, scalable community and dossier I/O, character-set aid, and commonplace expression matching. so much of all, it boosts functionality and velocity dramatically.Java NIO explores the hot I/O services of model 1.4 intimately and indicates you ways to place those positive aspects to paintings to tremendously enhance the potency of the Java code you write. This compact quantity examines the common demanding situations that Java programmers face with I/O and indicates you ways to exploit the functions of the hot I/O beneficial properties. You?ll tips on how to positioned those instruments to paintings utilizing examples of universal, real-world I/O difficulties and notice how the hot positive factors have a right away effect on responsiveness, scalability, and reliability. The e-book includes:

  • A rundown of the hot beneficial properties in NIO
  • Basic and complex I/O Concepts
  • Binary I/O and the recent buffer classes
  • Memory mapped documents and dossier locking
  • Character I/O: encoding, deciphering and remodeling personality data
  • Regular Expressions and the hot java.util.regex package
  • Muliplexing with java.nio

Because the NIO APIs complement the I/O beneficial properties of model 1.3, instead of substitute them, you will additionally study whilst to take advantage of new APIs and whilst the older 1.3 I/O APIs are greater suited for your specific application.Java NIO is for any Java programmer who's drawn to studying the way to develop I/O functionality, but when you are constructing purposes the place functionality is important, resembling video game computing or large-scale company purposes, you want to provide this booklet an everlasting spot in your bookshelf. With the NIO APIs, Java now not takes a backseat to any language in terms of functionality. Java NIO may help you understand the advantages of those fascinating new features.

Show description

Read or Download Java Nio PDF

Best object-oriented design books

Building Java Enterprise Systems with J2EE

The sensible attitude of creating Java firm platforms with J2EE presents the conceptual heritage and wealth of code examples had to really gather structures in an invaluable demeanour with the J2EE applied sciences. additionally, this booklet demonstrates how the applied sciences supplement and construct on most sensible of each other through evolution of a cohesive and actual pattern program.

Beginning Perl (Expert's Voice in Open Source)

It is a publication for these people who believed that we didn’t have to study Perl, and now we all know it's extra ubiquitous than ever. Perl is very versatile and strong, and it isn’t terrified of net 2. zero or the cloud. initially touted because the duct tape of the net, Perl has due to the fact that advanced right into a multipurpose, multiplatform language current totally all over: heavy-duty net functions, the cloud, platforms management, typical language processing, and fiscal engineering.

Developing Modular-Oriented Simulation Models Using System Dynamics Libraries (SpringerBriefs in Electrical and Computer Engineering)

This SpringerBrief introduces the advance and functional software of a module-oriented improvement framework for area particular system-dynamic libraries (SDL approach), which might be utilized in the simulation of multi-causal and dynamic relationships on diverse degrees of an undefined, as an instance the development undefined.

Extra info for Java Nio

Example text

However, depending on the implementation, things may not be this bad. The runtime will likely cache and reuse direct buffers or perform other clever tricks to boost throughput. If you're simply creating a buffer for one-time use, the difference is not significant. On the other hand, if you will be using the buffer repeatedly in a highperformance scenario, you're better off allocating direct buffers and reusing them. Direct buffers are optimal for I/O, but they may be more expensive to create than nondirect byte buffers.

Position(4); 30 Java NIO Figure 2-8. A buffer with a mark set If this buffer were passed to a channel now, two bytes would be sent ("ow"), and the position would advance to 6. If we then call reset( ), the position would be set to the mark as shown in Figure 2-9. Passing the buffer to the channel again would result in four bytes ("llow") being sent. Figure 2-9. A buffer position reset to its mark The output may not say anything sensible (owllow would be written down the channel), but you get the idea.

Figure 2-14. Big-endian byte order Figure 2-15. Little-endian byte order The way multibyte numeric values are stored in memory is commonly referred to as endian-ness. If the numerically most-significant byte of the number, the big end, is at the lower address, then the system is big-endian (Figure 2-14). If the least-significant byte comes first, it's little-endian (Figure 2-15). Endian-ness is rarely a choice for software designers; it's usually dictated by the hardware design. Both types of endian-ness, sometimes known as byte sex, are in wide-spread use today.

Download PDF sample

Rated 4.29 of 5 – based on 36 votes