當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。