本文整理了Java中com.intellij.openapi.util.io.FileUtil.createTempFile()
方法的一些代码示例,展示了FileUtil.createTempFile()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtil.createTempFile()
方法的具体详情如下:
包路径:com.intellij.openapi.util.io.FileUtil
类名称:FileUtil
方法名:createTempFile
暂无
代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin
if (StringUtil.isEmpty(outputDirectoryPath)) {
try {
outputFile = FileUtil.createTempFile(configurationName, "go", true);
代码示例来源:origin: GoogleCloudPlatform/google-cloud-intellij
private Optional<Path> doStageCredentials(String googleUsername) {
Optional<CredentialedUser> projectUser =
Services.getLoginService().getLoggedInUser(googleUsername);
GoogleLoginState googleLoginState;
if (projectUser.isPresent()) {
googleLoginState = projectUser.get().getGoogleLoginState();
} else {
return Optional.empty();
}
String clientId = googleLoginState.fetchOAuth2ClientId();
String clientSecret = googleLoginState.fetchOAuth2ClientSecret();
String refreshToken = googleLoginState.fetchOAuth2RefreshToken();
Map<String, String> credentialMap =
ImmutableMap.of(
CLIENT_ID_LABEL, clientId,
CLIENT_SECRET_LABEL, clientSecret,
REFRESH_TOKEN_LABEL, refreshToken,
GCLOUD_USER_TYPE_LABEL, GCLOUD_USER_TYPE);
String jsonCredential = new Gson().toJson(credentialMap);
try {
credentialsPath =
FileUtil.createTempFile(
"tmp_google_application_default_credential", "json", true /* deleteOnExit */)
.toPath();
Files.write(credentialsPath, jsonCredential.getBytes(Charsets.UTF_8));
return Optional.of(credentialsPath);
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
代码示例来源:origin: Camelcade/Perl5-IDEA
private void saveSvgFile(@NotNull final String outSvgFile, @NotNull final ControlFlow flow) throws IOException, ExecutionException {
String dotUtilName = SystemInfoRt.isUnix ? "dot" : "dot.exe";
File dotFullPath = PathEnvironmentVariableUtil.findInPath(dotUtilName);
if (dotFullPath == null) {
throw new FileNotFoundException("Cannot find dot utility in path");
}
File tmpFile = FileUtil.createTempFile("control-flow", ".dot", true);
FileUtil.writeToFile(tmpFile, convertControlFlowToDot(flow));
ExecUtil.execAndGetOutput(new GeneralCommandLine(dotFullPath.getAbsolutePath()).withInput(tmpFile.getAbsoluteFile())
.withParameters("-Tsvg", "-o" + outSvgFile, tmpFile.getAbsolutePath()).withRedirectErrorStream(true));
}
内容来源于网络,如有侵权,请联系作者删除!