当前位置: 首页>>代码示例>>Java>>正文


Java FileUtils.copyURLToFile方法代码示例

本文整理汇总了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);
}
 
开发者ID:fuinorg,项目名称:event-store-maven-plugin,代码行数:11,代码来源:EventStoreDownloadMojoTest.java

示例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 );
    }
    */
}
 
开发者ID:mojohaus,项目名称:cassandra-maven-plugin,代码行数:69,代码来源:AbstractCassandraMojo.java


注:本文中的org.codehaus.plexus.util.FileUtils.copyURLToFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。