简体   繁体   English

java.nio.channels。*

[英]java.nio.channels.*

What is up with nio channels ? Nio频道有什么问题? There were some nice talks when it was added to java but I still don't see people using it in their applications. 将其添加到Java中时,有一些不错的讨论,但我仍然看不到人们在其应用程序中使用它。

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. 您在询问渠道,但是渠道仅在整体上使用(相对)新的nio功能的总体框架中才有意义。

My guess is that of the many, many Java applications out in the world, not many need the capabilities of nio . 我的猜测是,世界上有很多Java应用程序,但没有多少需要 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. 就是说,Apache人士最近重新编写了他们的核心Java库( http://hc.apache.org/ )以使用nio ,并声称在某些情况下具有一些令人印象深刻的性能优势。

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. nio还允许您执行诸如内存映射文件之类的工作,这可以使应用程序对文件进行非常快速的随机访问。 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是一个出色的网络库,并使用NIO。

Apache MINA is a network application framework which helps users develop high performance and high scalability network applications easily. Apache MINA是一个网络应用程序框架,可帮助用户轻松开发高性能和高可伸缩性的网络应用程序。 It provides an abstract · event-driven · asynchronous API over various transports such as TCP/IP and UDP/IP via Java NIO. 它通过Java NIO通过各种传输(例如TCP / IP和UDP / IP)提供了一个抽象的,事件驱动的异步API。

Net4J , a signaling platform/framework, makes heavy use of NIO channels. 信令平台/框架Net4J大量使用NIO通道。 (One part of Net4J basically provides a convenience API to NIO channels.) (Net4J的一部分基本上为NIO通道提供了一个便捷的API。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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