commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "B. K. Oxley (binkley)" <>
Subject Re: sandbox VFS
Date Thu, 20 Jan 2005 17:10:49 GMT
St├ęphane Rault wrote:
> I'm trying to use the wonderful VFS. It works quite well but I've a 
> problem with writing in zip file. Searching for informations, I wonder 
> if VFS is still a live project and if sometimes, it will leave the 
> sandbox to become a complete Jakarta-Common project ?

I'd like to see some more utility methods for manipulating file objects. 
  For example, much of my code needs:

     void saveAs() throws IOException;
     void moveTo() throws IOException;
     void copyTo() throws IOException;

I use these as high-level operations which use do-or-die semantics 
(succeed or throw an exception) and call more basic file object 
operations to do the work.  Here is the implementation of saveAs() with 
a lot of things unexplained (but I use readable names, so I hope that 
helps -- a WhimFile is just a with these extra operations; 
I'm using it to demonstrate my ideas to my coworkers):

private static void saveMaybeBackup(final WhimFile original,
         final InputStream newContents, final boolean keepBackup)
         throws IOException {
     final WhimFile scratch = original.createTempWhimFile("save", null);

     try {
         copyAndClose(newContents, scratch.getOutputStream());

         if (keepBackup && original.exists())

         // TODO: if scratch.moveTo throws, restore original from backup?

     } finally {


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message