org.apache.hadoop.fs.FileUtil.fullyDeleteContents()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(174)

本文整理了Java中org.apache.hadoop.fs.FileUtil.fullyDeleteContents()方法的一些代码示例,展示了FileUtil.fullyDeleteContents()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtil.fullyDeleteContents()方法的具体详情如下:
包路径:org.apache.hadoop.fs.FileUtil
类名称:FileUtil
方法名:fullyDeleteContents

FileUtil.fullyDeleteContents介绍

[英]Delete the contents of a directory, not the directory itself. If we return false, the directory may be partially-deleted. If dir is a symlink to a directory, all the contents of the actual directory pointed to by dir will be deleted.
[中]删除目录的内容,而不是目录本身。如果返回false,则目录可能会被部分删除。如果dir是指向目录的符号链接,则dir指向的实际目录的所有内容都将被删除。

代码示例

代码示例来源:origin: org.apache.hadoop/hadoop-common

/**
 * Delete the contents of a directory, not the directory itself.  If
 * we return false, the directory may be partially-deleted.
 * If dir is a symlink to a directory, all the contents of the actual
 * directory pointed to by dir will be deleted.
 */
public static boolean fullyDeleteContents(final File dir) {
 return fullyDeleteContents(dir, false);
}

代码示例来源:origin: org.apache.hadoop/hadoop-common

if (!fullyDeleteContents(dir, tryGrantPermissions)) {
 return false;

代码示例来源:origin: io.hops/hadoop-common

/**
 * Delete the contents of a directory, not the directory itself.  If
 * we return false, the directory may be partially-deleted.
 * If dir is a symlink to a directory, all the contents of the actual
 * directory pointed to by dir will be deleted.
 */
public static boolean fullyDeleteContents(final File dir) {
 return fullyDeleteContents(dir, false);
}

代码示例来源:origin: ch.cern.hadoop/hadoop-common

/**
 * Delete the contents of a directory, not the directory itself.  If
 * we return false, the directory may be partially-deleted.
 * If dir is a symlink to a directory, all the contents of the actual
 * directory pointed to by dir will be deleted.
 */
public static boolean fullyDeleteContents(final File dir) {
 return fullyDeleteContents(dir, false);
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

/**
 * Delete the contents of a directory, not the directory itself.  If
 * we return false, the directory may be partially-deleted.
 * If dir is a symlink to a directory, all the contents of the actual
 * directory pointed to by dir will be deleted.
 */
public static boolean fullyDeleteContents(final File dir) {
 return fullyDeleteContents(dir, false);
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

/**
 * Delete the contents of a directory, not the directory itself.  If
 * we return false, the directory may be partially-deleted.
 * If dir is a symlink to a directory, all the contents of the actual
 * directory pointed to by dir will be deleted.
 */
public static boolean fullyDeleteContents(final File dir) {
 return fullyDeleteContents(dir, false);
}

代码示例来源:origin: org.apache.hadoop/hadoop-common-test

@Test
public void testFailFullyDeleteContents() throws IOException {
 LOG.info("Running test to verify failure of fullyDeleteContents()");
 setupDirsAndNonWritablePermissions();
 boolean ret = FileUtil.fullyDeleteContents(new MyFile(del));
 validateAndSetWritablePermissions(ret);
}

代码示例来源:origin: org.apache.hadoop/hadoop-common-test

@Test
public void testFullyDeleteContents() throws IOException {
 setupDirs();
 boolean ret = FileUtil.fullyDeleteContents(del);
 Assert.assertTrue(ret);
 Assert.assertTrue(del.exists());
 Assert.assertEquals(0, del.listFiles().length);
 validateTmpDir();
}

代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs

@Before
public void cleanupTestDir() throws IOException {
 assertTrue(TEST_DIR.exists() || TEST_DIR.mkdirs());
 FileUtil.fullyDeleteContents(TEST_DIR);
}

代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs

@Before
public void setUp() {
 FileUtil.fullyDeleteContents(new File(MiniDFSCluster.getBaseDirectory()));
 faultInjector = Mockito.mock(CheckpointFaultInjector.class);
 CheckpointFaultInjector.instance = faultInjector;
}

代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs

@After
public void cleanUp() {
 FileUtil.fullyDeleteContents(new File(MiniDFSCluster.getBaseDirectory()));
}

代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs

@After
public void cleanUp() {
 FileUtil.fullyDeleteContents(new File(MiniDFSCluster.getBaseDirectory()));
}

代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs

@After
public void cleanUp() {
 FileUtil.fullyDeleteContents(new File(MiniDFSCluster.getBaseDirectory()));
}

代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs

@Before
public void setUp() {
 FileUtil.fullyDeleteContents(new File(MiniDFSCluster.getBaseDirectory()));
}

代码示例来源:origin: ch.cern.hadoop/hadoop-common

@Test (timeout = 30000)
public void testFailFullyDeleteContents() throws IOException {
 if(Shell.WINDOWS) {
  // windows Dir.setWritable(false) does not work for directories
  return;
 }
 LOG.info("Running test to verify failure of fullyDeleteContents()");
 setupDirsAndNonWritablePermissions();
 boolean ret = FileUtil.fullyDeleteContents(new MyFile(del));
 validateAndSetWritablePermissions(true, ret);
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

@Test (timeout = 30000)
public void testFailFullyDeleteContents() throws IOException {
 if(Shell.WINDOWS) {
  // windows Dir.setWritable(false) does not work for directories
  return;
 }
 LOG.info("Running test to verify failure of fullyDeleteContents()");
 setupDirsAndNonWritablePermissions();
 boolean ret = FileUtil.fullyDeleteContents(new MyFile(del));
 validateAndSetWritablePermissions(true, ret);
}

代码示例来源:origin: ch.cern.hadoop/hadoop-common

@Test (timeout = 30000)
public void testFullyDeleteContents() throws IOException {
 setupDirs();
 boolean ret = FileUtil.fullyDeleteContents(del);
 Assert.assertTrue(ret);
 Assert.assertTrue(del.exists());
 Assert.assertEquals(0, del.listFiles().length);
 validateTmpDir();
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

@Test (timeout = 30000)
public void testFullyDeleteContents() throws IOException {
 setupDirs();
 boolean ret = FileUtil.fullyDeleteContents(del);
 Assert.assertTrue(ret);
 Assert.assertTrue(del.exists());
 Assert.assertEquals(0, del.listFiles().length);
 validateTmpDir();
}

代码示例来源:origin: ch.cern.hadoop/hadoop-common

@Test (timeout = 30000)
public void testFailFullyDeleteContentsGrantPermissions() throws IOException {
 setupDirsAndNonWritablePermissions();
 boolean ret = FileUtil.fullyDeleteContents(new MyFile(del), true);
 // this time the directories with revoked permissions *should* be deleted:
 validateAndSetWritablePermissions(false, ret);
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

@Test (timeout = 30000)
public void testFailFullyDeleteContentsGrantPermissions() throws IOException {
 setupDirsAndNonWritablePermissions();
 boolean ret = FileUtil.fullyDeleteContents(new MyFile(del), true);
 // this time the directories with revoked permissions *should* be deleted:
 validateAndSetWritablePermissions(false, ret);
}

相关文章