简体   繁体   中英

java.nio.channels.*

What is up with nio channels ? There were some nice talks when it was added to java but I still don't see people using it in their applications.

Is there something wrong with it, or am I just not encountering people who use it?

Any nice examples as to why I should bother using it at all ?

Thanks

You're asking about channels, but channels only make sense within the general framework of using the (relatively) new nio capabilities as a whole.

My guess is that of the many, many Java applications out in the world, not many need the capabilities of nio . The usual "business" process read streams and/or files... nothing special.

That said, the Apache folks have recently rewritten their core Java libraries ( http://hc.apache.org/ ) to use nio , and claim some impressive performance benefits in some cases.

nio also lets you do stuff like memory-mapping files, and this can allow an application to do very fast random access to the file. Again, only some special applications need this, and that's probably why you don't see a lot of it used.

Apache Mina is a great networking library and uses NIO.

Apache MINA is a network application framework which helps users develop high performance and high scalability network applications easily. It provides an abstract · event-driven · asynchronous API over various transports such as TCP/IP and UDP/IP via Java NIO.

Net4J , a signaling platform/framework, makes heavy use of NIO channels. (One part of Net4J basically provides a convenience API to NIO channels.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM