Java Temp File Create nio createTempFile(String name)

Here you can find the source of createTempFile(String name)

Description

create Temp File

License

Open Source License

Declaration

public static Path createTempFile(String name) throws IOException 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2014, 2015 IBH SYSTEMS GmbH.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:// w  w w.  ja v  a2 s. c om
 *     IBH SYSTEMS GmbH - initial API and implementation
 *******************************************************************************/

import java.io.IOException;
import java.net.URLEncoder;
import java.nio.file.Files;
import java.nio.file.Path;

public class Main {
    public static Path createTempFile(String name) throws IOException {
        if (name != null) {
            name = URLEncoder.encode(name, "UTF-8");
        }
        return Files.createTempFile("blob-", "-" + name);
    }
}

Related

  1. createTempFile()
  2. createTempFile(final Object forObject)
  3. createTempFile(final String name)
  4. createTempFile(String contents)
  5. createTempFile(String name, String extension, String[] lines)
  6. createTemporaryFile(String extension)
  7. createTemporaryFileFromURL(final URL url)