本文整理了Java中org.apache.commons.io.FileUtils.sizeOfDirectoryBig0()
方法的一些代码示例,展示了FileUtils.sizeOfDirectoryBig0()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.sizeOfDirectoryBig0()
方法的具体详情如下:
包路径:org.apache.commons.io.FileUtils
类名称:FileUtils
方法名:sizeOfDirectoryBig0
[英]Finds the size of a directory
[中]查找目录的大小
代码示例来源:origin: commons-io/commons-io
/**
* Returns the size of a file
* @param fileOrDir The file
* @return the size
*/
private static BigInteger sizeOfBig0(final File fileOrDir) {
if (fileOrDir.isDirectory()) {
return sizeOfDirectoryBig0(fileOrDir);
} else {
return BigInteger.valueOf(fileOrDir.length());
}
}
代码示例来源:origin: commons-io/commons-io
/**
* Counts the size of a directory recursively (sum of the length of all files).
*
* @param directory directory to inspect, must not be {@code null}
* @return size of directory in bytes, 0 if directory is security restricted.
* @throws NullPointerException if the directory is {@code null}
* @since 2.4
*/
public static BigInteger sizeOfDirectoryAsBigInteger(final File directory) {
checkDirectory(directory);
return sizeOfDirectoryBig0(directory);
}
代码示例来源:origin: commons-io/commons-io
/**
* Returns the size of the specified file or directory. If the provided
* {@link File} is a regular file, then the file's length is returned.
* If the argument is a directory, then the size of the directory is
* calculated recursively. If a directory or subdirectory is security
* restricted, its size will not be included.
*
* @param file the regular file or directory to return the size
* of (must not be {@code null}).
*
* @return the length of the file, or recursive size of the directory,
* provided (in bytes).
*
* @throws NullPointerException if the file is {@code null}
* @throws IllegalArgumentException if the file does not exist.
*
* @since 2.4
*/
public static BigInteger sizeOfAsBigInteger(final File file) {
if (!file.exists()) {
final String message = file + " does not exist";
throw new IllegalArgumentException(message);
}
if (file.isDirectory()) {
return sizeOfDirectoryBig0(file); // internal method
} else {
return BigInteger.valueOf(file.length());
}
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
/**
* Returns the size of a file
* @param fileOrDir The file
* @return the size
*/
private static BigInteger sizeOfBig0(final File fileOrDir) {
if (fileOrDir.isDirectory()) {
return sizeOfDirectoryBig0(fileOrDir);
} else {
return BigInteger.valueOf(fileOrDir.length());
}
}
代码示例来源:origin: io.github.stephenc.docker/docker-client-shaded
/**
* Returns the sid of a file
* @param fileOrDir The file
* @return the size
*/
private static BigInteger sizeOfBig0(final File fileOrDir) {
if (fileOrDir.isDirectory()) {
return sizeOfDirectoryBig0(fileOrDir);
} else {
return BigInteger.valueOf(fileOrDir.length());
}
}
代码示例来源:origin: io.github.stephenc.docker/docker-client-shaded
/**
* Counts the size of a directory recursively (sum of the length of all files).
*
* @param directory directory to inspect, must not be {@code null}
* @return size of directory in bytes, 0 if directory is security restricted.
* @throws NullPointerException if the directory is {@code null}
* @since 2.4
*/
public static BigInteger sizeOfDirectoryAsBigInteger(final File directory) {
checkDirectory(directory);
return sizeOfDirectoryBig0(directory);
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
/**
* Counts the size of a directory recursively (sum of the length of all files).
*
* @param directory directory to inspect, must not be {@code null}
* @return size of directory in bytes, 0 if directory is security restricted.
* @throws NullPointerException if the directory is {@code null}
* @since 2.4
*/
public static BigInteger sizeOfDirectoryAsBigInteger(final File directory) {
checkDirectory(directory);
return sizeOfDirectoryBig0(directory);
}
代码示例来源:origin: io.github.stephenc.docker/docker-client-shaded
/**
* Returns the size of the specified file or directory. If the provided
* {@link File} is a regular file, then the file's length is returned.
* If the argument is a directory, then the size of the directory is
* calculated recursively. If a directory or subdirectory is security
* restricted, its size will not be included.
*
* @param file the regular file or directory to return the size
* of (must not be {@code null}).
*
* @return the length of the file, or recursive size of the directory,
* provided (in bytes).
*
* @throws NullPointerException if the file is {@code null}
* @throws IllegalArgumentException if the file does not exist.
*
* @since 2.4
*/
public static BigInteger sizeOfAsBigInteger(final File file) {
if (!file.exists()) {
final String message = file + " does not exist";
throw new IllegalArgumentException(message);
}
if (file.isDirectory()) {
return sizeOfDirectoryBig0(file); // internal method
} else {
return BigInteger.valueOf(file.length());
}
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
/**
* Returns the size of the specified file or directory. If the provided
* {@link File} is a regular file, then the file's length is returned.
* If the argument is a directory, then the size of the directory is
* calculated recursively. If a directory or subdirectory is security
* restricted, its size will not be included.
*
* @param file the regular file or directory to return the size
* of (must not be {@code null}).
*
* @return the length of the file, or recursive size of the directory,
* provided (in bytes).
*
* @throws NullPointerException if the file is {@code null}
* @throws IllegalArgumentException if the file does not exist.
*
* @since 2.4
*/
public static BigInteger sizeOfAsBigInteger(final File file) {
if (!file.exists()) {
final String message = file + " does not exist";
throw new IllegalArgumentException(message);
}
if (file.isDirectory()) {
return sizeOfDirectoryBig0(file); // internal method
} else {
return BigInteger.valueOf(file.length());
}
}
内容来源于网络,如有侵权,请联系作者删除!