Skip to content

Commit ce0e402

Browse files
author
Niall Pemberton
committed
Generify remaining raw types in the public API
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/io/trunk@634474 13f79535-47bb-0310-9956-ffa450edef68
1 parent e6658d5 commit ce0e402

3 files changed

Lines changed: 20 additions & 19 deletions

File tree

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ public static Collection<File> listFiles(
335335
* @see org.apache.commons.io.filefilter.NameFileFilter
336336
* @since Commons IO 1.2
337337
*/
338-
public static Iterator iterateFiles(
338+
public static Iterator<File> iterateFiles(
339339
File directory, IOFileFilter fileFilter, IOFileFilter dirFilter) {
340340
return listFiles(directory, fileFilter, dirFilter).iterator();
341341
}
@@ -367,7 +367,7 @@ private static String[] toSuffixes(String[] extensions) {
367367
* @param recursive if true all subdirectories are searched as well
368368
* @return an collection of java.io.File with the matching files
369369
*/
370-
public static Collection listFiles(
370+
public static Collection<File> listFiles(
371371
File directory, String[] extensions, boolean recursive) {
372372
IOFileFilter filter;
373373
if (extensions == null) {
@@ -392,7 +392,7 @@ public static Collection listFiles(
392392
* @return an iterator of java.io.File with the matching files
393393
* @since Commons IO 1.2
394394
*/
395-
public static Iterator iterateFiles(
395+
public static Iterator<File> iterateFiles(
396396
File directory, String[] extensions, boolean recursive) {
397397
return listFiles(directory, extensions, recursive).iterator();
398398
}
@@ -1151,7 +1151,7 @@ public static byte[] readFileToByteArray(File file) throws IOException {
11511151
* @throws java.io.UnsupportedEncodingException if the encoding is not supported by the VM
11521152
* @since Commons IO 1.1
11531153
*/
1154-
public static List readLines(File file, String encoding) throws IOException {
1154+
public static List<String> readLines(File file, String encoding) throws IOException {
11551155
InputStream in = null;
11561156
try {
11571157
in = openInputStream(file);
@@ -1170,7 +1170,7 @@ public static List readLines(File file, String encoding) throws IOException {
11701170
* @throws IOException in case of an I/O error
11711171
* @since Commons IO 1.3
11721172
*/
1173-
public static List readLines(File file) throws IOException {
1173+
public static List<String> readLines(File file) throws IOException {
11741174
return readLines(file, null);
11751175
}
11761176

@@ -1330,7 +1330,7 @@ public static void writeByteArrayToFile(File file, byte[] data) throws IOExcepti
13301330
* @throws java.io.UnsupportedEncodingException if the encoding is not supported by the VM
13311331
* @since Commons IO 1.1
13321332
*/
1333-
public static void writeLines(File file, String encoding, Collection lines) throws IOException {
1333+
public static void writeLines(File file, String encoding, Collection<?> lines) throws IOException {
13341334
writeLines(file, encoding, lines, null);
13351335
}
13361336

@@ -1344,7 +1344,7 @@ public static void writeLines(File file, String encoding, Collection lines) thro
13441344
* @throws IOException in case of an I/O error
13451345
* @since Commons IO 1.3
13461346
*/
1347-
public static void writeLines(File file, Collection lines) throws IOException {
1347+
public static void writeLines(File file, Collection<?> lines) throws IOException {
13481348
writeLines(file, null, lines, null);
13491349
}
13501350

@@ -1364,7 +1364,8 @@ public static void writeLines(File file, Collection lines) throws IOException {
13641364
* @throws java.io.UnsupportedEncodingException if the encoding is not supported by the VM
13651365
* @since Commons IO 1.1
13661366
*/
1367-
public static void writeLines(File file, String encoding, Collection lines, String lineEnding) throws IOException {
1367+
public static void writeLines(File file, String encoding, Collection<?> lines, String lineEnding)
1368+
throws IOException {
13681369
OutputStream out = null;
13691370
try {
13701371
out = openOutputStream(file);
@@ -1385,7 +1386,7 @@ public static void writeLines(File file, String encoding, Collection lines, Stri
13851386
* @throws IOException in case of an I/O error
13861387
* @since Commons IO 1.3
13871388
*/
1388-
public static void writeLines(File file, Collection lines, String lineEnding) throws IOException {
1389+
public static void writeLines(File file, Collection<?> lines, String lineEnding) throws IOException {
13891390
writeLines(file, null, lines, lineEnding);
13901391
}
13911392

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,15 +1056,15 @@ public static boolean isExtension(String filename, String[] extensions) {
10561056
* @param extensions the extensions to check for, null checks for no extension
10571057
* @return true if the filename is one of the extensions
10581058
*/
1059-
public static boolean isExtension(String filename, Collection extensions) {
1059+
public static boolean isExtension(String filename, Collection<String> extensions) {
10601060
if (filename == null) {
10611061
return false;
10621062
}
10631063
if (extensions == null || extensions.isEmpty()) {
10641064
return (indexOfExtension(filename) == -1);
10651065
}
10661066
String fileExt = getExtension(filename);
1067-
for (Iterator it = extensions.iterator(); it.hasNext();) {
1067+
for (Iterator<String> it = extensions.iterator(); it.hasNext();) {
10681068
if (fileExt.equals(it.next())) {
10691069
return true;
10701070
}

src/java/org/apache/commons/io/IOUtils.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ public static String toString(byte[] input, String encoding)
471471
* @throws IOException if an I/O error occurs
472472
* @since Commons IO 1.1
473473
*/
474-
public static List readLines(InputStream input) throws IOException {
474+
public static List<String> readLines(InputStream input) throws IOException {
475475
InputStreamReader reader = new InputStreamReader(input);
476476
return readLines(reader);
477477
}
@@ -493,7 +493,7 @@ public static List readLines(InputStream input) throws IOException {
493493
* @throws IOException if an I/O error occurs
494494
* @since Commons IO 1.1
495495
*/
496-
public static List readLines(InputStream input, String encoding) throws IOException {
496+
public static List<String> readLines(InputStream input, String encoding) throws IOException {
497497
if (encoding == null) {
498498
return readLines(input);
499499
} else {
@@ -1003,15 +1003,15 @@ public static void write(StringBuffer data, OutputStream output,
10031003
* @throws IOException if an I/O error occurs
10041004
* @since Commons IO 1.1
10051005
*/
1006-
public static void writeLines(Collection lines, String lineEnding,
1006+
public static void writeLines(Collection<?> lines, String lineEnding,
10071007
OutputStream output) throws IOException {
10081008
if (lines == null) {
10091009
return;
10101010
}
10111011
if (lineEnding == null) {
10121012
lineEnding = LINE_SEPARATOR;
10131013
}
1014-
for (Iterator it = lines.iterator(); it.hasNext(); ) {
1014+
for (Iterator<?> it = lines.iterator(); it.hasNext(); ) {
10151015
Object line = it.next();
10161016
if (line != null) {
10171017
output.write(line.toString().getBytes());
@@ -1036,7 +1036,7 @@ public static void writeLines(Collection lines, String lineEnding,
10361036
* @throws IOException if an I/O error occurs
10371037
* @since Commons IO 1.1
10381038
*/
1039-
public static void writeLines(Collection lines, String lineEnding,
1039+
public static void writeLines(Collection<?> lines, String lineEnding,
10401040
OutputStream output, String encoding) throws IOException {
10411041
if (encoding == null) {
10421042
writeLines(lines, lineEnding, output);
@@ -1047,7 +1047,7 @@ public static void writeLines(Collection lines, String lineEnding,
10471047
if (lineEnding == null) {
10481048
lineEnding = LINE_SEPARATOR;
10491049
}
1050-
for (Iterator it = lines.iterator(); it.hasNext(); ) {
1050+
for (Iterator<?> it = lines.iterator(); it.hasNext(); ) {
10511051
Object line = it.next();
10521052
if (line != null) {
10531053
output.write(line.toString().getBytes(encoding));
@@ -1068,15 +1068,15 @@ public static void writeLines(Collection lines, String lineEnding,
10681068
* @throws IOException if an I/O error occurs
10691069
* @since Commons IO 1.1
10701070
*/
1071-
public static void writeLines(Collection lines, String lineEnding,
1071+
public static void writeLines(Collection<?> lines, String lineEnding,
10721072
Writer writer) throws IOException {
10731073
if (lines == null) {
10741074
return;
10751075
}
10761076
if (lineEnding == null) {
10771077
lineEnding = LINE_SEPARATOR;
10781078
}
1079-
for (Iterator it = lines.iterator(); it.hasNext(); ) {
1079+
for (Iterator<?> it = lines.iterator(); it.hasNext(); ) {
10801080
Object line = it.next();
10811081
if (line != null) {
10821082
writer.write(line.toString());

0 commit comments

Comments
 (0)