Skip to content

Commit 05f64ac

Browse files
committed
Javadoc
Reduce vertical whitespace
1 parent df4cb96 commit 05f64ac

File tree

1 file changed

+29
-33
lines changed

1 file changed

+29
-33
lines changed

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

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -419,25 +419,20 @@ public static boolean contentEquals(final File file1, final File file2) throws I
419419
if (file1Exists != file2.exists()) {
420420
return false;
421421
}
422-
423422
if (!file1Exists) {
424423
// two not existing files are equal
425424
return true;
426425
}
427-
428426
checkIsFile(file1, "file1");
429427
checkIsFile(file2, "file2");
430-
431428
if (file1.length() != file2.length()) {
432429
// lengths differ, cannot be equal
433430
return false;
434431
}
435-
436432
if (file1.getCanonicalFile().equals(file2.getCanonicalFile())) {
437433
// same file
438434
return true;
439435
}
440-
441436
return PathUtils.fileContentEquals(file1.toPath(), file2.toPath());
442437
}
443438

@@ -460,8 +455,7 @@ public static boolean contentEquals(final File file1, final File file2) throws I
460455
* @see IOUtils#contentEqualsIgnoreEOL(Reader, Reader)
461456
* @since 2.2
462457
*/
463-
public static boolean contentEqualsIgnoreEOL(final File file1, final File file2, final String charsetName)
464-
throws IOException {
458+
public static boolean contentEqualsIgnoreEOL(final File file1, final File file2, final String charsetName) throws IOException {
465459
if (file1 == null && file2 == null) {
466460
return true;
467461
}
@@ -472,23 +466,19 @@ public static boolean contentEqualsIgnoreEOL(final File file1, final File file2,
472466
if (file1Exists != file2.exists()) {
473467
return false;
474468
}
475-
476469
if (!file1Exists) {
477470
// two not existing files are equal
478471
return true;
479472
}
480-
481473
checkFileExists(file1, "file1");
482474
checkFileExists(file2, "file2");
483-
484475
if (file1.getCanonicalFile().equals(file2.getCanonicalFile())) {
485476
// same file
486477
return true;
487478
}
488-
489479
final Charset charset = Charsets.toCharset(charsetName);
490480
try (Reader input1 = new InputStreamReader(Files.newInputStream(file1.toPath()), charset);
491-
Reader input2 = new InputStreamReader(Files.newInputStream(file2.toPath()), charset)) {
481+
Reader input2 = new InputStreamReader(Files.newInputStream(file2.toPath()), charset)) {
492482
return IOUtils.contentEqualsIgnoreEOL(input1, input2);
493483
}
494484
}
@@ -722,11 +712,10 @@ public static void copyDirectory(final File srcDir, final File destDir, final Fi
722712
* @since 2.8.0
723713
*/
724714
public static void copyDirectory(final File srcDir, final File destDir, final FileFilter fileFilter, final boolean preserveFileDate,
725-
final CopyOption... copyOptions) throws IOException {
715+
final CopyOption... copyOptions) throws IOException {
726716
Objects.requireNonNull(destDir, "destination");
727717
requireDirectoryExists(srcDir, "srcDir");
728718
requireCanonicalPathsNotEquals(srcDir, destDir);
729-
730719
// Cater for destination being directory within the source directory (see IO-141)
731720
List<String> exclusionList = null;
732721
final String srcDirCanonicalPath = srcDir.getCanonicalPath();
@@ -869,11 +858,8 @@ public static void copyFile(final File srcFile, final File destFile, final boole
869858
if (destFile.exists()) {
870859
checkFileExists(destFile, "destFile");
871860
}
872-
873861
final Path srcPath = srcFile.toPath();
874-
875862
Files.copy(srcPath, destFile.toPath(), copyOptions);
876-
877863
// On Windows, the last modified time is copied by default.
878864
if (preserveFileDate && !Files.isSymbolicLink(srcPath) && !setTimes(srcFile, destFile)) {
879865
throw new IOException("Cannot set the file time.");
@@ -1259,7 +1245,7 @@ public static void deleteDirectory(final File directory) throws IOException {
12591245
}
12601246

12611247
/**
1262-
* Schedules a directory recursively for deletion on JVM exit.
1248+
* Requests a directory for deletion recursively when the virtual machine terminates.
12631249
*
12641250
* @param directory directory to delete, must not be {@code null}
12651251
* @throws NullPointerException if the directory is {@code null}
@@ -1301,7 +1287,6 @@ public static boolean deleteQuietly(final File file) {
13011287
} catch (final Exception ignored) {
13021288
// ignore
13031289
}
1304-
13051290
try {
13061291
return file.delete();
13071292
} catch (final Exception ignored) {
@@ -1310,7 +1295,7 @@ public static boolean deleteQuietly(final File file) {
13101295
}
13111296

13121297
/**
1313-
* Determines whether the {@code parent} directory contains the {@code child} element (a file or directory).
1298+
* Tests whether the {@code parent} directory contains the {@code child} element (a file or directory).
13141299
* <p>
13151300
* Files are normalized before comparison.
13161301
* </p>
@@ -1434,7 +1419,7 @@ private static void forceDelete(final File file, final boolean strict) throws IO
14341419
}
14351420

14361421
/**
1437-
* Schedules a file to be deleted when JVM exits.
1422+
* Requests a file to be deleted when the virtual machine terminates.
14381423
* If file is directory delete it and all subdirectories.
14391424
*
14401425
* @param file file or directory to delete, must not be {@code null}.
@@ -1534,7 +1519,7 @@ private static File getParentFile(final File file) {
15341519
}
15351520

15361521
/**
1537-
* Returns a {@link File} representing the system temporary directory.
1522+
* Gets a {@link File} representing the system temporary directory.
15381523
*
15391524
* @return the system temporary directory as a File
15401525
* @since 2.0
@@ -1544,7 +1529,7 @@ public static File getTempDirectory() {
15441529
}
15451530

15461531
/**
1547-
* Returns the path to the system temporary directory.
1532+
* Getsv the path to the system temporary directory.
15481533
*
15491534
* WARNING: this method relies on the Java system property 'java.io.tmpdir'
15501535
* which may or may not have a trailing file separator.
@@ -1559,7 +1544,7 @@ public static String getTempDirectoryPath() {
15591544
}
15601545

15611546
/**
1562-
* Returns a {@link File} representing the user's home directory.
1547+
* Gets a {@link File} representing the user's home directory.
15631548
*
15641549
* @return the user's home directory.
15651550
* @since 2.0
@@ -1569,7 +1554,7 @@ public static File getUserDirectory() {
15691554
}
15701555

15711556
/**
1572-
* Returns the path to the user's home directory.
1557+
* Gets the path to the user's home directory.
15731558
*
15741559
* @return the path to the user's home directory.
15751560
* @since 2.0
@@ -1614,11 +1599,13 @@ public static boolean isEmptyDirectory(final File directory) throws IOException
16141599
* Tests if the specified {@link File} is newer than the specified {@link ChronoLocalDate}
16151600
* at the end of day.
16161601
*
1617-
* <p>Note: The input date is assumed to be in the system default time-zone with the time
1602+
* <p>
1603+
* Note: The input date is assumed to be in the system default time-zone with the time
16181604
* part set to the current time. To use a non-default time-zone use the method
16191605
* {@link #isFileNewer(File, ChronoLocalDateTime, ZoneId)
16201606
* isFileNewer(file, chronoLocalDate.atTime(LocalTime.now(zoneId)), zoneId)} where
16211607
* {@code zoneId} is a valid {@link ZoneId}.
1608+
* </p>
16221609
*
16231610
* @param file the {@link File} of which the modification date must be compared.
16241611
* @param chronoLocalDate the date reference.
@@ -1636,10 +1623,12 @@ public static boolean isFileNewer(final File file, final ChronoLocalDate chronoL
16361623
* Tests if the specified {@link File} is newer than the specified {@link ChronoLocalDate}
16371624
* at the specified time.
16381625
*
1639-
* <p>Note: The input date and time are assumed to be in the system default time-zone. To use a
1626+
* <p>
1627+
* Note: The input date and time are assumed to be in the system default time-zone. To use a
16401628
* non-default time-zone use the method {@link #isFileNewer(File, ChronoLocalDateTime, ZoneId)
16411629
* isFileNewer(file, chronoLocalDate.atTime(localTime), zoneId)} where {@code zoneId} is a valid
16421630
* {@link ZoneId}.
1631+
* </p>
16431632
*
16441633
* @param file the {@link File} of which the modification date must be compared.
16451634
* @param chronoLocalDate the date reference.
@@ -1679,10 +1668,12 @@ public static boolean isFileNewer(final File file, final ChronoLocalDate chronoL
16791668
* Tests if the specified {@link File} is newer than the specified {@link ChronoLocalDateTime}
16801669
* at the system-default time zone.
16811670
*
1682-
* <p>Note: The input date and time is assumed to be in the system default time-zone. To use a
1671+
* <p>
1672+
* Note: The input date and time is assumed to be in the system default time-zone. To use a
16831673
* non-default time-zone use the method {@link #isFileNewer(File, ChronoLocalDateTime, ZoneId)
16841674
* isFileNewer(file, chronoLocalDateTime, zoneId)} where {@code zoneId} is a valid
16851675
* {@link ZoneId}.
1676+
* </p>
16861677
*
16871678
* @param file the {@link File} of which the modification date must be compared.
16881679
* @param chronoLocalDateTime the date reference.
@@ -1825,11 +1816,13 @@ public static boolean isFileNewer(final File file, final OffsetDateTime offsetDa
18251816
* Tests if the specified {@link File} is older than the specified {@link ChronoLocalDate}
18261817
* at the end of day.
18271818
*
1828-
* <p>Note: The input date is assumed to be in the system default time-zone with the time
1819+
* <p>
1820+
* Note: The input date is assumed to be in the system default time-zone with the time
18291821
* part set to the current time. To use a non-default time-zone use the method
18301822
* {@link #isFileOlder(File, ChronoLocalDateTime, ZoneId)
18311823
* isFileOlder(file, chronoLocalDate.atTime(LocalTime.now(zoneId)), zoneId)} where
18321824
* {@code zoneId} is a valid {@link ZoneId}.
1825+
* </p>
18331826
*
18341827
* @param file the {@link File} of which the modification date must be compared.
18351828
* @param chronoLocalDate the date reference.
@@ -1849,10 +1842,12 @@ public static boolean isFileOlder(final File file, final ChronoLocalDate chronoL
18491842
* Tests if the specified {@link File} is older than the specified {@link ChronoLocalDate}
18501843
* at the specified {@link LocalTime}.
18511844
*
1852-
* <p>Note: The input date and time are assumed to be in the system default time-zone. To use a
1845+
* <p>
1846+
* Note: The input date and time are assumed to be in the system default time-zone. To use a
18531847
* non-default time-zone use the method {@link #isFileOlder(File, ChronoLocalDateTime, ZoneId)
18541848
* isFileOlder(file, chronoLocalDate.atTime(localTime), zoneId)} where {@code zoneId} is a valid
18551849
* {@link ZoneId}.
1850+
* </p>
18561851
*
18571852
* @param file the {@link File} of which the modification date must be compared.
18581853
* @param chronoLocalDate the date reference.
@@ -1893,10 +1888,12 @@ public static boolean isFileOlder(final File file, final ChronoLocalDate chronoL
18931888
* Tests if the specified {@link File} is older than the specified {@link ChronoLocalDateTime}
18941889
* at the system-default time zone.
18951890
*
1896-
* <p>Note: The input date and time is assumed to be in the system default time-zone. To use a
1891+
* <p>
1892+
* Note: The input date and time is assumed to be in the system default time-zone. To use a
18971893
* non-default time-zone use the method {@link #isFileOlder(File, ChronoLocalDateTime, ZoneId)
18981894
* isFileOlder(file, chronoLocalDateTime, zoneId)} where {@code zoneId} is a valid
18991895
* {@link ZoneId}.
1896+
* </p>
19001897
*
19011898
* @param file the {@link File} of which the modification date must be compared.
19021899
* @param chronoLocalDateTime the date reference.
@@ -2916,9 +2913,8 @@ private static boolean setTimes(final File sourceFile, final File targetFile) {
29162913
// Fallback: Only set modified time to match source file
29172914
return targetFile.setLastModified(sourceFile.lastModified());
29182915
}
2919-
29202916
// TODO: (Help!) Determine historically why setLastModified(File, File) needed PathUtils.setLastModifiedTime() if
2921-
// sourceFile.isFile() was true, but needed setLastModifiedTime(File, long) if sourceFile.isFile() was false
2917+
// sourceFile.isFile() was true, but needed setLastModifiedTime(File, long) if sourceFile.isFile() was false
29222918
}
29232919

29242920
/**

0 commit comments

Comments
 (0)