/** * 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()); } }
/** * 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); }
/** * 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()); } }
/** * 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()); } }
/** * 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()); } }
/** * 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); }
/** * 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); }
/** * 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()); } }
/** * 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()); } }