Java Temp File Create createTempFile(String oriFileName)

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

Description

create Temp File

License

Apache License

Declaration

public static File createTempFile(String oriFileName) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.File;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

public class Main {

    public static File createTempFile(String oriFileName) {
        return new File(System.getProperty("java.io.tmpdir"),
                new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()) + "_" + new Random().nextInt(99999)
                        + "_" + oriFileName);
    }// w  w  w. ja v a  2 s .  c  o  m
}

Related

  1. createTempFile(@Nonnull String prefix, @Nonnull String suffix, @Nullable File parentDir)
  2. createTempFile(final String file, final String ext)
  3. getTempFile()
  4. getTempFile()
  5. getTempFile(File file)
  6. getTempFile(File parent, String fileName)