简体   繁体   English

使用 java nio FileChannel 读取 hadoop 上的文件

[英]Read files on hadoop with java nio FileChannel

I am trying to read some hadoop files using nio.我正在尝试使用 nio 读取一些 hadoop 文件。 My question is how can I pass a FileSystem to FileChannel.我的问题是如何将 FileSystem 传递给 FileChannel。 The reason I want to use that is because, according to this post , nio is faster.我想使用它的原因是,根据这篇文章,nio 更快。

For this, you don't need to pass filesystem in FileChannel.为此,您不需要在 FileChannel 中传递文件系统。 You can extend FileChannel to accept the given filesystem.您可以扩展FileChannel以接受给定的文件系统。 You can go through this repo to read more about it.你可以通过这个 repo阅读更多关于它的信息。 You can see in this given file how FileChannel is extended.您可以在这个给定的文件中看到 FileChannel 是如何扩展的。

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

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