當前位置: 首頁>>代碼示例>>Java>>正文


Java FileUtils.getTempDirectory方法代碼示例

本文整理匯總了Java中org.apache.commons.io.FileUtils.getTempDirectory方法的典型用法代碼示例。如果您正苦於以下問題:Java FileUtils.getTempDirectory方法的具體用法?Java FileUtils.getTempDirectory怎麽用?Java FileUtils.getTempDirectory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.io.FileUtils的用法示例。


在下文中一共展示了FileUtils.getTempDirectory方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setup

import org.apache.commons.io.FileUtils; //導入方法依賴的package包/類
@PostConstruct
public void setup() {
    if (dataPath == null || dataPath.isEmpty()) {
        // init dataPath to platform dependent value
        if (OsUtils.isUnix() || OsUtils.isMac()) {
            dataPath = dataPathFallbackNix;
        } else if (OsUtils.isWindows()) {
            dataPath = dataPathFallbackWin;
        } else {
            logger.warn("fallback value for datadir not defined for this platform. Falling back to tmp dir");
            dataPath = FileUtils.getTempDirectory() + File.separator + "toscana";
        }
    }
    dataDir = new File(dataPath);
    dataDir.mkdirs();
    logger.info("Data directory is {}", dataDir.getAbsolutePath());
    if (!dataDir.exists()) {
        logger.error("Failed to create data directory");
    }
}
 
開發者ID:StuPro-TOSCAna,項目名稱:TOSCAna,代碼行數:21,代碼來源:Preferences.java

示例2: uploadAvatar

import org.apache.commons.io.FileUtils; //導入方法依賴的package包/類
@Override
public FileObject uploadAvatar(UploadFileRequest uploadFileRequest,
							   HttpServletRequest request,
							   HttpServletResponse response) throws IOException {
	validate(uploadFileRequest);

	MultipartFile multipartFile = HttpMultipartUtils.resolveMultipartFile(request);
	if (multipartFile == null || multipartFile.isEmpty()) {
		throw new FileStorageException("The multipart of http request is required.");
	}

	FileStorageRequest fileStorageRequest = buildFileStorageRequest(multipartFile, uploadFileRequest);

	File tempFile = new File(FileUtils.getTempDirectory(), UUID.randomUUID() + ".tmp");
	multipartFile.transferTo(tempFile);
	File resizedTempFile = new File(FileUtils.getTempDirectory(), UUID.randomUUID() + ".tmp");

	ImageUtils.zoomBySquare(tempFile, resizedTempFile, 128, true);

	return doUpload(fileStorageRequest, resizedTempFile);
}
 
開發者ID:melthaw,項目名稱:spring-backend-boilerplate,代碼行數:22,代碼來源:AttachmentRestSupportImpl.java

示例3: getTmpFile

import org.apache.commons.io.FileUtils; //導入方法依賴的package包/類
private static File getTmpFile() throws IOException {
	File tmpDir = FileUtils.getTempDirectory();
	if (!tmpDir.exists()) {
		tmpDir.mkdirs();
	}
	String tmpFileName = (Math.random() * 10000 + "").replace(".", "");
	return new File(tmpDir, tmpFileName);
}
 
開發者ID:TomChen001,項目名稱:xmanager,代碼行數:9,代碼來源:DefaultFileManager.java

示例4: getTmpFile

import org.apache.commons.io.FileUtils; //導入方法依賴的package包/類
private static File getTmpFile() {
	File tmpDir = FileUtils.getTempDirectory();
	String tmpFileName = (Math.random() * 10000 + "").replace(".", "");
	return new File(tmpDir, tmpFileName);
}
 
開發者ID:funtl,項目名稱:framework,代碼行數:6,代碼來源:StorageManager.java

示例5: getTmpFile

import org.apache.commons.io.FileUtils; //導入方法依賴的package包/類
private static File getTmpFile() {
	File tmpDir = FileUtils.getTempDirectory();
	String tmpFileName = (Math.random() * 10000.0D + "").replace(".", "");
	return new File(tmpDir, tmpFileName);
}
 
開發者ID:daima,項目名稱:solo-spring,代碼行數:6,代碼來源:StorageManager.java

示例6: getLocalTempFile

import org.apache.commons.io.FileUtils; //導入方法依賴的package包/類
private File getLocalTempFile(String filename) {
    return new File(FileUtils.getTempDirectory(), UUID.randomUUID().toString().substring(0, 10) + "-" + filename);
}
 
開發者ID:avast,項目名稱:hdfs-shell,代碼行數:4,代碼來源:EditCommands.java

示例7: FileStore

import org.apache.commons.io.FileUtils; //導入方法依賴的package包/類
/**
 *
 * Constructs a new {@link FileStore}.
 *
 * @throws IOException due to problems during the rootBucket creation
 */
public FileStore() throws IOException {
  this(new File(FileUtils.getTempDirectory(), "s3mockFileStore" + new Date().getTime()));
}
 
開發者ID:adobe,項目名稱:S3Mock,代碼行數:10,代碼來源:FileStore.java


注:本文中的org.apache.commons.io.FileUtils.getTempDirectory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。