Skip to content

Commit b5abc78

Browse files
committed
Javadoc
1 parent c12eaff commit b5abc78

1 file changed

Lines changed: 43 additions & 35 deletions

File tree

src/main/java/org/apache/commons/io/FileUtils.java

Lines changed: 43 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,12 +1088,12 @@ public static void copyURLToFile(final URL source, final File destination, final
10881088
}
10891089

10901090
/**
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.
1091+
* Creates all parent directories for a File object, including any necessary but nonexistent parent directories. If a parent directory already exists or is
1092+
* null, nothing happens.
10931093
*
10941094
* @param file the File that may need parents, may be null.
1095-
* @return The parent directory, or {@code null} if the given file does not name a parent
1096-
* @throws IOException if the directory was not created along with all its parent directories.
1095+
* @return The parent directory, or {@code null} if the given File does have a parent.
1096+
* @throws IOException if the directory was not created along with all its parent directories.
10971097
* @throws SecurityException See {@link File#mkdirs()}.
10981098
* @since 2.9.0
10991099
*/
@@ -1364,33 +1364,39 @@ public static void forceDeleteOnExit(final File file) throws IOException {
13641364
}
13651365

13661366
/**
1367-
* Makes a directory, including any necessary but nonexistent parent
1368-
* directories. If a file already exists with the specified name but it is
1369-
* not a directory then an {@link IOException} is thrown.
1370-
* If the directory cannot be created (or the file already exists but is not a directory)
1371-
* then an {@link IOException} is thrown.
1367+
* Calls {@link File#mkdirs()} and throws an {@link IOException} on failure.
1368+
* <p>
1369+
* Creates all directories for a File object, including any necessary but nonexistent parent directories. If the {@code directory} already exists or is
1370+
* null, nothing happens.
1371+
* </p>
13721372
*
1373-
* @param directory directory to create, may be {@code null}.
1374-
* @throws IOException if the directory was not created along with all its parent directories.
1375-
* @throws IOException if the given file object is not a directory.
1373+
* @param directory the receiver for {@code mkdirs()}. If the {@code directory} already exists or is null, nothing happens.
1374+
* @throws IOException if the directory was not created along with all its parent directories.
1375+
* @throws IOException if the given file object is not a directory.
13761376
* @throws SecurityException See {@link File#mkdirs()}.
1377+
* @see File#mkdirs()
13771378
*/
13781379
public static void forceMkdir(final File directory) throws IOException {
13791380
mkdirs(directory);
13801381
}
13811382

13821383
/**
1383-
* Makes any necessary but nonexistent parent directories for a given File. If the parent directory cannot be
1384-
* created then an IOException is thrown.
1384+
* Calls {@link File#mkdirs()} and throws an {@link IOException} on failure.
1385+
* <p>
1386+
* Creates all directories for a File object, including any necessary but nonexistent parent directories. If the {@code directory} already exists or is
1387+
* null, nothing happens.
1388+
* </p>
13851389
*
1386-
* @param file file with parent to create, must not be {@code null}.
1390+
* @param file file with parents to create, must not be {@code null}.
13871391
* @throws NullPointerException if the file is {@code null}.
1388-
* @throws IOException if the parent directory cannot be created.
1392+
* @throws IOException if the directory was not created along with all its parent directories.
1393+
* @throws IOException if the given file object is not a directory.
1394+
* @throws SecurityException See {@link File#mkdirs()}.
1395+
* @see File#mkdirs()
13891396
* @since 2.5
13901397
*/
13911398
public static void forceMkdirParent(final File file) throws IOException {
1392-
Objects.requireNonNull(file, "file");
1393-
forceMkdir(getParentFile(file));
1399+
forceMkdir(getParentFile(Objects.requireNonNull(file, "file")));
13941400
}
13951401

13961402
/**
@@ -2263,16 +2269,16 @@ public static Collection<File> listFilesAndDirs(final File directory, final IOFi
22632269
}
22642270

22652271
/**
2266-
* Calls {@link File#mkdirs()} and throws an exception on failure.
2272+
* Calls {@link File#mkdirs()} and throws an {@link IOException} on failure.
22672273
* <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.
2274+
* Creates all directories for a File object, including any necessary but nonexistent parent directories. If the {@code directory} already exists or is
2275+
* null, nothing happens.
22702276
* </p>
22712277
*
2272-
* @param directory the receiver for {@code mkdirs()}, passing null is a noop.
2278+
* @param directory the receiver for {@code mkdirs()}. If the {@code directory} already exists or is null, nothing happens.
22732279
* @return the given directory.
2274-
* @throws IOException if the directory was not created along with all its parent directories.
2275-
* @throws IOException if the given file object is not a directory.
2280+
* @throws IOException if the directory was not created along with all its parent directories.
2281+
* @throws IOException if the given file object is not a directory.
22762282
* @throws SecurityException See {@link File#mkdirs()}.
22772283
* @see File#mkdirs()
22782284
*/
@@ -2316,7 +2322,7 @@ public static void moveDirectory(final File srcDir, final File destDir) throws I
23162322

23172323
/**
23182324
* Moves a directory to another directory. Creates all destination parent directories,
2319-
* including any necessary but nonexistent parent directories, if enabled.
2325+
* including any necessary but nonexistent parent directories, if {@code createDestDir} is true.
23202326
*
23212327
* @param source the file to be moved.
23222328
* @param destDir the destination file.
@@ -2399,7 +2405,7 @@ public static void moveFile(final File srcFile, final File destFile, final CopyO
23992405

24002406
/**
24012407
* Moves a file to a directory. Creates all destination parent directories,
2402-
* including any necessary but nonexistent parent directories, if enabled.
2408+
* including any necessary but nonexistent parent directories, if {@code createDestDir} is true.
24032409
*
24042410
* @param srcFile the file to be moved.
24052411
* @param destDir the destination file.
@@ -2425,20 +2431,22 @@ public static void moveFileToDirectory(final File srcFile, final File destDir, f
24252431
}
24262432

24272433
/**
2428-
* Moves a file or directory to the destination directory.
2434+
* Moves a file or directory to a destination directory.
2435+
* <p>
2436+
* Creates all destination parent directories, including any necessary but nonexistent parent directories, if {@code createDestDir} is true.
2437+
* </p>
24292438
* <p>
24302439
* When the destination is on another file system, do a "copy and delete".
24312440
* </p>
24322441
*
2433-
* @param src the file or directory to be moved.
2434-
* @param destDir the destination directory.
2435-
* @param createDestDir If {@code true} create the destination directory, otherwise if {@code false} throw an
2436-
* IOException.
2437-
* @throws NullPointerException if any of the given {@link File}s are {@code null}.
2438-
* @throws FileExistsException if the directory or file exists in the destination directory.
2442+
* @param src the file or directory to be moved.
2443+
* @param destDir the destination directory.
2444+
* @param createDestDir If {@code true} create the destination directory, otherwise if {@code false} throw an IOException.
2445+
* @throws NullPointerException if any of the given {@link File}s are {@code null}.
2446+
* @throws FileExistsException if the directory or file exists in the destination directory.
24392447
* @throws FileNotFoundException if the source file does not exist.
2440-
* @throws IOException if source or destination is invalid.
2441-
* @throws IOException if an error occurs or setting the last-modified time didn't succeed.
2448+
* @throws IOException if source or destination is invalid.
2449+
* @throws IOException if an error occurs or setting the last-modified time didn't succeed.
24422450
* @since 1.4
24432451
*/
24442452
public static void moveToDirectory(final File src, final File destDir, final boolean createDestDir) throws IOException {

0 commit comments

Comments
 (0)