Skip to main content

Java NIO.2 File System (JSR 203) Update

Posted by editor on June 15, 2009 at 7:36 AM PDT

This week's java.net Spotlight highlights the Sun Developer Network article "The Java NIO.2 File System in JDK 7", ("NIO" = "New I/O") by Janice J. Heiss and Sharon Zakhour. The Java NIO.2 file system is an OpenJDK implementation of JSR 203. While the JCP currently lists JSR 203 as "inactive", work on the JSR is actually ongoing, under the leadership of Sun's Alan Bateman.

Janice and Sharon define the JSR's "three primary elements that offer new input/output (I/O) APIs for the Java platform:"

  • An extensive File I/O API system addresses feature requests that developers have sought since the inception of the JDK.
  • A socket channel API addresses multicasting, socket binding associated with channels, and related issues.
  • An asynchronous I/O API enables mapping to I/O facilities, completion ports, and various I/O event port mechanisms to enhance scalability.

Their article focuses on the first of these.

One might wonder: why, at this late point in the Java's history, are enhancements to something as fundamental as I/O needed? Janice and Sharon explain:

The Java I/O File API, as it was originally created, presented challenges for developers. It was not initially written to be extended. Many of the methods were created without exceptions, so they failed to throw I/O exceptions, which resulted in considerable frustration for developers. Applications often failed during file deletion, leaving developers confused as to why no useful error message had been generated. The rename method behaved inconsistently across volumes and file systems: Some were easily renamed, but others were not. Methods for gaining simultaneous metadata about files were inefficient. And developers wanted greater access to metadata such as file permissions, as well as more efficient file copy support and file change notification.

Developers also requested the ability to develop their own file system implementations by, for example, keeping a pseudofile system in memory, or by formatting files as zip files.

From this, it's easy to understand the reaction NIO.2 evokes from many developers: statements such as "we've needed this for a long time" and "finally!" In part, it's understandable that extensions to an I/O API will be required, as new types of file systems come into existence. It's a bit more surprising that the original I/O File API was designed without adequate exceptions handling. So, the frustation of developers, and their anticipation of NIO.2, is very much understandable.

"The Java NIO.2 File System in JDK 7" provides overviews of several areas where the NIO.2 APIs will improve the JDK's I/O capabilities:

As Alan Bateman says, in the conclusion of the article:

The file system API will be a significant boon to applications that today are forced to resort to native code to do many basic file system operations. Finally, the platform has support for copying and moving files, symbolic links, and file permissions, and for many other basic features whose previous absence inhibited effective access to the file system.

Some additional JSR 203 resources:


In Java Today, we note that development of the Genesis project continues to proceed at a rapid pace. The project had more commits than any other java.net project in May: "genesis is an open-source framework that aims to bring simplicity and productivity to enterprise application development, ensuring scalability, robustness and testability of your software. The main goal is to simplify the development of business components and the construction of complex graphical interfaces with minimum effort for developers. To accomplish its mission, genesis combines several open-source frameworks in a completely transparent way for developers, through the use of AOP (Aspect Oriented Programming)." The project recently released Genesis Version 3.2.

Manik Surtani announces that Infinispan Alpha 5 is now available: "Infinispan is an extremely scalable, highly available data grid platform - 100% open source, and written in Java. The purpose of Infinispan is to expose a data structure that is highly concurrent, designed ground-up to make the most of modern multi-processor/multi-core architectures while at the same time providing distributed cache capabilities. At its core Infinispan exposes a JSR-107 (JCACHE) compatible Cache interface (which in turn extends java.util.Map). It is also optionally is backed by a peer-to-peer network architecture to distribute state efficiently around a data grid..."

Peligri reports JSR 299 Proposed Final Draft Submitted: "The Proposed Final Draft specification for JSR 299 has been submitted to the JCP. See Gavin's Announcement and Overview and/or download the document. Still unfolding is the relationship between 299, JavaEE 6 and JSR 330; see the comments at Gavin's post for some ideas, and you can also compare the results and comments between the votes for 299 and for 330..."


In today's Weblogs, John O'Conner writes about JavaFX Designer Tool...where is it?: "At JavaOne 2009, Sun demonstrated a new JavaFX designer tool. You can even view the demo online. To shortcut right to the section that shows the tool, move to about 23:00 minutes into the video. There are obvious questions that..."

Osvaldo Pinali Doederlein writes about First look at JavaFX 1.2, Part II: "I tested JavaFX Balls again with the new JavaFX 1.2 runtime, now with with HotSpot Server, more interesting findings."

And Igor Medeiros writes about X-Card, where Java Card developers meet: "I have not posted here lately, the excuse is the same as always, but this time for a good cause, I have worked intensively in the book and the development of Eclipse plugin X-Card Tools. I created a social network..."


In the Forums, bbsunchen asks about phoneME advanced debug for ubuntu error: "Today I got a compiled phoneme advanced for ubuntu which support jvmdi, when I run it, there is a wrong said"cvm: symbol lookup error: cvm: undefined symbol: fstat64", but when I used the version downloaded from the official site which does not support debug, it runs ok. Could somebody tell me what's wrong? ..."

aitdx has a Glassfish Problem with inheritance: "Hi, I use Glassfish and metro for cretating a web service. My problem is that two classes (LegalEntity and NaturalPerson) extends a abstrac class Person. When metro generates the wsdl, the Person's class is referenced but the others (Natural and Legal) not. When I execute a find method, I get the following error: [java] Exception in thread "main" com.sun.xml.ws.encoding.soap.DeserializationException: Failed to read a response: javax.xml.bind.UnmarshalException ..."

And martinm1000 wonders Can Glassfish help me with this use case ?: "Hi, We have a couple of java swing application, and we are beginning to think that we might need some java code running on a centralized server. Kind of a windows service where some java code would be running in the background. This is not a web application; but we would use web services to let the clients (webstart swing app) communicate with the server. Would Glassfish or another module of another application server do the job ? There are so much sub projects on these technologies that I'm not sure where to start !!"


The current Spotlight is the Sun Developer Network article The Java NIO.2 File System in JDK 7 : "Janice J. Heiss and Sharon Zakhour provide an update on The Java NIO.2 File System in JDK 7 : "JSR 203, a major feature of JDK 7 under the leadership of Sun software engineer Alan Bateman as an OpenJDK project, contains three primary elements that offer new input/output (I/O) APIs for the Java platform: An extensive File I/O API system addresses feature requests that developers have sought since the inception of the JDK..."


This week's java.net Poll asks Will there be a JavaOne Conference in 2010?. The poll will be open through next Thursday.


Our Feature Articles include today's new article by Thomas Kuenneth, Hacking JavaFX Binding. In this article, Thomas describes how to apply binding within JavaFX in a manner similar to what can be accomplished using Beans Binding (JSR-295). We're also featuring Gary Benson's Zero and Shark: a Zero-Assembly Port of OpenJDK, which tells the interesting story of how the Java group at Red Hat developed a cross-platform OpenJDK port.


The latest Java Mobility Podcast is Java Mobility Podcast 80: Java at FIRST 2010 Competition, in which Eric Areseneau talks about Java now being available for the FIRST 2010 Competition.

The latest OpenJDK Podcast is

The latest JavaOne Community Corner Podcast is


-->


Current and upcoming Java
Events
:

Registered users can submit event listings for the href="http://www.java.net/events">java.net Events Page using our href="http://today.java.net/cs/user/create/e">events submission form.
All submissions go through an editorial review before being posted to the
site.


Archives and Subscriptions: This blog is delivered weekdays as
the Java
Today RSS feed
. Also, once this page is no longer featured as the
front page of java.net it will be
archived along with other past issues in the href="http://today.java.net/today/archive/">java.net Archive.

This week's java.net Spotlight highlights the Sun Developer Network article "The Java NIO.2 File System in JDK 7"...