commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "B. K. Oxley (binkley)" <>
Subject [vfs] temporary files
Date Wed, 02 Feb 2005 15:20:55 GMT
What's the right way to make a temporary file with VFS?  I need some for 
unit tests.  For the nonce I did this:

FileObject createTemporary() {
     // Using JDK UUID generator -- is this JDK1.3-compiant?
     final FileObject tmp = VFS.getManager().resolveFile(
             "tmp:/" + UUID.randomUUID());


     return tmp;

But this has several drawbacks, among them:
   * No automatic cleanup on exit as with File.deleteOnExit()
   * Depends on TempFS being configured
   * Relies on the static VFS.getManager() call
   * Smells hacky


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

View raw message