List of utility methods to do Temp File Create
File | getTempFile(String config) get Temp File return getTempFile(config, ".xml"); |
File | getTempFile(String extension) get Temp File File tmpDir = new File(System.getProperty("java.io.tmpdir")); String uuid = UUID.randomUUID().toString(); return new File(tmpDir, uuid + "." + extension); |
File | getTempFile(String fileId) get Temp File return new File(getTempDirectory(), fileId); |
File | getTempFile(String filePrefix, boolean deleteOnExit) get Temp File String tempFileName = filePrefix + "-" + System.nanoTime(); File tempFile = null; try { tempFile = File.createTempFile(tempFileName, ".txt"); if (deleteOnExit) { tempFile.deleteOnExit(); } catch (IOException e) { ... |
File | getTempFile(String name) get Temp File return new File(TEMP_PATH_ROOT, name); |
File | getTempFile(String tmpdir) get Temp File String name = String.valueOf(System.currentTimeMillis() + ++counter); return new File(tmpdir, name); |
File | getTempFileDir() Returns the Ofbiz temporary file directory (for uploaded files, etc). return new File(new File(System.getProperty("ofbiz.home"), "runtime"), "tmp"); |
File | getTempFileFor(File file) Find a non-existing file in the same directory using the same name as prefix. File parent = file.getParentFile(); String name = file.getName(); File result; int index = 0; do { result = new File(parent, name + "_" + index++); } while (result.exists()); return result; ... |
String | getTempFileGivenName(File file) Method getTempFileGivenName String fileName = file.getName(); int index = fileName.indexOf(GIVEN_NAME_SUFFIX); if (index < 0) { return fileName; } else { return fileName.substring(0, index); |
String | getTempFileName() get Temp File Name String tmpDir = System.getProperty("java.io.tmpdir"); if (tmpDir == null) { tmpDir = "/tmp"; String uuid = UUID.randomUUID().toString(); File f = new File(tmpDir, uuid); return f.getAbsolutePath(); |