当前位置: 首页>>代码示例>>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;未经允许,请勿转载。