This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Java 5 new features with I/O?  RSS feed

 
Dean Jones
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I haven't used Java since 2002 and as of lately, I have been getting back into it because I have a chance to actually use it at work.

I was asking a Java guy at work what has changed with 5.0 besides generics and enum's? He told me the I/O stuff has changed. That you have to use listener classes for reading/writing data over sockets or files now.

This didn't make sense to me at all and I kept asking him what he meant because I looked at the java.io package and I didn't see anything really "new" in it when it came to reading/writing. He was trying to explain it to me, but I guess I'm just not getting it.

Does anyone know what he meant? What else is new in Java 5 besides generics and enum's?
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch.
Your "Java" guy is confused. The standard java.io classes are still there. The "New" IO classes, which add some useful features have been in the J2SE since 2002 and don't replace as much as enhance the standard classes.
Maybe he's thinking about java.util.Scanner.?
For the full list of Java 5.0 enhancements, see here
 
Dean Jones
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Joe!

He said it had something to do with Threads and I/O. Does that make anymore sense at all?
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only thing I can think of that deals with threads is the non-blocking IO introduced in the "new" IO classes (see here). Again, this has been part of the J2SE for years and doesn't preclude using the standard IO classes.
 
Dean Jones
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah... I'm willing to bet that's what he was talking about. Is Selecting new in Java, or just part of the NIO? Cause it's been around in C for quite some time now..
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It was "new" to Java in 1.4, as part of NIO. It was eagerly anticipated in a few key niches precisely because it was well-known in C, and java.io classes don't support high-volume concurrency that well. But for most applications, the NIO stuff isn't necessary, and it's a bit more complex to deal with. Nowadays the IO classes generally use NIO under the hood anyway, so often you get the same result either way. But a Selector is one key feature that you just can't do with the older API.
[ December 13, 2006: Message edited by: Jim Yingst ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!