本文整理汇总了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());
}