forked from fanruan/easyexcel
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
929 B
41 lines
929 B
7 years ago
|
package com.alibaba.excel.util;
|
||
|
|
||
|
import java.io.File;
|
||
|
|
||
|
/**
|
||
|
*
|
||
|
* @author jipengfei
|
||
|
*/
|
||
|
public class POITempFile {
|
||
|
|
||
|
private static final String JAVA_IO_TMPDIR = "java.io.tmpdir";
|
||
|
|
||
|
private static final String POIFILES = "poifiles";
|
||
|
|
||
|
/**
|
||
|
*/
|
||
|
public static void createPOIFilesDirectory() {
|
||
|
|
||
|
String tmpDir = System.getProperty(JAVA_IO_TMPDIR);
|
||
|
if (tmpDir == null) {
|
||
|
throw new RuntimeException(
|
||
|
"Systems temporary directory not defined - set the -D" + JAVA_IO_TMPDIR + " jvm property!");
|
||
|
}
|
||
|
File directory = new File(tmpDir, POIFILES);
|
||
|
if (!directory.exists()) {
|
||
|
syncCreatePOIFilesDirectory(directory);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
*
|
||
|
* @param directory
|
||
|
*/
|
||
|
private static synchronized void syncCreatePOIFilesDirectory(File directory) {
|
||
|
if (!directory.exists()) {
|
||
|
directory.mkdirs();
|
||
|
}
|
||
|
}
|
||
|
}
|