title: Simple Filesystem/Database Abstraction in Java?
body: <p>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 <em>only</em> 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.</p>
  
  <p>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.</p>
  
  <p>Some sort of api like</p>
  
  <pre><code>String[] TextStorage.list()
  InputStream TextStorage.open(String elementname);
  </code></pre>
  
  <p>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).</p>
  
  <p>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.</p>