高级 Java 文件 I/O 教程?尖端?建议?

发布于 2024-11-13 05:04:32 字数 523 浏览 2 评论 0原文

我现在正在开发一个项目,该项目将利用 Java 文件 I/O,它超出了我在网上找到的简单的“将此字符串写入文件”文档和教程。该项目本质上将提供一种数据库机制,类似于当今受到广泛关注的流行“NoSQL”数据库。然而,我无法找到大量文档来提供有关使用哪些 API、如何使用它们等的详细信息。我也一直在寻找围绕 Java 文件 I/O 的任何普遍接受的设计模式,但没有祝你好运。

如果我必须列出几个要求,我会说:

  • 伪事务支持(不是硬性要求,因为它可以在 API 堆栈的更高层实现)
  • 能够在结构中写入任意长度的数据,该结构可以 上回读
  • 稍后在索引
  • 能够有效地从“数据库”中删除对象
  • 快速搜索
  • 可能的多线程访问(最有可能的是多个读取线程,单个写入)

任何人都可以向我指出任何教程、文档、设计模式等。这可能有帮助吗?是否有任何围绕 Java 文件 I/O 的开源框架?我知道很多框架为网络 I/O 提供 NIO 包装器,但没有与文件相关的。

感谢您提供的任何帮助!

I'm working on a project right now that will make use of Java File I/O that goes beyond the simple "write this string to a file" documentation and tutorials that I find on the net. This project will essentially provide a database mechanism, similar to the popular "NoSQL" databases that are gaining a lot of press these days. However, I'm unable to find a ton of documentation that provides detailed information on which APIs to use, how to use them, etc. I've also been looking for any generally accepted design patterns around Java File I/O, but without any luck.

If I had to list a couple of requirements, I'd say:

  • Pseudo-transactional support (not a hard requirement, as it can be implemented higher up in the API stack)
  • Ability to write data of an arbitrary length in a structure that can be read back later on
  • Indexing
  • Ability to remove an object from the "database" efficiently
  • Fast searching
  • Possible multi-threaded access (multiple read threads, single write, most likely)

Can anyone point me to any tutorials, documentation, design patterns, etc. that may be helpful? Are there any open source frameworks that revolve around Java File I/O? I know of a lot of frameworks that provide wrappers around NIO for the purposes of Network I/O, but nothing File-related.

Thanks for any help you can provide!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我喜欢麦丽素 2024-11-20 05:04:33

查看 Apache Commons Transaction。它支持事务性文件访问,通过在临时文件中执行工作,并通过将它们移动到实际文件来提交工作。

您可能还对 XADisk 项目感兴趣,尽管我还没有仔细研究它的源代码。

就搜索而言,Apache SolrLucene 项目会有帮助。

Take a look at Apache Commons Transaction. It supports transactional file access, by performing the work in temporary files, and committing the work by moving them to the actual files.

You might also be interested in the XADisk project, although I haven't pored through it's sources.

As far as searching is concerned, the Apache Solr and Lucene projects would be of help.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文