本文整理了Java中org.codehaus.plexus.util.FileUtils.fileAppend()
方法的一些代码示例,展示了FileUtils.fileAppend()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.fileAppend()
方法的具体详情如下:
包路径:org.codehaus.plexus.util.FileUtils
类名称:FileUtils
方法名:fileAppend
[英]Appends 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
/**
* Appends 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 fileAppend( String fileName, String data )
throws IOException
{
fileAppend( fileName, null, data );
}
代码示例来源:origin: org.apache.servicemix.kernel.gshell/org.apache.servicemix.kernel.gshell.core
/**
* Appends 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 fileAppend( String fileName, String data )
throws IOException
{
fileAppend( fileName, null, data);
}
代码示例来源:origin: de.saumya.mojo/gem-maven-plugin
private String message(String text) {
if (outputFile != null){
try {
FileUtils.fileAppend(outputFile.getPath(), text + "\n");
} catch (IOException e) {
throw new RuntimeException("error writing text to output-file: " + text, e);
}
}
return text;
}
代码示例来源:origin: torquebox/jruby-maven-plugins
private String message(String text) {
if (outputFile != null){
try {
FileUtils.fileAppend(outputFile.getPath(), text + "\n");
} catch (IOException e) {
throw new RuntimeException("error writing text to output-file: " + text, e);
}
}
return text;
}
代码示例来源:origin: jenkinsci/scm-sync-configuration-plugin
private static void appendFile(File f, String data) {
try {
FileUtils.fileAppend(f.getAbsolutePath(), data);
}
catch(IOException e) {
LOGGER.severe("Unable to write file " + f.getAbsolutePath() + " : " + e.getMessage());
}
}
代码示例来源:origin: org.apache.maven.wagon/wagon-ssh-common
public void addKnownHost( KnownHostEntry knownHostEntry )
throws IOException
{
if ( !this.knownHosts.contains( knownHostEntry ) )
{
String knownHost = knownHostEntry.getHostName() + " " + knownHostEntry.getKeyType() + " "
+ knownHostEntry.getKeyValue() + "\n";
FileUtils.fileAppend( file.getAbsolutePath(), knownHost );
}
}
代码示例来源:origin: com.paypal.butterfly/butterfly-utilities
private TOExecutionResult addProperty(File transformedAppFolder, TransformationContext transformationContext) {
File fileToBeChanged = getAbsoluteFile(transformedAppFolder, transformationContext);
TOExecutionResult result;
try {
String[] propArray = {propertyName, propertyValue};
String propertyKeyValue = "%s = %s";
String propertyToBeAdded = String.format(propertyKeyValue, propArray);
FileUtils.fileAppend(fileToBeChanged.getAbsolutePath(), EolHelper.findEolDefaultToOs(fileToBeChanged));
FileUtils.fileAppend(fileToBeChanged.getAbsolutePath(), propertyToBeAdded);
String details = String.format("Property '%s' has been added and set to '%s' at '%s'", propertyName, propertyValue, getRelativePath());
result = TOExecutionResult.success(this, details);
} catch (IOException e) {
result = TOExecutionResult.error(this, e);
}
return result;
}
代码示例来源:origin: apache/maven-wagon
public void addKnownHost( KnownHostEntry knownHostEntry )
throws IOException
{
if ( !this.knownHosts.contains( knownHostEntry ) )
{
String knownHost = knownHostEntry.getHostName() + " " + knownHostEntry.getKeyType() + " "
+ knownHostEntry.getKeyValue() + "\n";
FileUtils.fileAppend( file.getAbsolutePath(), knownHost );
}
}
代码示例来源:origin: mojohaus/versions-maven-plugin
protected void logLine( boolean error, String line )
{
if ( logOutput )
{
if ( error )
{
getLog().error( line );
}
else
{
getLog().info( line );
}
}
if ( outputFile != null && !outputFileError )
{
try
{
FileUtils.fileAppend( outputFile.getAbsolutePath(), outputEncoding,
error ? "> " + line + System.getProperty( "line.separator" )
: line + System.getProperty( "line.separator" ) );
}
catch ( IOException e )
{
getLog().error( "Cannot send output to " + outputFile, e );
outputFileError = true;
}
}
}
代码示例来源:origin: org.codehaus.mojo/versions-maven-plugin
protected void logLine( boolean error, String line )
{
if ( logOutput )
{
if ( error )
{
getLog().error( line );
}
else
{
getLog().info( line );
}
}
if ( outputFile != null && !outputFileError )
{
try
{
FileUtils.fileAppend( outputFile.getAbsolutePath(), outputEncoding,
error ? "> " + line + System.getProperty( "line.separator" )
: line + System.getProperty( "line.separator" ) );
}
catch ( IOException e )
{
getLog().error( "Cannot send output to " + outputFile, e );
outputFileError = true;
}
}
}
代码示例来源:origin: com.paypal.butterfly/butterfly-utilities
@Override
protected TOExecutionResult execution(File transformedAppFolder, TransformationContext transformationContext) {
File fileToBeModified = getAbsoluteFile(transformedAppFolder, transformationContext);
if (!fileToBeModified.exists()) {
// TODO Should this be done as pre-validation?
FileNotFoundException ex = new FileNotFoundException("File to be modified has not been found");
return TOExecutionResult.error(this, ex);
}
TOExecutionResult result = null;
try {
FileUtils.fileAppend(fileToBeModified.getAbsolutePath(), EolHelper.findEolDefaultToOs(fileToBeModified));
FileUtils.fileAppend(fileToBeModified.getAbsolutePath(), newLine);
String details = "A new line has been added to file " + getRelativePath(transformedAppFolder, fileToBeModified);
result = TOExecutionResult.success(this, details);
} catch (IOException e) {
result = TOExecutionResult.error(this, e);
}
return result;
}
代码示例来源:origin: org.apache.npanday/dotnet-executable
FileUtils.fileAppend(responseFilePath, escapeCmdParams(command) + " ");
内容来源于网络,如有侵权,请联系作者删除!