本文整理汇总了Java中org.codehaus.plexus.util.FileUtils.copyURLToFile方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtils.copyURLToFile方法的具体用法?Java FileUtils.copyURLToFile怎么用?Java FileUtils.copyURLToFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.codehaus.plexus.util.FileUtils
的用法示例。
在下文中一共展示了FileUtils.copyURLToFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
private void init(final String srcFilename, final File archive, final File destDir) throws IOException {
if (destDir.exists()) {
FileUtils.deleteDirectory(destDir);
}
destDir.mkdir();
final URL srcUrl = Utils4J.url("classpath:" + srcFilename);
FileUtils.copyURLToFile(srcUrl, archive);
LOG.info("archive: {}", archive);
LOG.info("destDir: {}", destDir);
}
示例2: createCassandraHome
import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
/**
* Creates the cassandra home directory.
*
* @param cassandraDir the cassandra home directory.
* @throws IOException if something goes wrong.
*/
protected void createCassandraHome( File cassandraDir, String listenAddress, String rpcAddress,
BigInteger initialToken, String[] seeds )
throws IOException
{
File bin = new File( cassandraDir, "bin" );
File conf = new File( cassandraDir, "conf" );
File data = new File( cassandraDir, "data" );
File commitlog = new File( cassandraDir, "commitlog" );
File savedCaches = new File( cassandraDir, "saved_caches" );
for ( File dir : Arrays.asList( cassandraDir, bin, conf, data, commitlog, savedCaches ) )
{
if ( dir.isFile() )
{
getLog().debug( "Deleting file " + dir + " as we need to create a directory with the same name." );
if ( !dir.delete() )
{
getLog().warn( "Could not delete file " + dir );
}
}
if ( !dir.isDirectory() )
{
getLog().debug( "Creating directory " + dir + " as it does not exist." );
if ( !dir.mkdirs() )
{
getLog().warn( "Could not create directory " + dir );
}
}
}
File cassandraYaml = new File( conf, "cassandra.yaml" );
if ( Utils.shouldGenerateResource( project, cassandraYaml ) )
{
getLog().debug( ( cassandraYaml.isFile() ? "Updating " : "Creating " ) + cassandraYaml );
createCassandraYaml( cassandraYaml, data, commitlog, savedCaches, listenAddress, rpcAddress, initialToken,
seeds );
}
File log4jServerConfig = new File( conf, "log4j-server.xml" );
if ( Utils.shouldGenerateResource( project, log4jServerConfig ) )
{
getLog().debug( ( log4jServerConfig.isFile() ? "Updating " : "Creating " ) + log4jServerConfig );
FileUtils.copyURLToFile( getClass().getResource("/log4j2.xml"), log4jServerConfig );
}
File log4jClientConfig = new File( conf, "log4j-client.xml" );
if ( Utils.shouldGenerateResource( project, log4jClientConfig ) )
{
getLog().debug( ( log4jClientConfig.isFile() ? "Updating " : "Creating " ) + log4jClientConfig );
FileUtils.copyURLToFile( getClass().getResource("/log4j2.xml"), log4jClientConfig );
}
File cassandraJar = new File( bin, "cassandra.jar" );
if ( Utils.shouldGenerateResource( project, cassandraJar ) )
{
getLog().debug( ( cassandraJar.isFile() ? "Updating " : "Creating " ) + cassandraJar );
createCassandraJar( cassandraJar, CassandraMonitor.class.getName(), cassandraDir );
}
/*
File nodetoolJar = new File( bin, "nodetool.jar" );
if ( Utils.shouldGenerateResource( project, nodetoolJar ) )
{
getLog().debug( ( nodetoolJar.isFile() ? "Updating " : "Creating " ) + nodetoolJar );
createCassandraJar( nodetoolJar, NodeCmd.class.getName(), cassandraDir );
}
*/
}