コード例 #1
0
 private FileObject getChildFolder(
     final FileSystemManager fileSystem, final FileObject baseFolder, final String baseName)
     throws FileSystemException {
   for (int counter = 0; counter < TEMPORARY_FOLDER_ATTEMPTS; ++counter) {
     final FileObject temporaryFolder = fileSystem.resolveFile(baseFolder, baseName + counter);
     if (!temporaryFolder.exists()) {
       temporaryFolder.createFolder();
       return temporaryFolder;
     }
   }
   throw new FileSystemException(
       "Failed to create directory within "
           + TEMPORARY_FOLDER_ATTEMPTS
           + " attempts (tried "
           + baseName
           + "0 to "
           + baseName
           + (TEMPORARY_FOLDER_ATTEMPTS - 1)
           + ')');
 }
コード例 #2
0
 private FileObject getTemporaryFolder(final FileSystemManager fileSystem)
     throws FileSystemException {
   return fileSystem.resolveFile(System.getProperty("java.io.tmpdir"));
 }