本文整理了Java中org.apache.hadoop.fs.FileUtil.getDU()
方法的一些代码示例,展示了FileUtil.getDU()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtil.getDU()
方法的具体详情如下:
包路径:org.apache.hadoop.fs.FileUtil
类名称:FileUtil
方法名:getDU
[英]Takes an input dir and returns the du on that local directory. Very basic implementation.
[中]获取输入目录并返回该本地目录上的du。非常基本的实现。
代码示例来源:origin: org.apache.hadoop/hadoop-common
size += getDU(allFiles[i]);
代码示例来源:origin: org.jvnet.hudson.hadoop/hadoop-core
/**
* Takes an input dir and returns the du on that local directory. Very basic
* implementation.
*
* @param dir
* The input dir to get the disk space of this local dir
* @return The total disk space of the input local directory
*/
public static long getDU(File dir) {
long size = 0;
if (!dir.exists())
return 0;
if (!dir.isDirectory()) {
return dir.length();
} else {
size = dir.length();
File[] allFiles = dir.listFiles();
for (int i = 0; i < allFiles.length; i++) {
size = size + getDU(allFiles[i]);
}
return size;
}
}
代码示例来源:origin: com.facebook.hadoop/hadoop-core
/**
* Takes an input dir and returns the du on that local directory. Very basic
* implementation.
*
* @param dir
* The input dir to get the disk space of this local dir
* @return The total disk space of the input local directory
*/
public static long getDU(File dir) {
long size = 0;
if (!dir.exists())
return 0;
if (!dir.isDirectory()) {
return dir.length();
} else {
size = dir.length();
File[] allFiles = dir.listFiles();
for (int i = 0; i < allFiles.length; i++) {
size = size + getDU(allFiles[i]);
}
return size;
}
}
代码示例来源:origin: io.prestosql.hadoop/hadoop-apache
size += getDU(allFiles[i]);
代码示例来源:origin: com.github.jiayuhan-it/hadoop-common
size += getDU(allFiles[i]);
代码示例来源:origin: io.hops/hadoop-common
size += getDU(allFiles[i]);
代码示例来源:origin: ch.cern.hadoop/hadoop-common
size += getDU(allFiles[i]);
代码示例来源:origin: com.facebook.hadoop/hadoop-core
long cacheSize = FileUtil.getDU(new File(parchive.getParent().toString()));
cacheStatus.size = cacheSize;
addCacheInfoUpdate(cacheStatus);
代码示例来源:origin: org.apache.hadoop/hadoop-mapred
FileUtil.getDU(new File(parchive.getParent().toString()));
cacheStatus.size = cacheSize;
代码示例来源:origin: org.jvnet.hudson.hadoop/hadoop-core
long size = FileUtil.getDU(new File(baseDir.toString()));
代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-nodemanager
.getDU(new File(local.toUri()))));
assoc.getResource().unlock();
} catch (ExecutionException e) {
代码示例来源:origin: io.hops/hadoop-yarn-server-nodemanager
.getDU(new File(local.toUri()))));
assoc.getResource().unlock();
} catch (ExecutionException e) {
代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-nodemanager
.getDU(new File(local.toUri()))));
assoc.getResource().unlock();
} catch (ExecutionException e) {
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-nodemanager
URL.fromPath(localPath));
stat.setLocalSize(
FileUtil.getDU(new File(localPath.getParent().toUri())));
stat.setStatus(ResourceStatusType.FETCH_SUCCESS);
} catch (ExecutionException e) {
代码示例来源:origin: io.hops/hadoop-yarn-server-nodemanager
URL.fromPath(localPath));
stat.setLocalSize(
FileUtil.getDU(new File(localPath.getParent().toUri())));
stat.setStatus(ResourceStatusType.FETCH_SUCCESS);
} catch (ExecutionException e) {
代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-nodemanager
ConverterUtils.getYarnUrlFromPath(localPath));
stat.setLocalSize(
FileUtil.getDU(new File(localPath.getParent().toUri())));
stat.setStatus(ResourceStatusType.FETCH_SUCCESS);
} catch (ExecutionException e) {
代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-nodemanager
ConverterUtils.getYarnUrlFromPath(localPath));
stat.setLocalSize(
FileUtil.getDU(new File(localPath.getParent().toUri())));
stat.setStatus(ResourceStatusType.FETCH_SUCCESS);
} catch (ExecutionException e) {
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-nodemanager
LocalResourceRequest key = assoc.getResource().getRequest();
publicRsrc.handle(new ResourceLocalizedEvent(key, local, FileUtil
.getDU(new File(local.toUri()))));
assoc.getResource().unlock();
} catch (ExecutionException e) {
代码示例来源:origin: ch.cern.hadoop/hadoop-common
setupDirs();
long du = FileUtil.getDU(TEST_DIR);
long duDoesNotExist = FileUtil.getDU(doesNotExist);
assertEquals(0, duDoesNotExist);
long duNotADirectoryActual = FileUtil.getDU(notADirectory);
long duNotADirectoryExpected = 3 + System.getProperty("line.separator").length();
assertEquals(duNotADirectoryExpected, duNotADirectoryActual);
final long du3 = FileUtil.getDU(partitioned);
assertEquals(expected, du3);
final long du4 = FileUtil.getDU(partitioned);
assertEquals(0, du4);
} finally {
代码示例来源:origin: com.github.jiayuhan-it/hadoop-common
setupDirs();
long du = FileUtil.getDU(TEST_DIR);
long duDoesNotExist = FileUtil.getDU(doesNotExist);
assertEquals(0, duDoesNotExist);
long duNotADirectoryActual = FileUtil.getDU(notADirectory);
long duNotADirectoryExpected = 3 + System.getProperty("line.separator").length();
assertEquals(duNotADirectoryExpected, duNotADirectoryActual);
final long du3 = FileUtil.getDU(partitioned);
assertEquals(expected, du3);
final long du4 = FileUtil.getDU(partitioned);
assertEquals(0, du4);
} finally {
内容来源于网络,如有侵权,请联系作者删除!