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


Java FileUtil类代码示例

本文整理汇总了Java中org.ethereum.util.FileUtil的典型用法代码示例。如果您正苦于以下问题:Java FileUtil类的具体用法?Java FileUtil怎么用?Java FileUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FileUtil类属于org.ethereum.util包,在下文中一共展示了FileUtil类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: repository

import org.ethereum.util.FileUtil; //导入依赖的package包/类
@Bean
public Repository repository(RskSystemProperties config) {
    String databaseDir = config.databaseDir();
    if (config.databaseReset()){
        FileUtil.recursiveDelete(databaseDir);
        logger.info("Database reset done");
    }

    KeyValueDataSource ds = makeDataSource(config, "state");
    KeyValueDataSource detailsDS = makeDataSource(config, "details");

    return new RepositoryImpl(config, new TrieStoreImpl(ds), detailsDS);
}
 
开发者ID:rsksmart,项目名称:rskj,代码行数:14,代码来源:CommonConfig.java

示例2: cleanup

import org.ethereum.util.FileUtil; //导入依赖的package包/类
@After
public void cleanup() {
    blockQueue.close();
    FileUtil.recursiveDelete(testDb);
}
 
开发者ID:rsksmart,项目名称:rskj,代码行数:6,代码来源:BlockQueueTest.java

示例3: cleanup

import org.ethereum.util.FileUtil; //导入依赖的package包/类
@After
public void cleanup() {
    hs.close();
    FileUtil.recursiveDelete(testDb);
}
 
开发者ID:rsksmart,项目名称:rskj,代码行数:6,代码来源:HeaderStoreTest.java

示例4: cleanup

import org.ethereum.util.FileUtil; //导入依赖的package包/类
@After
public void cleanup() {
    hashStore.close();
    FileUtil.recursiveDelete(testDb);
}
 
开发者ID:rsksmart,项目名称:rskj,代码行数:6,代码来源:HashStoreTest.java

示例5: reset

import org.ethereum.util.FileUtil; //导入依赖的package包/类
public void reset() {
    close();
    FileUtil.recursiveDelete(getPath().toString());
    init();
}
 
开发者ID:Aptoide,项目名称:AppCoins-ethereumj,代码行数:6,代码来源:LevelDbDataSource.java

示例6: process

import org.ethereum.util.FileUtil; //导入依赖的package包/类
public void process(SystemProperties config) {
    if (config.databaseReset() && config.databaseResetBlock() == 0){
        FileUtil.recursiveDelete(config.databaseDir());
        putDatabaseVersion(config, config.databaseVersion());
        logger.info("Database reset done");
        System.out.println("Database reset done");
    }

    final File versionFile = getDatabaseVersionFile(config);
    final Behavior behavior = Behavior.valueOf(
            config.getProperty("database.incompatibleDatabaseBehavior", Behavior.EXIT.toString()).toUpperCase());


    // Detect database version
    final Integer expectedVersion = config.databaseVersion();
    if (isDatabaseDirectoryExists(config)) {
        final Integer actualVersionRaw = getDatabaseVersion(versionFile);
        final boolean isVersionFileNotFound = actualVersionRaw.equals(-1);
        final Integer actualVersion = isVersionFileNotFound ? 1 : actualVersionRaw;

        if (actualVersionRaw.equals(-1)) {
            putDatabaseVersion(config, actualVersion);
        }

        if (actualVersion.equals(expectedVersion) || (isVersionFileNotFound && expectedVersion.equals(1))) {
            logger.info("Database directory location: '{}', version: {}", config.databaseDir(), actualVersion);
        } else {
            logger.warn("Detected incompatible database version. Detected:{}, required:{}", actualVersion, expectedVersion);
            if (behavior == Behavior.EXIT) {
                Utils.showErrorAndExit(
                        "Incompatible database version " + actualVersion,
                        "Please remove database directory manually or set `database.incompatibleDatabaseBehavior` to `RESET`",
                        "Database directory location is " + config.databaseDir()
                );
            } else if (behavior == Behavior.RESET) {
                boolean res = FileUtil.recursiveDelete(config.databaseDir());
                if (!res) {
                    throw new RuntimeException("Couldn't delete database dir: " + config.databaseDir());
                }
                putDatabaseVersion(config, config.databaseVersion());
                logger.warn("Auto reset database directory according to flag");
            } else {
                // IGNORE
                logger.info("Continue working according to flag");
            }
        }
    } else {
        putDatabaseVersion(config, config.databaseVersion());
        logger.info("Created database version file");
    }
}
 
开发者ID:Aptoide,项目名称:AppCoins-ethereumj,代码行数:52,代码来源:Initializer.java

示例7: after

import org.ethereum.util.FileUtil; //导入依赖的package包/类
@After
public void after() {
    FileUtil.recursiveDelete(tempFile.getAbsolutePath());
}
 
开发者ID:Aptoide,项目名称:AppCoins-ethereumj,代码行数:5,代码来源:InitializerTest.java


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