本文整理匯總了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);
}
示例2: cleanup
import org.ethereum.util.FileUtil; //導入依賴的package包/類
@After
public void cleanup() {
blockQueue.close();
FileUtil.recursiveDelete(testDb);
}
示例3: cleanup
import org.ethereum.util.FileUtil; //導入依賴的package包/類
@After
public void cleanup() {
hs.close();
FileUtil.recursiveDelete(testDb);
}
示例4: cleanup
import org.ethereum.util.FileUtil; //導入依賴的package包/類
@After
public void cleanup() {
hashStore.close();
FileUtil.recursiveDelete(testDb);
}
示例5: reset
import org.ethereum.util.FileUtil; //導入依賴的package包/類
public void reset() {
close();
FileUtil.recursiveDelete(getPath().toString());
init();
}
示例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");
}
}
示例7: after
import org.ethereum.util.FileUtil; //導入依賴的package包/類
@After
public void after() {
FileUtil.recursiveDelete(tempFile.getAbsolutePath());
}