本文整理匯總了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);
}