当前位置: 首页>>代码示例>>Java>>正文


Java FileUtil.createTempFile方法代码示例

本文整理汇总了Java中jetbrains.buildServer.util.FileUtil.createTempFile方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtil.createTempFile方法的具体用法?Java FileUtil.createTempFile怎么用?Java FileUtil.createTempFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jetbrains.buildServer.util.FileUtil的用法示例。


在下文中一共展示了FileUtil.createTempFile方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeToTempFile

import jetbrains.buildServer.util.FileUtil; //导入方法依赖的package包/类
@NotNull
private File writeToTempFile(@NotNull final File buildTempDir,
                             @NotNull final String text,
                             @NotNull final  Map<String, String> runnerParameters) throws RunBuildException {
  Closeable handle = null;
  File file;
  try {
    file = FileUtil.createTempFile(buildTempDir, "powershell", ".ps1", true);
    OutputStreamWriter w = new OutputStreamWriter(new FileOutputStream(file), "utf-8");
    handle = w;
    if (PowerShellExecutionMode.PS1 == PowerShellExecutionMode.fromString(runnerParameters.get(RUNNER_EXECUTION_MODE))) {
      w.write(BOM);
    }
    w.write(text);
    return file;
  } catch (IOException e) {
    LOG.error("Error occurred while processing file for PowerShell script", e);
    throw new RunBuildException("Failed to generate temporary resulting PowerShell script due to exception", e);
  } finally {
    FileUtil.close(handle);
  }
}
 
开发者ID:JetBrains,项目名称:teamcity-powershell,代码行数:23,代码来源:ScriptGenerator.java

示例2: patch

import jetbrains.buildServer.util.FileUtil; //导入方法依赖的package包/类
public void patch(File symbolsFile, BuildProgressLogger buildLogger) throws Exception {
  final Collection<File> sourceFiles = mySrcToolExe.getReferencedSourceFiles(symbolsFile);
  final String symbolsFileCanonicalPath = symbolsFile.getCanonicalPath();
  if(sourceFiles.isEmpty()){
    final String message = "No source information found in pdb file " + symbolsFileCanonicalPath;
    buildLogger.warning(message);
    LOG.debug(message);
    return;
  }
  final File tmpFile = FileUtil.createTempFile(myWorkingDir, "pdb-", ".patch", false);
  int processedFilesCount = mySrcSrvStreamBuilder.dumpStreamToFile(tmpFile, sourceFiles);
  if(processedFilesCount == 0){
    buildLogger.warning(String.format("Sources appeared in file %s weren't actually indexed. Looks like related binary file wasn't built during current build.", symbolsFileCanonicalPath));
  } else {
    buildLogger.message(String.format("Information about %d source files was updated", processedFilesCount));
  }
  myPdbStrExe.doCommand(PdbStrExeCommands.WRITE, symbolsFile, tmpFile, PdbStrExe.SRCSRV_STREAM_NAME);
}
 
开发者ID:JetBrains,项目名称:teamcity-symbol-server,代码行数:19,代码来源:PdbFilePatcher.java

示例3: generateNixScriptFile

import jetbrains.buildServer.util.FileUtil; //导入方法依赖的package包/类
@NotNull
private File generateNixScriptFile(@NotNull final String argumentsToGenerate) throws RunBuildException {
  final File script;
  try {
    script = FileUtil.createTempFile(getBuildTempDirectory(), "powershell_gen_" + System.currentTimeMillis(), ".sh", true);
    myFilesToRemove.add(script);
    FileUtil.writeFileAndReportErrors(script, argumentsToGenerate);
  } catch (IOException e) {
    throw new RunBuildException("Failed to generate .sh wrapper file");
  }
  return script;
}
 
开发者ID:JetBrains,项目名称:teamcity-powershell,代码行数:13,代码来源:PowerShellServiceUnix.java

示例4: generateRunScriptArguments

import jetbrains.buildServer.util.FileUtil; //导入方法依赖的package包/类
@NotNull
private List<String> generateRunScriptArguments(@NotNull final String argumentsToGenerate) throws RunBuildException {
  final File bat;
  try {
    bat = FileUtil.createTempFile(getBuildTempDirectory(), "powershell", ".bat", true);
    myFilesToRemove.add(bat);
    FileUtil.writeFileAndReportErrors(bat, "@" + argumentsToGenerate);
  } catch (IOException e) {
    throw new RunBuildException("Failed to generate .bat file");
  }
  return Arrays.asList("/c", bat.getPath());
}
 
开发者ID:JetBrains,项目名称:teamcity-powershell,代码行数:13,代码来源:PowerShellServiceWindows.java

示例5: getPdbSignature

import jetbrains.buildServer.util.FileUtil; //导入方法依赖的package包/类
@NotNull
private PdbSignatureIndexEntry getPdbSignature(File pdbFile) throws Exception {
  final File guidDumpFile = FileUtil.createTempFile(myBuildTempDirectory, "symbol-signature-local-", ".xml", false);
  myJetSymbolsExe.dumpPdbGuidsToFile(Collections.singleton(pdbFile), guidDumpFile, myProgressLogger);
  if(guidDumpFile.isFile())
    return PdbSignatureIndexUtil.read(new FileInputStream(guidDumpFile), true).iterator().next();
  else
    throw new Exception("Failed to get signature of " + pdbFile.getPath());
}
 
开发者ID:JetBrains,项目名称:teamcity-symbol-server,代码行数:10,代码来源:SymbolsIndexer.java

示例6: getBinarySignature

import jetbrains.buildServer.util.FileUtil; //导入方法依赖的package包/类
@NotNull
private PdbSignatureIndexEntry getBinarySignature(File binaryFile) throws Exception {
  final File guidDumpFile = FileUtil.createTempFile(myBuildTempDirectory, "binary-signature-local-", ".xml", false);
  BinaryGuidDumper.dumpBinaryGuidsToFile(Collections.singleton(binaryFile), guidDumpFile, myProgressLogger);
  if(guidDumpFile.isFile())
    return PdbSignatureIndexUtil.read(new FileInputStream(guidDumpFile), true).iterator().next();
  else
    throw new Exception("Failed to get signature of " + binaryFile.getPath());
}
 
开发者ID:JetBrains,项目名称:teamcity-symbol-server,代码行数:10,代码来源:SymbolsIndexer.java

示例7: dumpPathsToFile

import jetbrains.buildServer.util.FileUtil; //导入方法依赖的package包/类
private File dumpPathsToFile(Collection<File> files) throws IOException {
  final File result = FileUtil.createTempFile(DUMP_SYMBOL_SIGN_CMD, ".input");
  StringBuilder contentBuilder = new StringBuilder();
  for(File file : files){
    contentBuilder.append(file.getPath()).append("\n");
  }
  FileUtil.writeToFile(result, contentBuilder.toString().getBytes());
  return result;
}
 
开发者ID:JetBrains,项目名称:teamcity-symbol-server,代码行数:10,代码来源:JetSymbolsExe.java

示例8: testSpacesInPaths

import jetbrains.buildServer.util.FileUtil; //导入方法依赖的package包/类
@Test
public void testSpacesInPaths() throws Exception {
  final File output = FileUtil.createTempFile("test spaces in paths", ".out");
  final File input = FileUtil.createTempFile("test spaces in paths", ".in");
  final int exitCode = myExe.dumpPdbGuidsToFile(Collections.singleton(input), output, new NullBuildProgressLogger());
  assertEquals(0, exitCode);
}
 
开发者ID:JetBrains,项目名称:teamcity-symbol-server,代码行数:8,代码来源:JetSymbolsExeTest.java

示例9: testCmdParametersLengthLimit

import jetbrains.buildServer.util.FileUtil; //导入方法依赖的package包/类
@Test
public void testCmdParametersLengthLimit() throws Exception {
  final File output = FileUtil.createTempFile("testCmdParametersLengthLimit", ".out");
  final int dumpExitCode = myExe.dumpPdbGuidsToFile(getFilesCollection(500), output, new NullBuildProgressLogger());
  assertEquals(0, dumpExitCode);
}
 
开发者ID:JetBrains,项目名称:teamcity-symbol-server,代码行数:7,代码来源:JetSymbolsExeTest.java


注:本文中的jetbrains.buildServer.util.FileUtil.createTempFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。