本文整理汇总了Java中org.apache.hadoop.fs.FileUtil.fullyDeleteContents方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtil.fullyDeleteContents方法的具体用法?Java FileUtil.fullyDeleteContents怎么用?Java FileUtil.fullyDeleteContents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.fs.FileUtil
的用法示例。
在下文中一共展示了FileUtil.fullyDeleteContents方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createStandaloneEditLog
import org.apache.hadoop.fs.FileUtil; //导入方法依赖的package包/类
/**
* Return a standalone instance of FSEditLog that will log into the given
* log directory. The returned instance is not yet opened.
*/
public static FSEditLog createStandaloneEditLog(File logDir)
throws IOException {
assertTrue(logDir.mkdirs() || logDir.exists());
if (!FileUtil.fullyDeleteContents(logDir)) {
throw new IOException("Unable to delete contents of " + logDir);
}
NNStorage storage = Mockito.mock(NNStorage.class);
StorageDirectory sd
= FSImageTestUtil.mockStorageDirectory(logDir, NameNodeDirType.EDITS);
List<StorageDirectory> sds = Lists.newArrayList(sd);
Mockito.doReturn(sds).when(storage).dirIterable(NameNodeDirType.EDITS);
Mockito.doReturn(sd).when(storage)
.getStorageDirectory(Matchers.<URI>anyObject());
FSEditLog editLog = new FSEditLog(new Configuration(),
storage,
ImmutableList.of(logDir.toURI()));
editLog.initJournalsForWrite();
return editLog;
}
示例2: cleanUp
import org.apache.hadoop.fs.FileUtil; //导入方法依赖的package包/类
@After
public void cleanUp() {
FileUtil.fullyDeleteContents(new File(MiniDFSCluster.getBaseDirectory()));
}
示例3: setUp
import org.apache.hadoop.fs.FileUtil; //导入方法依赖的package包/类
@Before
public void setUp() {
FileUtil.fullyDeleteContents(new File(MiniDFSCluster.getBaseDirectory()));
faultInjector = Mockito.mock(CheckpointFaultInjector.class);
CheckpointFaultInjector.instance = faultInjector;
}
示例4: setUp
import org.apache.hadoop.fs.FileUtil; //导入方法依赖的package包/类
@Before
public void setUp() {
FileUtil.fullyDeleteContents(new File(MiniDFSCluster.getBaseDirectory()));
}
示例5: cleanupTestDir
import org.apache.hadoop.fs.FileUtil; //导入方法依赖的package包/类
@Before
public void cleanupTestDir() throws IOException {
assertTrue(TEST_DIR.exists() || TEST_DIR.mkdirs());
FileUtil.fullyDeleteContents(TEST_DIR);
}