• Post Reply Bookmark Topic Watch Topic
  • New Topic

NIO

 
Narayanan Jayaraman
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is Sun going to make better APIs like this by scrapping old Apis ?
 
Ron Hitchens
Author
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, at least not any time soon. The name "New I/O" is rather unfortunate. NIO is not a replacement for the old I/O classes. Rather, it's an alternate way of performing I/O.
The older classes in java.io are very powerful and flexible. The compositional patterns they enable work for a broad range of applications.
Unfortunately, the stream metaphor used throughout java.io does not meet every need. The notion of non-blocking is not there at all. And several non-stream-like I/O operations such as memory mapping and file-locking were never considered.
NIO is a response to the need for performance (by allowing data to be transferred in larger blocks under better control of the programmer) and to provide access to additional I/O services which industrial strength applications need to use.
Don't stop using the "old" I/O APIs if they meet your needs, they're not being deprecated in the foreseeable future. But if some feature of NIO can be put to use, use it. NIO is here to stay.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!