org.codehaus.plexus.util.FileUtils.createTempFile()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(175)

本文整理了Java中org.codehaus.plexus.util.FileUtils.createTempFile()方法的一些代码示例,展示了FileUtils.createTempFile()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.createTempFile()方法的具体详情如下:
包路径:org.codehaus.plexus.util.FileUtils
类名称:FileUtils
方法名:createTempFile

FileUtils.createTempFile介绍

[英]Create a temporary file in a given directory.

The file denoted by the returned abstract pathname did not exist before this method was invoked, any subsequent invocation of this method will yield a different file name.

The filename is prefixNNNNNsuffix where NNNN is a random number

This method is different to File.createTempFile of JDK 1.2 as it doesn't create the file itself. It uses the location pointed to by java.io.tmpdir when the parentDir attribute is null.
[中]在给定目录中创建临时文件。
在调用此方法之前,由返回的抽象路径名表示的文件不存在,对此方法的任何后续调用都将生成不同的文件名。
文件名为前缀nnnnnsuffix,其中NNNN是一个随机数
此方法与文件不同。JDK 1.2的createTempFile,因为它不创建文件本身。它使用java指向的位置。木卫一。当parentDir属性为null时使用tmpdir。

代码示例

代码示例来源:origin: org.codehaus.plexus/plexus-archiver

renamedFile = FileUtils.createTempFile( "zip", ".tmp", zipFile.getParentFile() );
renamedFile.deleteOnExit();

代码示例来源:origin: org.sonatype.plexus/plexus-ldap-testsuite

public File getWorkingDirectory()
{
  if ( temporayWorkDir == null )
  {
    temporayWorkDir = FileUtils.createTempFile( "ldap-", "-server", workingDirectory );
    temporayWorkDir.mkdirs();
  }
  return temporayWorkDir;
}

代码示例来源:origin: org.sonatype.maven.archetype/archetype-common

private File getTemporaryFile(File file) {
    File tmp=FileUtils.createTempFile(file.getName(), Constants.TMP, file.getParentFile());
    tmp.deleteOnExit();
    return tmp;
  }
}

代码示例来源:origin: apache/maven-archetype

private File getTemporaryFile( File file )
  {
    File tmp = FileUtils.createTempFile( file.getName(), Constants.TMP, file.getParentFile() );

    tmp.deleteOnExit();

    return tmp;
  }
}

代码示例来源:origin: fusesource/hawtjni

private void copyTemplateResource(String file, String output, boolean filter) throws MojoExecutionException {
  try {
    File target = FileUtils.resolveFile(packageDirectory, output);
    if( target.isFile() && target.canRead() ) {
      return;
    }
    URL source = getClass().getClassLoader().getResource("project-template/" + file);
    File tmp = FileUtils.createTempFile("tmp", "txt", new File(project.getBuild().getDirectory()));
    try {
      FileUtils.copyURLToFile(source, tmp);
      FileUtils.copyFile(tmp, target, encoding, filters(filter), true);
    } finally {
      tmp.delete();
    }
  } catch (IOException e) {
    throw new MojoExecutionException("Could not extract template resource: "+file, e);
  }
}

代码示例来源:origin: org.apache.maven.plugins/maven-javadoc-plugin

FileUtils.createTempFile( "clirr", ".txt", new File( project.getBuild().getDirectory() ) );
Properties properties = new Properties();
properties.put( "textOutputFile", clirrTextOutputFile.getAbsolutePath() );
File invokerLogFile = FileUtils.createTempFile( "clirr-maven-plugin", ".txt", invokerDir );
new File( project.getBuild().getDirectory(), "invoker-clirr-maven-plugin.txt" );
JavadocUtil.invokeMaven( getLog(), new File( localRepository.getBasedir() ), project.getFile(),

代码示例来源:origin: net.flexmojos.oss/flexmojos-maven-plugin

dest = FileUtils.createTempFile( baseRbSwc.getArtifactId(), requestedLocale, getOutputDirectory() );
unzip.extract( "locale/" + baseRbSwc.getClassifier(), dest );

代码示例来源:origin: org.apache.maven.plugins/maven-javadoc-plugin

File invokerLogFile = FileUtils.createTempFile( "maven-javadoc-plugin", ".txt", invokerDir );
try

代码示例来源:origin: org.sonatype.nexus/nexus-test-harness-base

protected File downloadSnapshotArtifact( String repository, Gav gav, File parentDir )
  throws IOException
{
  // @see http://issues.sonatype.org/browse/NEXUS-599
  // r=<repoId> -- mandatory
  // g=<groupId> -- mandatory
  // a=<artifactId> -- mandatory
  // v=<version> -- mandatory
  // c=<classifier> -- optional
  // p=<packaging> -- optional, jar is taken as default
  // http://localhost:8087/nexus/service/local/artifact/maven/redirect?r=tasks-snapshot-repo&g=nexus&a=artifact&
  // v=1.0-SNAPSHOT
  String serviceURI =
    "service/local/artifact/maven/redirect?r=" + repository + "&g=" + gav.getGroupId() + "&a="
      + gav.getArtifactId() + "&v=" + gav.getVersion();
  Response response = RequestFacade.doGetRequest( serviceURI );
  Status status = response.getStatus();
  Assert.assertEquals( "Snapshot download should redirect to a new file\n "
    + response.getRequest().getResourceRef().toString() + " \n Error: " + status.getDescription(), 301,
             status.getCode() );
  Reference redirectRef = response.getRedirectRef();
  Assert.assertNotNull( "Snapshot download should redirect to a new file "
    + response.getRequest().getResourceRef().toString(), redirectRef );
  serviceURI = redirectRef.toString();
  File file = FileUtils.createTempFile( gav.getArtifactId(), '.' + gav.getExtension(), parentDir );
  RequestFacade.downloadFile( new URL( serviceURI ), file.getAbsolutePath() );
  return file;
}

代码示例来源:origin: org.apache.maven.scm/maven-scm-provider-svnexe

File messageFile = FileUtils.createTempFile( "maven-scm-", ".commit", null );

代码示例来源:origin: apache/maven-scm

File messageFile = FileUtils.createTempFile( "maven-scm-", ".commit", null );

代码示例来源:origin: jenkinsci/scm-sync-configuration-plugin

CommandLineUtils.StringStreamConsumer stdout = new CommandLineUtils.StringStreamConsumer();
File messageFile = FileUtils.createTempFile("maven-scm-", ".commit", null);
try {
  FileUtils.fileWrite(messageFile.getAbsolutePath(), message);

代码示例来源:origin: khuxtable/wagon-gitsite

File messageFile = FileUtils.createTempFile("maven-scm-", ".commit", null);

代码示例来源:origin: org.apache.maven.scm/maven-scm-provider-svnexe

File messageFile = FileUtils.createTempFile( "maven-scm-", ".commit", null );

代码示例来源:origin: apache/maven-scm

File messageFile = FileUtils.createTempFile( "maven-scm-", ".commit", null );

代码示例来源:origin: org.apache.maven.scm/maven-scm-provider-svnexe

File messageFile = FileUtils.createTempFile( "maven-scm-", ".commit", null );

代码示例来源:origin: org.apache.maven.scm/maven-scm-provider-svnexe

throws ScmException
File messageFile = FileUtils.createTempFile( "maven-scm-", ".commit", null );

代码示例来源:origin: apache/maven-scm

throws ScmException
File messageFile = FileUtils.createTempFile( "maven-scm-", ".commit", null );

代码示例来源:origin: org.apache.maven.scm/maven-scm-provider-gitexe

File messageFile = FileUtils.createTempFile( "maven-scm-", ".commit", null );

代码示例来源:origin: apache/maven-scm

File messageFile = FileUtils.createTempFile( "maven-scm-", ".commit", null );

相关文章