Java Temp Folder Create createTemporaryDirectory(File baseDirectory)

Here you can find the source of createTemporaryDirectory(File baseDirectory)

Description

create Temporary Directory

License

Apache License

Declaration

public static File createTemporaryDirectory(File baseDirectory) throws IOException 

Method Source Code

//package com.java2s;
/**/*from w  w  w  .j a  v a2 s .com*/
 * Copyright 2011-2017 Asakusa Framework Team.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.io.File;
import java.io.IOException;
import java.text.MessageFormat;

import java.util.UUID;

public class Main {
    public static File createTemporaryDirectory(File baseDirectory) throws IOException {
        File f = new File(baseDirectory, UUID.randomUUID().toString());
        if (f.mkdirs() == false) {
            throw new IOException(
                    MessageFormat.format("error occurred while creating a temporary directory: {0}", f));
        }
        return f;
    }
}

Related

  1. getTempFolder()
  2. getTempFolder()
  3. getTempFolder()
  4. GetTempFolder()