@@ -1088,12 +1088,13 @@ public static void copyURLToFile(final URL source, final File destination, final
10881088 }
10891089
10901090 /**
1091- * Creates all parent directories for a File object.
1091+ * Creates all parent directories for a File object, including any necessary but nonexistent
1092+ * parent directories. If a directory already exists, nothing happens; null input is a noop.
10921093 *
10931094 * @param file the File that may need parents, may be null.
10941095 * @return The parent directory, or {@code null} if the given file does not name a parent
10951096 * @throws IOException if the directory was not created along with all its parent directories.
1096- * @throws IOException if the given file object is not null and not a directory .
1097+ * @throws SecurityException See {@link File#mkdirs()} .
10971098 * @since 2.9.0
10981099 */
10991100 public static File createParentDirectories (final File file ) throws IOException {
@@ -1279,7 +1280,8 @@ public static boolean directoryContains(final File directory, final File child)
12791280 }
12801281
12811282 /**
1282- * Internal copy directory method.
1283+ * Internal copy directory method. Creates all destination parent directories,
1284+ * including any necessary but nonexistent parent directories.
12831285 *
12841286 * @param srcDir the validated source directory, must not be {@code null}.
12851287 * @param destDir the validated destination directory, must not be {@code null}.
@@ -1288,7 +1290,7 @@ public static boolean directoryContains(final File directory, final File child)
12881290 * @param preserveDirDate preserve the directories last modified dates.
12891291 * @param copyOptions options specifying how the copy should be done, see {@link StandardCopyOption}.
12901292 * @throws IOException if the directory was not created along with all its parent directories.
1291- * @throws IOException if the given file object is not a directory .
1293+ * @throws SecurityException See {@link File#mkdirs()} .
12921294 */
12931295 private static void doCopyDirectory (final File srcDir , final File destDir , final FileFilter fileFilter , final List <String > exclusionList ,
12941296 final boolean preserveDirDate , final CopyOption ... copyOptions ) throws IOException {
@@ -1363,10 +1365,10 @@ public static void forceDeleteOnExit(final File file) throws IOException {
13631365
13641366 /**
13651367 * Makes a directory, including any necessary but nonexistent parent
1366- * directories. If a file already exists with specified name but it is
1367- * not a directory then an IOException is thrown.
1368+ * directories. If a file already exists with the specified name but it is
1369+ * not a directory then an {@link IOException} is thrown.
13681370 * If the directory cannot be created (or the file already exists but is not a directory)
1369- * then an IOException is thrown.
1371+ * then an {@link IOException} is thrown.
13701372 *
13711373 * @param directory directory to create, may be {@code null}.
13721374 * @throws IOException if the directory was not created along with all its parent directories.
@@ -1430,10 +1432,10 @@ public static File getFile(final String... names) {
14301432 }
14311433
14321434 /**
1433- * Gets the parent of the given file. The given file may be bull and a file's parent may as well be null.
1435+ * Gets the parent of the given file. The given file may be null. Note that a file's parent may be null as well .
14341436 *
1435- * @param file The file to query.
1436- * @return The parent file or {@code null}.
1437+ * @param file The file to query, may be null .
1438+ * @return The parent file or {@code null}. Note that a file's parent may be null as well.
14371439 */
14381440 private static File getParentFile (final File file ) {
14391441 return file == null ? null : file .getParentFile ();
@@ -2262,9 +2264,13 @@ public static Collection<File> listFilesAndDirs(final File directory, final IOFi
22622264
22632265 /**
22642266 * Calls {@link File#mkdirs()} and throws an exception on failure.
2267+ * <p>
2268+ * Creates all directories for a File object, including any necessary but nonexistent
2269+ * parent directories. If a directory already exists, nothing happens; null input is a noop.
2270+ * </p>
22652271 *
2266- * @param directory the receiver for {@code mkdirs()}, may be null.
2267- * @return the given file, may be null .
2272+ * @param directory the receiver for {@code mkdirs()}, passing null is a noop .
2273+ * @return the given directory .
22682274 * @throws IOException if the directory was not created along with all its parent directories.
22692275 * @throws IOException if the given file object is not a directory.
22702276 * @throws SecurityException See {@link File#mkdirs()}.
@@ -2309,7 +2315,8 @@ public static void moveDirectory(final File srcDir, final File destDir) throws I
23092315 }
23102316
23112317 /**
2312- * Moves a directory to another directory.
2318+ * Moves a directory to another directory. Creates all destination parent directories,
2319+ * including any necessary but nonexistent parent directories, if enabled.
23132320 *
23142321 * @param source the file to be moved.
23152322 * @param destDir the destination file.
@@ -2318,7 +2325,9 @@ public static void moveDirectory(final File srcDir, final File destDir) throws I
23182325 * @throws NullPointerException if any of the given {@link File}s are {@code null}.
23192326 * @throws IllegalArgumentException if the source or destination is invalid.
23202327 * @throws FileNotFoundException if the source does not exist.
2328+ * @throws IOException if the directory was not created along with all its parent directories, if enabled.
23212329 * @throws IOException if an error occurs or setting the last-modified time didn't succeed.
2330+ * @throws SecurityException See {@link File#mkdirs()}.
23222331 * @since 1.4
23232332 */
23242333 public static void moveDirectoryToDirectory (final File source , final File destDir , final boolean createDestDir ) throws IOException {
@@ -2389,7 +2398,8 @@ public static void moveFile(final File srcFile, final File destFile, final CopyO
23892398 }
23902399
23912400 /**
2392- * Moves a file to a directory.
2401+ * Moves a file to a directory. Creates all destination parent directories,
2402+ * including any necessary but nonexistent parent directories, if enabled.
23932403 *
23942404 * @param srcFile the file to be moved.
23952405 * @param destDir the destination file.
@@ -2399,7 +2409,9 @@ public static void moveFile(final File srcFile, final File destFile, final CopyO
23992409 * @throws FileExistsException if the destination file exists.
24002410 * @throws FileNotFoundException if the source file does not exist.
24012411 * @throws IOException if source or destination is invalid.
2412+ * @throws IOException if the directory was not created along with all its parent directories, if enabled.
24022413 * @throws IOException if an error occurs or setting the last-modified time didn't succeed.
2414+ * @throws SecurityException See {@link File#mkdirs()}.
24032415 * @since 1.4
24042416 */
24052417 public static void moveFileToDirectory (final File srcFile , final File destDir , final boolean createDestDir ) throws IOException {
@@ -3096,6 +3108,7 @@ public static URL[] toURLs(final File... files) throws IOException {
30963108 *
30973109 * @param source the file or directory to be moved.
30983110 * @param destination the destination file or directory.
3111+ * @throws NullPointerException if any of the given {@link File}s are {@code null}.
30993112 * @throws FileNotFoundException if the source file does not exist.
31003113 */
31013114 private static void validateMoveParameters (final File source , final File destination ) throws FileNotFoundException {
0 commit comments