开发者

Simple Filesystem/Database Abstraction in Java?

开发者 https://www.devze.com 2023-01-24 03:15 出处:网络
Basically, I am looking for a simple way to list and access a set of strings in stream form in an abstract manner.The only issue is that Java\'s file-accessing API can only be used for listing and rea

Basically, I am looking for a simple way to list and access a set of strings in stream form in an abstract manner. The only issue is that Java's file-accessing API can only be used for listing and reading files, and any sort of non-filesystem storage of the data uses a different API. My question is whether there is some common API I could use (whether included in Java or as an external API) so that I could access both in an abstract manner, but also somewhat efficiently.

Essentially I want a set of lazily streamed text files. Something like Set might be reasonable, except on a filesystem, you would have to open the text streams even if you don't end up wanting to access that file.

Some sort of api like

String[] TextSt开发者_StackOverflow社区orage.list()
InputStream TextStorage.open(String elementname);

which could abstractly be used to access either filesystems or databases, or some other storage mechanism I invent in the future (maybe fetching something across the internet).

Is there a library which already does this? Can I do this with the already existing Java API? Do I need to write this myself? I'd be surprised if no-one has encountered this problem before, but my google-fu and stackoverflow searches don't seem to find anything.


you might use HSQL

http://hsqldb.org/

0

精彩评论

暂无评论...
验证码 换一张
取 消