Пример #1
0
 /**
  * Run the given operation, passing in a temporary directory that is newly created (implying that
  * it exists and is empty), and delete the directory after the operation has completed.
  *
  * @param operation the operation to be run
  * @throws Exception if the operation throws an Exception or if the directory either cannot be
  *     created or cannot be deleted
  */
 public static void runWithTempDirectory(FileOperation operation) throws Exception {
   File tempDir = createTempDirectory();
   try {
     operation.run(tempDir);
   } finally {
     FileUtilities.delete(tempDir);
   }
 }