本文整理了Java中com.thinkaurelius.titan.util.system.IOUtils
类的一些代码示例,展示了IOUtils
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IOUtils
类的具体详情如下:
包路径:com.thinkaurelius.titan.util.system.IOUtils
类名称:IOUtils
[英]IO Utility class
[中]IO实用程序类
代码示例来源:origin: thinkaurelius/titan
@Override
public void close() {
IOUtils.closeQuietly(table);
isClosed = true;
logger.debug("RowIterator closed table {}", table);
}
代码示例来源:origin: thinkaurelius/titan
public static final void deleteHomeDir(String subdir) {
File homeDirFile = getHomeDirFile(subdir);
// Make directory if it doesn't exist
if (!homeDirFile.exists())
homeDirFile.mkdirs();
boolean success = IOUtils.deleteFromDirectory(homeDirFile);
if (!success) throw new IllegalStateException("Could not remove " + homeDirFile);
}
代码示例来源:origin: thinkaurelius/titan
static public boolean deleteFromDirectory(File path) {
return deleteDirectory(path, false);
}
代码示例来源:origin: thinkaurelius/titan
@Override
public void close() {
openStores.clear();
if (logger.isTraceEnabled())
openManagers.remove(this);
IOUtils.closeQuietly(cnx);
}
代码示例来源:origin: thinkaurelius/titan
@Override
public void clearStorage() throws BackendException {
if (!stores.isEmpty())
throw new IllegalStateException("Cannot delete store, since database is open: " + stores.keySet().toString());
Transaction tx = null;
for (String db : environment.getDatabaseNames()) {
environment.removeDatabase(tx, db);
log.debug("Removed database {} (clearStorage)", db);
}
close();
IOUtils.deleteFromDirectory(directory);
}
代码示例来源:origin: thinkaurelius/titan
static public boolean deleteDirectory(File path, boolean includeDir) {
boolean success = true;
if (path.exists()) {
File[] files = path.listFiles();
for (int i = 0; i < files.length; i++) {
if (files[i].isDirectory()) {
success = deleteDirectory(files[i], true) && success;
} else {
success = files[i].delete() && success;
}
}
}
if (includeDir) success = path.delete() && success;
return success;
}
代码示例来源:origin: thinkaurelius/titan
public static ScanMetrics cassandraRepair(String titanPropertiesPath, String indexName, String relationType, String partitionerName)
throws InterruptedException, IOException, ClassNotFoundException {
Properties p = new Properties();
FileInputStream fis = null;
try {
fis = new FileInputStream(titanPropertiesPath);
p.load(fis);
return cassandraRepair(p, indexName, relationType, partitionerName);
} finally {
IOUtils.closeQuietly(fis);
}
}
代码示例来源:origin: com.thinkaurelius.titan/titan-test-jre6
public static final void deleteHomeDir(String subdir) {
File homeDirFile = getHomeDirFile(subdir);
// Make directory if it doesn't exist
if (!homeDirFile.exists())
homeDirFile.mkdirs();
boolean success = IOUtils.deleteFromDirectory(homeDirFile);
if (!success) throw new IllegalStateException("Could not remove " + homeDirFile);
}
代码示例来源:origin: thinkaurelius/titan
@BeforeClass
public static void killElasticsearch() {
IOUtils.deleteDirectory(new File("es"), true);
ElasticsearchRunner esr = new ElasticsearchRunner();
esr.stop();
}
代码示例来源:origin: thinkaurelius/titan
public static ScanMetrics hbaseRemove(String titanPropertiesPath, String indexName, String relationType)
throws InterruptedException, IOException, ClassNotFoundException {
Properties p = new Properties();
FileInputStream fis = null;
try {
fis = new FileInputStream(titanPropertiesPath);
p.load(fis);
return hbaseRemove(p, indexName, relationType);
} finally {
IOUtils.closeQuietly(fis);
}
}
代码示例来源:origin: org.hawkular.titan/titan-test
public static final void deleteHomeDir(String subdir) {
File homeDirFile = getHomeDirFile(subdir);
// Make directory if it doesn't exist
if (!homeDirFile.exists())
homeDirFile.mkdirs();
boolean success = IOUtils.deleteFromDirectory(homeDirFile);
if (!success) throw new IllegalStateException("Could not remove " + homeDirFile);
}
代码示例来源:origin: thinkaurelius/titan
/**
* Test {@link com.thinkaurelius.titan.example.GraphOfTheGodsFactory#create(String)}.
*/
@Test
public void testGraphOfTheGodsFactoryCreate() {
File bdbtmp = new File("target/gotgfactory");
IOUtils.deleteDirectory(bdbtmp, true);
TitanGraph gotg = GraphOfTheGodsFactory.create(bdbtmp.getPath());
TitanIndexTest.assertGraphOfTheGods(gotg);
gotg.close();
}
}
代码示例来源:origin: thinkaurelius/titan
public static ScanMetrics hbaseRepair(String titanPropertiesPath, String indexName, String relationType)
throws InterruptedException, IOException, ClassNotFoundException {
Properties p = new Properties();
FileInputStream fis = null;
try {
fis = new FileInputStream(titanPropertiesPath);
p.load(fis);
return hbaseRepair(p, indexName, relationType);
} finally {
IOUtils.closeQuietly(fis);
}
}
代码示例来源:origin: com.thinkaurelius.titan/titan-berkeleyje
@Override
public void clearStorage() throws BackendException {
if (!stores.isEmpty())
throw new IllegalStateException("Cannot delete store, since database is open: " + stores.keySet().toString());
Transaction tx = null;
for (String db : environment.getDatabaseNames()) {
environment.removeDatabase(tx, db);
log.debug("Removed database {} (clearStorage)", db);
}
close();
IOUtils.deleteFromDirectory(directory);
}
代码示例来源:origin: com.thinkaurelius.titan/titan-core
static public boolean deleteFromDirectory(File path) {
return deleteDirectory(path, false);
}
代码示例来源:origin: thinkaurelius/titan
@Override
public synchronized void close() throws BackendException {
/* Copying the map is necessary to avoid ConcurrentModificationException.
* The path to ConcurrentModificationException in the absence of a copy is
* log.close() -> manager.closedLog(log) -> openLogs.remove(log.getName()).
*/
for (KCVSLog log : ImmutableMap.copyOf(openLogs).values()) log.close();
IOUtils.closeQuietly(serializer);
}
代码示例来源:origin: com.thinkaurelius.titan/titan-berkeleyje-jre6
@Override
public void clearStorage() throws StorageException {
if (!stores.isEmpty())
throw new IllegalStateException("Cannot delete store, since database is open: " + stores.keySet().toString());
Transaction tx = null;
for (String db : environment.getDatabaseNames()) {
environment.removeDatabase(tx, db);
}
close();
IOUtils.deleteFromDirectory(directory);
}
代码示例来源:origin: org.hawkular.titan/titan-core
static public boolean deleteFromDirectory(File path) {
return deleteDirectory(path, false);
}
代码示例来源:origin: thinkaurelius/titan
public static ScanMetrics cassandraRemove(String titanPropertiesPath, String indexName, String relationType, String partitionerName)
throws InterruptedException, IOException, ClassNotFoundException {
Properties p = new Properties();
FileInputStream fis = null;
try {
fis = new FileInputStream(titanPropertiesPath);
p.load(fis);
return cassandraRemove(p, indexName, relationType, partitionerName);
} finally {
IOUtils.closeQuietly(fis);
}
}
代码示例来源:origin: com.thinkaurelius.titan/titan-persistit
@Override
public void clearStorage() throws StorageException {
for (String key : stores.keySet()) {
PersistitKeyValueStore store = stores.remove(key);
store.clear();
}
Volume volume;
String[] treeNames;
try {
volume = db.getVolume(VOLUME_NAME);
treeNames = volume.getTreeNames();
} catch (PersistitException ex) {
throw new PermanentStorageException(ex);
}
for (String treeName : treeNames) {
try {
Exchange ex = new Exchange(db, volume, treeName, false);
ex.removeTree();
} catch (PersistitException ex) {
throw new PermanentStorageException(ex);
}
}
close();
IOUtils.deleteFromDirectory(directory);
}
内容来源于网络,如有侵权,请联系作者删除!