本文整理了Java中org.codehaus.plexus.util.FileUtils.fileWrite()
方法的一些代码示例,展示了FileUtils.fileWrite()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.fileWrite()
方法的具体详情如下:
包路径:org.codehaus.plexus.util.FileUtils
类名称:FileUtils
方法名:fileWrite
[英]Writes data to a file. The file will be created if it does not exist. Note: the data is written with platform encoding
[中]将数据写入文件。如果文件不存在,将创建该文件。注:数据采用平台编码写入
代码示例来源:origin: org.codehaus.plexus/plexus-utils
/**
* Writes data to a file. The file will be created if it does not exist. Note: the data is written with platform
* encoding
*
* @param fileName The path of the file to write.
* @param data The content to write to the file.
* @throws IOException if any
*/
public static void fileWrite( String fileName, String data )
throws IOException
{
fileWrite( fileName, null, data );
}
代码示例来源:origin: org.codehaus.plexus/plexus-utils
/**
* Writes data to a file. The file will be created if it does not exist. Note: the data is written with platform
* encoding
*
* @param file The file to write.
* @param data The content to write to the file.
* @throws IOException if any
* @since 2.0.6
*/
public static void fileWrite( File file, String data )
throws IOException
{
fileWrite( file, null, data );
}
代码示例来源:origin: org.codehaus.plexus/plexus-utils
/**
* Writes data to a file. The file will be created if it does not exist.
*
* @param fileName The path of the file to write.
* @param encoding The encoding of the file.
* @param data The content to write to the file.
* @throws IOException if any
*/
public static void fileWrite( String fileName, String encoding, String data )
throws IOException
{
File file = ( fileName == null ) ? null : new File( fileName );
fileWrite( file, encoding, data );
}
代码示例来源:origin: fabric8io/docker-maven-plugin
/**
* Create a DockerFile in the given directory
* @param destDir directory where to store the dockerfile
* @return the full path to the docker file
* @throws IOException if writing fails
*/
public File write(File destDir) throws IOException {
File target = new File(destDir,"Dockerfile");
FileUtils.fileWrite(target, content());
return target;
}
代码示例来源:origin: apache/maven
FileUtils.fileWrite( temp.getAbsolutePath(), "UTF-8", sums.get( extension ) );
代码示例来源:origin: takari/polyglot-maven
xmlWriter.write(xml, model);
FileUtils.fileWrite(pom, xml.toString());
if (!dumpPom.exists() || !FileUtils.fileRead(dumpPom).equals(xml.toString().replace("?>", WARNING))) {
dumpPom.setWritable(true);
FileUtils.fileWrite(dumpPom, xml.toString().replace("?>", WARNING));
if ("true".equals(model.getProperties().getProperty("polyglot.dump.readonly"))) {
dumpPom.setReadOnly();
代码示例来源:origin: org.apache.servicemix.kernel.gshell/org.apache.servicemix.kernel.gshell.core
/**
* Writes data to a file. The file will be created if it does not exist.
* Note: the data is written with platform encoding
*
* @param fileName The name of the file to write.
* @param data The content to write to the file.
*/
public static void fileWrite( String fileName, String data )
throws IOException
{
fileWrite( fileName, null, data );
}
代码示例来源:origin: org.apache.maven.wagon/wagon-provider-test
private void writeTestFile( String child )
throws IOException
{
File dir = new File( sourceFile, child );
dir.getParentFile().mkdirs();
FileUtils.fileWrite( dir.getAbsolutePath(), child );
}
代码示例来源:origin: org.scala-tools/maven-scala-plugin
private void setLastSuccessfullCompilation(File outputDir, long v) throws Exception {
final File lastCompileAtFile = new File(outputDir + ".timestamp");
if (lastCompileAtFile.exists()) {
} else {
FileUtils.fileWrite(lastCompileAtFile.getAbsolutePath(), ".");
}
lastCompileAtFile.setLastModified(v);
}
}
代码示例来源:origin: jenkinsci/scm-sync-configuration-plugin
private static void writeFile(File f, String data) {
try {
FileUtils.fileWrite(f.getAbsolutePath(), data);
}
catch(IOException e) {
LOGGER.severe("Unable to write file " + f.getAbsolutePath() + " : " + e.getMessage());
}
}
代码示例来源:origin: eclipse/tycho
private void writeFile(File basedir, String path, String data) throws IOException {
File file = new File(basedir, path).getAbsoluteFile();
file.getParentFile().mkdirs();
FileUtils.fileWrite(file.getAbsolutePath(), data);
}
代码示例来源:origin: javolution/javolution
private File createEnvWrapperFile(File vsInstallDir, String platform) throws IOException {
File tmpFile = File.createTempFile("msenv", ".bat");
StringBuffer buffer = new StringBuffer();
buffer.append("@echo off\r\n");
buffer.append("call \"").append(vsInstallDir).append("\"")
.append("\\VC\\Auxiliary\\Build\\vcvarsall.bat " + platform + "\n\r");
buffer.append("echo " + EnvStreamConsumer.START_PARSING_INDICATOR).append("\r\n");
buffer.append("set\n\r");
FileUtils.fileWrite(tmpFile.getAbsolutePath(), buffer.toString());
return tmpFile;
}
代码示例来源:origin: javolution/javolution
private File createEnvWrapperFile(File vsInstallDir, String platform) throws IOException {
File tmpFile = File.createTempFile("msenv", ".bat");
StringBuffer buffer = new StringBuffer();
buffer.append("@echo off\r\n");
buffer.append("call \"").append(vsInstallDir).append("\"")
.append("\\VC\\Auxiliary\\Build\\vcvarsall.bat " + platform + "\n\r");
buffer.append("echo " + EnvStreamConsumer.START_PARSING_INDICATOR).append("\r\n");
buffer.append("set\n\r");
FileUtils.fileWrite(tmpFile.getAbsolutePath(), buffer.toString());
return tmpFile;
}
代码示例来源:origin: org.apache.maven.wagon/wagon-ssh-common
public void storeKnownHosts( String contents )
throws IOException
{
Set<KnownHostEntry> hosts = this.loadKnownHosts( contents );
if ( ! this.knownHosts.equals( hosts ) )
{
file.getParentFile().mkdirs();
FileUtils.fileWrite( file.getAbsolutePath(), contents );
this.knownHosts = hosts;
}
}
代码示例来源:origin: org.jolokia/docker-maven-plugin
/**
* Create a DockerFile in the given directory
* @param destDir directory where to store the dockerfile
* @return the full path to the docker file
* @throws IOException if writing fails
*/
public File write(File destDir) throws IOException {
File target = new File(destDir,"Dockerfile");
FileUtils.fileWrite(target, content());
return target;
}
代码示例来源:origin: apache/maven-wagon
public void storeKnownHosts( String contents )
throws IOException
{
Set<KnownHostEntry> hosts = this.loadKnownHosts( contents );
if ( ! this.knownHosts.equals( hosts ) )
{
file.getParentFile().mkdirs();
FileUtils.fileWrite( file.getAbsolutePath(), contents );
this.knownHosts = hosts;
}
}
代码示例来源:origin: apache/maven-enforcer
@Test
public void testFileChecksumMd5UpperCase()
throws IOException, EnforcerRuleException
{
File f = temporaryFolder.newFile();
FileUtils.fileWrite( f, "message" );
rule.setFile( f );
rule.setChecksum( "78E731027D8FD50ED642340B7C9A63B3" );
rule.setType( "md5" );
rule.execute( EnforcerTestUtils.getHelper() );
}
代码示例来源:origin: apache/maven-enforcer
@Test
public void testFileChecksumSha1()
throws IOException, EnforcerRuleException
{
File f = temporaryFolder.newFile();
FileUtils.fileWrite( f, "message" );
rule.setFile( f );
rule.setChecksum( "6f9b9af3cd6e8b8a73c2cdced37fe9f59226e27d" );
rule.setType( "sha1" );
rule.execute( EnforcerTestUtils.getHelper() );
}
代码示例来源:origin: apache/maven-enforcer
@Test
public void testFileChecksumMd5()
throws IOException, EnforcerRuleException
{
File f = temporaryFolder.newFile();
FileUtils.fileWrite( f, "message" );
rule.setFile( f );
rule.setChecksum( "78e731027d8fd50ed642340b7c9a63b3" );
rule.setType( "md5" );
rule.execute( EnforcerTestUtils.getHelper() );
}
代码示例来源:origin: apache/maven-enforcer
@Test
public void testFileChecksumSha384()
throws IOException, EnforcerRuleException
{
File f = temporaryFolder.newFile();
FileUtils.fileWrite( f, "message" );
rule.setFile( f );
rule.setChecksum( "353eb7516a27ef92e96d1a319712d84b902eaa828819e53a8b09af7028103a9978ba8feb6161e33c3619c5da4c4666a5" );
rule.setType( "sha384" );
rule.execute( EnforcerTestUtils.getHelper() );
}
内容来源于网络,如有侵权,请联系作者删除!