本文整理汇总了Java中org.alfresco.util.TempFileProvider.getSystemTempDir方法的典型用法代码示例。如果您正苦于以下问题:Java TempFileProvider.getSystemTempDir方法的具体用法?Java TempFileProvider.getSystemTempDir怎么用?Java TempFileProvider.getSystemTempDir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.util.TempFileProvider
的用法示例。
在下文中一共展示了TempFileProvider.getSystemTempDir方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: exportSystem
import org.alfresco.util.TempFileProvider; //导入方法依赖的package包/类
public FileExportHandle exportSystem(String packageName)
{
// create a temporary file to hold the system info export
File systemTempDir = TempFileProvider.getSystemTempDir();
File tempFile = TempFileProvider.createTempFile("repoExpSystemInfo", ".xml", systemTempDir);
try
{
OutputStream outputStream = new FileOutputStream(tempFile);
systemExporterImporter.exportSystem(outputStream);
}
catch(FileNotFoundException e)
{
tempFile.delete();
throw new ExporterException("Failed to create temporary file for holding export of system info");
}
// return handle onto temp file
FileExportHandle handle = new FileExportHandle();
handle.storeRef = null;
handle.packageName = packageName;
handle.mimeType = MimetypeMap.MIMETYPE_XML;
handle.exportFile = tempFile;
return handle;
}
示例2: exportStore
import org.alfresco.util.TempFileProvider; //导入方法依赖的package包/类
public FileExportHandle exportStore(ExporterCrawlerParameters exportParameters, String packageName, Exporter progress)
{
// create a temporary file to hold the acp export
File systemTempDir = TempFileProvider.getSystemTempDir();
File tempFile = TempFileProvider.createTempFile("repoExp" + packageName, "." + ACPExportPackageHandler.ACP_EXTENSION, systemTempDir);
// create acp export handler around the temp file
File dataFile = new File(packageName);
File contentDir = new File(packageName);
try
{
OutputStream outputStream = new FileOutputStream(tempFile);
ACPExportPackageHandler acpHandler = new ACPExportPackageHandler(outputStream, dataFile, contentDir, mimetypeService);
// export the store
exporterService.exportView(acpHandler, exportParameters, progress);
}
catch(FileNotFoundException e)
{
tempFile.delete();
throw new ExporterException("Failed to create temporary file for holding export of store " + exportParameters.getExportFrom().getStoreRef());
}
// return handle onto temp file
FileExportHandle handle = new FileExportHandle();
handle.storeRef = exportParameters.getExportFrom().getStoreRef();
handle.packageName = packageName;
handle.mimeType = MimetypeMap.MIMETYPE_ACP;
handle.exportFile = tempFile;
return handle;
}
示例3: createFileOfSize
import org.alfresco.util.TempFileProvider; //导入方法依赖的package包/类
private File createFileOfSize(long sizeInKB) throws IOException
{
File file = new File(TempFileProvider.getSystemTempDir(), GUID.generate() + ".generated");
file.deleteOnExit();
BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(file));
for (long i = 0; i < sizeInKB; i++)
{
os.write(aKB);
}
os.close();
return file;
}