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