Skip to content

Commit 0daf9ec

Browse files
committed
Javadoc
1 parent bd21a5c commit 0daf9ec

3 files changed

Lines changed: 59 additions & 32 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import java.io.IOException;
2121

2222
/**
23-
* Indicates that a file already exists.
23+
* Signals that a file already exists.
2424
*
2525
* @since 2.0
2626
*/

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

Lines changed: 57 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -952,11 +952,13 @@ public static int getPrefixLength(final String fileName) {
952952
* The output will be the same irrespective of the machine that the code is running on, with the
953953
* exception of a possible {@link IllegalArgumentException} on Windows (see below).
954954
* </p>
955+
* <p>
955956
* <strong>Note:</strong> This method used to have a hidden problem for names like "foo.exe:bar.txt".
956957
* In this case, the name wouldn't be the name of a file, but the identifier of an
957958
* alternate data stream (bar.txt) on the file foo.exe. The method used to return
958959
* ".txt" here, which would be misleading. Commons IO 2.7, and later versions, are throwing
959960
* an {@link IllegalArgumentException} for names like this.
961+
* </p>
960962
*
961963
* @param fileName
962964
* the file name to find the last extension separator in, null returns -1.
@@ -985,8 +987,10 @@ public static int indexOfExtension(final String fileName) throws IllegalArgument
985987
* <p>
986988
* This method will handle a file in either Unix or Windows format.
987989
* The position of the last forward or backslash is returned.
990+
* </p>
988991
* <p>
989992
* The output will be the same irrespective of the machine that the code is running on.
993+
* </p>
990994
*
991995
* @param fileName the file name to find the last path separator in, null returns -1.
992996
* @return the index of the last separator character, or -1 if there
@@ -1011,6 +1015,7 @@ private static boolean isEmpty(final String string) {
10111015
* This method obtains the extension as the textual part of the file name
10121016
* after the last period. There must be no directory separator after the period.
10131017
* The extension check is case-sensitive on all platforms.
1018+
* </p>
10141019
*
10151020
* @param fileName the file name, null returns false.
10161021
* @param extensions the extensions to check for, null checks for no extension.
@@ -1034,6 +1039,7 @@ public static boolean isExtension(final String fileName, final Collection<String
10341039
* This method obtains the extension as the textual part of the file name
10351040
* after the last period. There must be no directory separator after the period.
10361041
* The extension check is case-sensitive on all platforms.
1042+
* </p>
10371043
*
10381044
* @param fileName the file name, null returns false.
10391045
* @param extension the extension to check for, null or empty checks for no extension.
@@ -1057,6 +1063,7 @@ public static boolean isExtension(final String fileName, final String extension)
10571063
* This method obtains the extension as the textual part of the file name
10581064
* after the last period. There must be no directory separator after the period.
10591065
* The extension check is case-sensitive on all platforms.
1066+
* </p>
10601067
*
10611068
* @param fileName the file name, null returns false.
10621069
* @param extensions the extensions to check for, null checks for no extension.
@@ -1210,10 +1217,11 @@ static boolean isSystemWindows() {
12101217
/**
12111218
* Checks whether a given string is a valid host name according to
12121219
* RFC 3986.
1213-
*
1214-
* <p>Accepted are IP addresses (v4 and v6) as well as what the
1220+
* <p>
1221+
* Accepted are IP addresses (v4 and v6) as well as what the
12151222
* RFC calls a "reg-name". Percent encoded names don't seem to be
1216-
* valid names in UNC paths.</p>
1223+
* valid names in UNC paths.
1224+
* </p>
12171225
*
12181226
* @see "https://tools.ietf.org/html/rfc3986#section-3.2.2"
12191227
* @param name the hostname to validate.
@@ -1229,15 +1237,18 @@ private static boolean isValidHostName(final String name) {
12291237
* This method normalizes a path to a standard format.
12301238
* The input may contain separators in either Unix or Windows format.
12311239
* The output will contain separators in the format of the system.
1232-
* <p>
1233-
* A trailing slash will be retained.
1234-
* A double slash will be merged to a single slash (but UNC names are handled).
1235-
* A single period path segment will be removed.
1236-
* A double period will cause that path segment and the one before to be removed.
1237-
* If the double period has no parent path segment, {@code null} is returned.
1240+
* </p>
1241+
* <ul>
1242+
* <li>A trailing slash will be retained.</li>
1243+
* <li>A double slash will be merged to a single slash (but UNC names are handled).</li>
1244+
* <li>A single period path segment will be removed.</li>
1245+
* <li>A double period will cause that path segment and the one before to be removed.</li>
1246+
* <li>If the double period has no parent path segment, {@code null} is returned.</li>
1247+
* </ul>
12381248
* <p>
12391249
* The output will be the same on both Unix and Windows except
12401250
* for the separator character.
1251+
* </p>
12411252
* <pre>
12421253
* /foo// --&gt; /foo/
12431254
* /foo/./ --&gt; /foo/
@@ -1257,7 +1268,9 @@ private static boolean isValidHostName(final String name) {
12571268
* ~/foo/../bar/ --&gt; ~/bar/
12581269
* ~/../bar --&gt; null
12591270
* </pre>
1271+
* <p>
12601272
* (Note the file separator will be correct for Windows/Unix.)
1273+
* </p>
12611274
*
12621275
* @param fileName the file name to normalize, null returns null.
12631276
* @return the normalized fileName, or null if invalid.
@@ -1273,16 +1286,18 @@ public static String normalize(final String fileName) {
12731286
* This method normalizes a path to a standard format.
12741287
* The input may contain separators in either Unix or Windows format.
12751288
* The output will contain separators in the format specified.
1276-
* <p>
1277-
* A trailing slash will be retained.
1278-
* A double slash will be merged to a single slash (but UNC names are handled).
1279-
* A single period path segment will be removed.
1280-
* A double period will cause that path segment and the one before to be removed.
1281-
* If the double period has no parent path segment to work with, {@code null}
1282-
* is returned.
1289+
* </p>
1290+
* <ul>
1291+
* <li>A trailing slash will be retained.</li>
1292+
* <li>A double slash will be merged to a single slash (but UNC names are handled).</li>
1293+
* <li>A single period path segment will be removed.</li>
1294+
* <li>A double period will cause that path segment and the one before to be removed.</li>
1295+
* <li>If the double period has no parent path segment to work with, {@code null} is returned.</li>
1296+
* </ul>
12831297
* <p>
12841298
* The output will be the same on both Unix and Windows except
12851299
* for the separator character.
1300+
* </p>
12861301
* <pre>
12871302
* /foo// --&gt; /foo/
12881303
* /foo/./ --&gt; /foo/
@@ -1302,8 +1317,10 @@ public static String normalize(final String fileName) {
13021317
* ~/foo/../bar/ --&gt; ~/bar/
13031318
* ~/../bar --&gt; null
13041319
* </pre>
1320+
* <p>
13051321
* The output will be the same on both Unix and Windows including
13061322
* the separator character.
1323+
* </p>
13071324
*
13081325
* @param fileName the file name to normalize, null returns null.
13091326
* @param unixSeparator {@code true} if a Unix separator should
@@ -1323,16 +1340,18 @@ public static String normalize(final String fileName, final boolean unixSeparato
13231340
* This method normalizes a path to a standard format.
13241341
* The input may contain separators in either Unix or Windows format.
13251342
* The output will contain separators in the format of the system.
1326-
* <p>
1327-
* A trailing slash will be removed.
1328-
* A double slash will be merged to a single slash (but UNC names are handled).
1329-
* A single period path segment will be removed.
1330-
* A double period will cause that path segment and the one before to be removed.
1331-
* If the double period has no parent path segment to work with, {@code null}
1332-
* is returned.
1343+
* </p>
1344+
* <ul>
1345+
* <li>A trailing slash will be removed.</li>
1346+
* <li>A double slash will be merged to a single slash (but UNC names are handled).</li>
1347+
* <li>A single period path segment will be removed.</li>
1348+
* <li>A double period will cause that path segment and the one before to be removed.</li>
1349+
* <li>If the double period has no parent path segment to work with, {@code null} is returned.</li>
1350+
* </ul>
13331351
* <p>
13341352
* The output will be the same on both Unix and Windows except
13351353
* for the separator character.
1354+
* </p>
13361355
* <pre>
13371356
* /foo// --&gt; /foo
13381357
* /foo/./ --&gt; /foo
@@ -1369,13 +1388,14 @@ public static String normalizeNoEndSeparator(final String fileName) {
13691388
* This method normalizes a path to a standard format.
13701389
* The input may contain separators in either Unix or Windows format.
13711390
* The output will contain separators in the format specified.
1372-
* <p>
1373-
* A trailing slash will be removed.
1374-
* A double slash will be merged to a single slash (but UNC names are handled).
1375-
* A single period path segment will be removed.
1376-
* A double period will cause that path segment and the one before to be removed.
1377-
* If the double period has no parent path segment to work with, {@code null}
1378-
* is returned.
1391+
* </p>
1392+
* <ul>
1393+
* <li>A trailing slash will be removed.</li>
1394+
* <li>A double slash will be merged to a single slash (but UNC names are handled).</li>
1395+
* <li>A single period path segment will be removed.</li>
1396+
* <li>A double period will cause that path segment and the one before to be removed.</li>
1397+
* <li>If the double period has no parent path segment to work with, {@code null} is returned.</li>
1398+
* </ul>
13791399
* <p>
13801400
* The output will be the same on both Unix and Windows including
13811401
* the separator character.
@@ -1547,14 +1567,17 @@ private static char toSeparator(final boolean unixSeparator) {
15471567
* single or multiple (zero or more) wildcard characters.
15481568
* This is the same as often found on DOS/Unix command lines.
15491569
* The check is case-sensitive always.
1570+
* </p>
15501571
* <pre>
15511572
* wildcardMatch("c.txt", "*.txt") --&gt; true
15521573
* wildcardMatch("c.txt", "*.jpg") --&gt; false
15531574
* wildcardMatch("a/b/c.txt", "a/b/*") --&gt; true
15541575
* wildcardMatch("c.txt", "*.???") --&gt; true
15551576
* wildcardMatch("c.txt", "*.????") --&gt; false
15561577
* </pre>
1578+
* <p>
15571579
* The sequence "*?" does not work properly at present in match strings.
1580+
* </p>
15581581
*
15591582
* @param fileName the file name to match on, may be null.
15601583
* @param wildcardMatcher the wildcard string to match against, may be null.
@@ -1572,6 +1595,7 @@ public static boolean wildcardMatch(final String fileName, final String wildcard
15721595
* The wildcard matcher uses the characters '?' and '*' to represent a
15731596
* single or multiple (zero or more) wildcard characters.
15741597
* The sequence "*?" does not work properly at present in match strings.
1598+
* </p>
15751599
*
15761600
* @param fileName the file name to match on, may be null.
15771601
* @param wildcardMatcher the wildcard string to match against, may be null.
@@ -1655,14 +1679,17 @@ public static boolean wildcardMatch(final String fileName, final String wildcard
16551679
* single or multiple (zero or more) wildcard characters.
16561680
* This is the same as often found on DOS/Unix command lines.
16571681
* The check is case-sensitive on Unix and case-insensitive on Windows.
1682+
* </p>
16581683
* <pre>
16591684
* wildcardMatch("c.txt", "*.txt") --&gt; true
16601685
* wildcardMatch("c.txt", "*.jpg") --&gt; false
16611686
* wildcardMatch("a/b/c.txt", "a/b/*") --&gt; true
16621687
* wildcardMatch("c.txt", "*.???") --&gt; true
16631688
* wildcardMatch("c.txt", "*.????") --&gt; false
16641689
* </pre>
1690+
* <p>
16651691
* The sequence "*?" does not work properly at present in match strings.
1692+
* </p>
16661693
*
16671694
* @param fileName the file name to match on.
16681695
* @param wildcardMatcher the wildcard string to match against.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import java.io.IOException;
2121

2222
/**
23-
* Subclasses IOException with the {@link Throwable} constructors missing before Java 6.
23+
* Subclasses {@link IOException} with the {@link Throwable} constructors missing before Java 6.
2424
*
2525
* @since 1.4
2626
* @deprecated (since 2.5) use {@link IOException} instead.

0 commit comments

Comments
 (0)