Java内存中的文件结构? [英] Java in-memory file structure?

查看:63
本文介绍了Java内存中的文件结构?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要实时处理很多事情:解析xsd/xml文档,构建和编译Java类,将它们打包到jar战中,持久保存在DB中,将它们部署为OSGi等.

I need to do a lot of things with resources on the fly: parsing xsd/xml docs, building and compiling java classes, package them into jars ans wars, persist in DB, deploy them as OSGi, etc.

我使用的大多数库/API允许在内存中执行所有这些中间任务,但是有些特殊"库仅与java.io.File一起运行.除了使用真正的临时文件和目录外,我什么都没有剩下了,这在Java EE环境中是不好的.

Most of the libraries/API's, which I use, allow to perform all these intermediate tasks in memory, but there are some "special" libraries operating with java.io.File only. And there's nothing left for me but using real temporary files and directories which is not good in Java EE environment.

我相信必须有一个内存/文件结构的库/解决方案,该文件结构具有扩展为java.io.File的节点(如我所见).请插入到已知/类似库的链接.欢迎任何评论.

I believe there must be a library/solution for in-memory file structure having nodes extending java.io.File (as I see it). Please drop in a link to known/similar libraries. Any comments are welcome.

谢谢!

推荐答案

我不相信您会找到想要的东西.编写java.io.File API并不是为了提供可以以多种方式实现的文件系统抽象.虽然它确实公开了某些FS操作的方法(例如delete和mkdir),但它不处理基本的读/写I/O.剩下的留给其他类,例如FileInputStream.这意味着从API的角度来看,File对象只不过是一个路径.没有什么是抽象的.你被困住了.

I do not believe you are going to find what you are looking for. The java.io.File API was not written with the intention of providing a file system abstraction that can be implemented in a variety of ways. While it does expose method for some FS operations (such as delete and mkdir), it doesn't handle the basic read/write I/O. That is left to other classes, such as FileInputStream. This means that from API standpoint, a File object is no more than a path. Nothing is abstracted. You are stuck.

这篇关于Java内存中的文件结构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆