commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nia...@apache.org
Subject svn commit: r619103 - in /commons/proper/io/trunk/src/java/org/apache/commons/io: ./ comparator/ filefilter/ input/ output/
Date Wed, 06 Feb 2008 19:01:28 GMT
Author: niallp
Date: Wed Feb  6 11:01:17 2008
New Revision: 619103

URL: http://svn.apache.org/viewvc?rev=619103&view=rev
Log:
IO-140 JDK 1.5 changes: Use generics

Modified:
    commons/proper/io/trunk/src/java/org/apache/commons/io/FileCleaningTracker.java
    commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java
    commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java
    commons/proper/io/trunk/src/java/org/apache/commons/io/FilenameUtils.java
    commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java
    commons/proper/io/trunk/src/java/org/apache/commons/io/LineIterator.java
    commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/DefaultFileComparator.java
    commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/ExtensionFileComparator.java
    commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/LastModifiedFileComparator.java
    commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/NameFileComparator.java
    commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/PathFileComparator.java
    commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/ReverseComparator.java
    commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/SizeFileComparator.java
    commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/AndFileFilter.java
    commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/ConditionalFileFilter.java
    commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/NameFileFilter.java
    commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/OrFileFilter.java
    commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/PrefixFileFilter.java
    commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/SuffixFileFilter.java
    commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/WildcardFileFilter.java
    commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/WildcardFilter.java
    commons/proper/io/trunk/src/java/org/apache/commons/io/input/ClassLoaderObjectInputStream.java
    commons/proper/io/trunk/src/java/org/apache/commons/io/input/DemuxInputStream.java
    commons/proper/io/trunk/src/java/org/apache/commons/io/output/ByteArrayOutputStream.java
    commons/proper/io/trunk/src/java/org/apache/commons/io/output/DemuxOutputStream.java

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/FileCleaningTracker.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/FileCleaningTracker.java?rev=619103&r1=619102&r2=619103&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/FileCleaningTracker.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/FileCleaningTracker.java Wed Feb  6 11:01:17 2008
@@ -48,7 +48,7 @@
     /**
      * Collection of <code>Tracker</code> instances in existence.
      */
-    final Collection /* Tracker */ trackers = new Vector();  // synchronized
+    final Collection<Tracker> trackers = new Vector<Tracker>();  // synchronized
     /**
      * Whether to terminate the thread when the tracking is complete.
      */

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java?rev=619103&r1=619102&r2=619103&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java Wed Feb  6 11:01:17 2008
@@ -320,14 +320,14 @@
             (flags.length() > 1 ? new String[] {"df", flags, path} : new String[] {"df", path});
         
         // perform the command, asking for up to 3 lines (header, interesting, overflow)
-        List lines = performCommand(cmdAttribs, 3);
+        List<String> lines = performCommand(cmdAttribs, 3);
         if (lines.size() < 2) {
             // unknown problem, throw exception
             throw new IOException(
                     "Command line 'df' did not return info as expected " +
                     "for path '" + path + "'- response was " + lines);
         }
-        String line2 = (String) lines.get(1); // the line we're interested in
+        String line2 = lines.get(1); // the line we're interested in
         
         // Now, we tokenize the string. The fourth element is what we want.
         StringTokenizer tok = new StringTokenizer(line2, " ");
@@ -385,7 +385,7 @@
      * @return the parsed data
      * @throws IOException if an error occurs
      */
-    List performCommand(String[] cmdAttribs, int max) throws IOException {
+    List<String> performCommand(String[] cmdAttribs, int max) throws IOException {
         // this method does what it can to avoid the 'Too many open files' error
         // based on trial and error and these links:
         // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4784692
@@ -394,7 +394,7 @@
         // however, its still not perfect as the JDK support is so poor
         // (see commond-exec or ant for a better multi-threaded multi-os solution)
         
-        List lines = new ArrayList(20);
+        List<String> lines = new ArrayList<String>(20);
         Process proc = null;
         InputStream in = null;
         OutputStream out = null;

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java?rev=619103&r1=619102&r2=619103&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java Wed Feb  6 11:01:17 2008
@@ -235,8 +235,8 @@
      * @param files  a Collection containing java.io.File instances
      * @return an array of java.io.File
      */
-    public static File[] convertFileCollectionToFileArray(Collection files) {
-         return (File[]) files.toArray(new File[files.size()]);
+    public static File[] convertFileCollectionToFileArray(Collection<File> files) {
+         return files.toArray(new File[files.size()]);
     }
 
     //-----------------------------------------------------------------------
@@ -248,7 +248,7 @@
      * @param directory the directory to search in.
      * @param filter the filter to apply to files and directories.
      */
-    private static void innerListFiles(Collection files, File directory,
+    private static void innerListFiles(Collection<File> files, File directory,
             IOFileFilter filter) {
         File[] found = directory.listFiles((FileFilter) filter);
         if (found != null) {
@@ -287,7 +287,7 @@
      * @see org.apache.commons.io.filefilter.FileFilterUtils
      * @see org.apache.commons.io.filefilter.NameFileFilter
      */
-    public static Collection listFiles(
+    public static Collection<File> listFiles(
             File directory, IOFileFilter fileFilter, IOFileFilter dirFilter) {
         if (!directory.isDirectory()) {
             throw new IllegalArgumentException(
@@ -311,7 +311,7 @@
         }
 
         //Find files
-        Collection files = new java.util.LinkedList();
+        Collection<File> files = new java.util.LinkedList<File>();
         innerListFiles(files, directory,
             FileFilterUtils.orFileFilter(effFileFilter, effDirFilter));
         return files;
@@ -873,11 +873,11 @@
         }
 
         // Cater for destination being directory within the source directory (see IO-141)
-        List exclusionList = null;
+        List<String> exclusionList = null;
         if (destDir.getCanonicalPath().startsWith(srcDir.getCanonicalPath())) {
             File[] srcFiles = filter == null ? srcDir.listFiles() : srcDir.listFiles(filter);
             if (srcFiles != null && srcFiles.length > 0) {
-                exclusionList = new ArrayList(srcFiles.length);
+                exclusionList = new ArrayList<String>(srcFiles.length);
                 for (int i = 0; i < srcFiles.length; i++) {
                     File copiedFile = new File(destDir, srcFiles[i].getName());
                     exclusionList.add(copiedFile.getCanonicalPath());
@@ -899,7 +899,7 @@
      * @since Commons IO 1.1
      */
     private static void doCopyDirectory(File srcDir, File destDir, FileFilter filter,
-            boolean preserveFileDate, List exclusionList) throws IOException {
+            boolean preserveFileDate, List<String> exclusionList) throws IOException {
         if (destDir.exists()) {
             if (destDir.isDirectory() == false) {
                 throw new IOException("Destination '" + destDir + "' exists but is not a directory");

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/FilenameUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/FilenameUtils.java?rev=619103&r1=619102&r2=619103&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/FilenameUtils.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/FilenameUtils.java Wed Feb  6 11:01:17 2008
@@ -1152,12 +1152,12 @@
         boolean anyChars = false;
         int textIdx = 0;
         int wcsIdx = 0;
-        Stack backtrack = new Stack();
+        Stack<int[]> backtrack = new Stack<int[]>();
         
         // loop around a backtrack stack, to handle complex * matching
         do {
             if (backtrack.size() > 0) {
-                int[] array = (int[]) backtrack.pop();
+                int[] array = backtrack.pop();
                 wcsIdx = array[0];
                 textIdx = array[1];
                 anyChars = true;
@@ -1232,7 +1232,7 @@
         }
 
         char[] array = text.toCharArray();
-        ArrayList list = new ArrayList();
+        ArrayList<String> list = new ArrayList<String>();
         StringBuffer buffer = new StringBuffer();
         for (int i = 0; i < array.length; i++) {
             if (array[i] == '?' || array[i] == '*') {
@@ -1254,7 +1254,7 @@
             list.add(buffer.toString());
         }
 
-        return (String[]) list.toArray( new String[ list.size() ] );
+        return list.toArray( new String[ list.size() ] );
     }
 
 }

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java?rev=619103&r1=619102&r2=619103&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java Wed Feb  6 11:01:17 2008
@@ -496,9 +496,9 @@
      * @throws IOException if an I/O error occurs
      * @since Commons IO 1.1
      */
-    public static List readLines(Reader input) throws IOException {
+    public static List<String> readLines(Reader input) throws IOException {
         BufferedReader reader = new BufferedReader(input);
-        List list = new ArrayList();
+        List<String> list = new ArrayList<String>();
         String line = reader.readLine();
         while (line != null) {
             list.add(line);

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/LineIterator.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/LineIterator.java?rev=619103&r1=619102&r2=619103&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/LineIterator.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/LineIterator.java Wed Feb  6 11:01:17 2008
@@ -50,7 +50,7 @@
  * @version $Id$
  * @since Commons IO 1.2
  */
-public class LineIterator implements Iterator {
+public class LineIterator implements Iterator<String> {
 
     /** The reader that is being read. */
     private final BufferedReader bufferedReader;
@@ -125,7 +125,7 @@
      * @return the next line from the input
      * @throws NoSuchElementException if there is no line to return
      */
-    public Object next() {
+    public String next() {
         return nextLine();
     }
 

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/DefaultFileComparator.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/DefaultFileComparator.java?rev=619103&r1=619102&r2=619103&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/DefaultFileComparator.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/DefaultFileComparator.java Wed Feb  6 11:01:17 2008
@@ -44,25 +44,23 @@
  * @version $Revision$ $Date$
  * @since Commons IO 1.4
  */
-public class DefaultFileComparator implements Comparator, Serializable {
+public class DefaultFileComparator implements Comparator<File>, Serializable {
 
     /** Singleton default comparator instance */
-    public static final Comparator DEFAULT_COMPARATOR = new DefaultFileComparator();
+    public static final Comparator<File> DEFAULT_COMPARATOR = new DefaultFileComparator();
 
     /** Singleton reverse default comparator instance */
-    public static final Comparator DEFAULT_REVERSE = new ReverseComparator(DEFAULT_COMPARATOR);
+    public static final Comparator<File> DEFAULT_REVERSE = new ReverseComparator(DEFAULT_COMPARATOR);
 
     /**
      * Compare the two files using the {@link File#compareTo(File)} method.
      * 
-     * @param obj1 The first file to compare
-     * @param obj2 The second file to compare
+     * @param file1 The first file to compare
+     * @param file2 The second file to compare
      * @return the result of calling file1's
      * {@link File#compareTo(File)} with file2 as the parameter.
      */
-    public int compare(Object obj1, Object obj2) {
-        File file1 = (File)obj1;
-        File file2 = (File)obj2;
+    public int compare(File file1, File file2) {
         return file1.compareTo(file2);
     }
 }

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/ExtensionFileComparator.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/ExtensionFileComparator.java?rev=619103&r1=619102&r2=619103&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/ExtensionFileComparator.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/ExtensionFileComparator.java Wed Feb  6 11:01:17 2008
@@ -51,26 +51,26 @@
  * @version $Revision$ $Date$
  * @since Commons IO 1.4
  */
-public class ExtensionFileComparator implements Comparator, Serializable {
+public class ExtensionFileComparator implements Comparator<File>, Serializable {
 
     /** Case-sensitive extension comparator instance (see {@link IOCase#SENSITIVE}) */
-    public static final Comparator EXTENSION_COMPARATOR = new ExtensionFileComparator();
+    public static final Comparator<File> EXTENSION_COMPARATOR = new ExtensionFileComparator();
 
     /** Reverse case-sensitive extension comparator instance (see {@link IOCase#SENSITIVE}) */
-    public static final Comparator EXTENSION_REVERSE = new ReverseComparator(EXTENSION_COMPARATOR);
+    public static final Comparator<File> EXTENSION_REVERSE = new ReverseComparator(EXTENSION_COMPARATOR);
 
     /** Case-insensitive extension comparator instance (see {@link IOCase#INSENSITIVE}) */
-    public static final Comparator EXTENSION_INSENSITIVE_COMPARATOR = new ExtensionFileComparator(IOCase.INSENSITIVE);
+    public static final Comparator<File> EXTENSION_INSENSITIVE_COMPARATOR = new ExtensionFileComparator(IOCase.INSENSITIVE);
 
     /** Reverse case-insensitive extension comparator instance (see {@link IOCase#INSENSITIVE}) */
-    public static final Comparator EXTENSION_INSENSITIVE_REVERSE
+    public static final Comparator<File> EXTENSION_INSENSITIVE_REVERSE
                                                 = new ReverseComparator(EXTENSION_INSENSITIVE_COMPARATOR);
 
     /** System sensitive extension comparator instance (see {@link IOCase#SYSTEM}) */
-    public static final Comparator EXTENSION_SYSTEM_COMPARATOR = new ExtensionFileComparator(IOCase.SYSTEM);
+    public static final Comparator<File> EXTENSION_SYSTEM_COMPARATOR = new ExtensionFileComparator(IOCase.SYSTEM);
 
     /** Reverse system sensitive path comparator instance (see {@link IOCase#SYSTEM}) */
-    public static final Comparator EXTENSION_SYSTEM_REVERSE = new ReverseComparator(EXTENSION_SYSTEM_COMPARATOR);
+    public static final Comparator<File> EXTENSION_SYSTEM_REVERSE = new ReverseComparator(EXTENSION_SYSTEM_COMPARATOR);
 
     /** Whether the comparison is case sensitive. */
     private final IOCase caseSensitivity;
@@ -94,17 +94,15 @@
     /**
      * Compare the extensions of two files the specified case sensitivity.
      * 
-     * @param obj1 The first file to compare
-     * @param obj2 The second file to compare
+     * @param file1 The first file to compare
+     * @param file2 The second file to compare
      * @return a negative value if the first file's extension
      * is less than the second, zero if the extensions are the
      * same and a positive value if the first files extension
      * is greater than the second file.
      * 
      */
-    public int compare(Object obj1, Object obj2) {
-        File file1 = (File)obj1;
-        File file2 = (File)obj2;
+    public int compare(File file1, File file2) {
         String suffix1 = FilenameUtils.getExtension(file1.getName());
         String suffix2 = FilenameUtils.getExtension(file2.getName());
         return caseSensitivity.checkCompareTo(suffix1, suffix2);

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/LastModifiedFileComparator.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/LastModifiedFileComparator.java?rev=619103&r1=619102&r2=619103&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/LastModifiedFileComparator.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/LastModifiedFileComparator.java Wed Feb  6 11:01:17 2008
@@ -45,28 +45,26 @@
  * @version $Revision$ $Date$
  * @since Commons IO 1.4
  */
-public class LastModifiedFileComparator implements Comparator, Serializable {
+public class LastModifiedFileComparator implements Comparator<File>, Serializable {
 
     /** Last modified comparator instance */
-    public static final Comparator LASTMODIFIED_COMPARATOR = new LastModifiedFileComparator();
+    public static final Comparator<File> LASTMODIFIED_COMPARATOR = new LastModifiedFileComparator();
 
     /** Reverse last modified comparator instance */
-    public static final Comparator LASTMODIFIED_REVERSE = new ReverseComparator(LASTMODIFIED_COMPARATOR);
+    public static final Comparator<File> LASTMODIFIED_REVERSE = new ReverseComparator(LASTMODIFIED_COMPARATOR);
 
     /**
      * Compare the last the last modified date/time of two files.
      * 
-     * @param obj1 The first file to compare
-     * @param obj2 The second file to compare
+     * @param file1 The first file to compare
+     * @param file2 The second file to compare
      * @return a negative value if the first file's lastmodified date/time
      * is less than the second, zero if the lastmodified date/time are the
      * same and a positive value if the first files lastmodified date/time
      * is greater than the second file.
      * 
      */
-    public int compare(Object obj1, Object obj2) {
-        File file1 = (File)obj1;
-        File file2 = (File)obj2;
+    public int compare(File file1, File file2) {
         long result = file1.lastModified() - file2.lastModified();
         if (result < 0) {
             return -1;

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/NameFileComparator.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/NameFileComparator.java?rev=619103&r1=619102&r2=619103&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/NameFileComparator.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/NameFileComparator.java Wed Feb  6 11:01:17 2008
@@ -49,25 +49,25 @@
  * @version $Revision$ $Date$
  * @since Commons IO 1.4
  */
-public class NameFileComparator implements Comparator, Serializable {
+public class NameFileComparator implements Comparator<File>, Serializable {
 
     /** Case-sensitive name comparator instance (see {@link IOCase#SENSITIVE}) */
-    public static final Comparator NAME_COMPARATOR = new NameFileComparator();
+    public static final Comparator<File> NAME_COMPARATOR = new NameFileComparator();
 
     /** Reverse case-sensitive name comparator instance (see {@link IOCase#SENSITIVE}) */
-    public static final Comparator NAME_REVERSE = new ReverseComparator(NAME_COMPARATOR);
+    public static final Comparator<File> NAME_REVERSE = new ReverseComparator(NAME_COMPARATOR);
 
     /** Case-insensitive name comparator instance (see {@link IOCase#INSENSITIVE}) */
-    public static final Comparator NAME_INSENSITIVE_COMPARATOR = new NameFileComparator(IOCase.INSENSITIVE);
+    public static final Comparator<File> NAME_INSENSITIVE_COMPARATOR = new NameFileComparator(IOCase.INSENSITIVE);
 
     /** Reverse case-insensitive name comparator instance (see {@link IOCase#INSENSITIVE}) */
-    public static final Comparator NAME_INSENSITIVE_REVERSE = new ReverseComparator(NAME_INSENSITIVE_COMPARATOR);
+    public static final Comparator<File> NAME_INSENSITIVE_REVERSE = new ReverseComparator(NAME_INSENSITIVE_COMPARATOR);
 
     /** System sensitive name comparator instance (see {@link IOCase#SYSTEM}) */
-    public static final Comparator NAME_SYSTEM_COMPARATOR = new NameFileComparator(IOCase.SYSTEM);
+    public static final Comparator<File> NAME_SYSTEM_COMPARATOR = new NameFileComparator(IOCase.SYSTEM);
 
     /** Reverse system sensitive name comparator instance (see {@link IOCase#SYSTEM}) */
-    public static final Comparator NAME_SYSTEM_REVERSE = new ReverseComparator(NAME_SYSTEM_COMPARATOR);
+    public static final Comparator<File> NAME_SYSTEM_REVERSE = new ReverseComparator(NAME_SYSTEM_COMPARATOR);
 
     /** Whether the comparison is case sensitive. */
     private final IOCase caseSensitivity;
@@ -91,16 +91,14 @@
     /**
      * Compare the names of two files with the specified case sensitivity.
      * 
-     * @param obj1 The first file to compare
-     * @param obj2 The second file to compare
+     * @param file1 The first file to compare
+     * @param file2 The second file to compare
      * @return a negative value if the first file's name
      * is less than the second, zero if the names are the
      * same and a positive value if the first files name
      * is greater than the second file.
      */
-    public int compare(Object obj1, Object obj2) {
-        File file1 = (File)obj1;
-        File file2 = (File)obj2;
+    public int compare(File file1, File file2) {
         return caseSensitivity.checkCompareTo(file1.getName(), file2.getName());
     }
 }

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/PathFileComparator.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/PathFileComparator.java?rev=619103&r1=619102&r2=619103&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/PathFileComparator.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/PathFileComparator.java Wed Feb  6 11:01:17 2008
@@ -49,25 +49,25 @@
  * @version $Revision$ $Date$
  * @since Commons IO 1.4
  */
-public class PathFileComparator implements Comparator, Serializable {
+public class PathFileComparator implements Comparator<File>, Serializable {
 
     /** Case-sensitive path comparator instance (see {@link IOCase#SENSITIVE}) */
-    public static final Comparator PATH_COMPARATOR = new PathFileComparator();
+    public static final Comparator<File> PATH_COMPARATOR = new PathFileComparator();
 
     /** Reverse case-sensitive path comparator instance (see {@link IOCase#SENSITIVE}) */
-    public static final Comparator PATH_REVERSE = new ReverseComparator(PATH_COMPARATOR);
+    public static final Comparator<File> PATH_REVERSE = new ReverseComparator(PATH_COMPARATOR);
 
     /** Case-insensitive path comparator instance (see {@link IOCase#INSENSITIVE}) */
-    public static final Comparator PATH_INSENSITIVE_COMPARATOR = new PathFileComparator(IOCase.INSENSITIVE);
+    public static final Comparator<File> PATH_INSENSITIVE_COMPARATOR = new PathFileComparator(IOCase.INSENSITIVE);
 
     /** Reverse case-insensitive path comparator instance (see {@link IOCase#INSENSITIVE}) */
-    public static final Comparator PATH_INSENSITIVE_REVERSE = new ReverseComparator(PATH_INSENSITIVE_COMPARATOR);
+    public static final Comparator<File> PATH_INSENSITIVE_REVERSE = new ReverseComparator(PATH_INSENSITIVE_COMPARATOR);
 
     /** System sensitive path comparator instance (see {@link IOCase#SYSTEM}) */
-    public static final Comparator PATH_SYSTEM_COMPARATOR = new PathFileComparator(IOCase.SYSTEM);
+    public static final Comparator<File> PATH_SYSTEM_COMPARATOR = new PathFileComparator(IOCase.SYSTEM);
 
     /** Reverse system sensitive path comparator instance (see {@link IOCase#SYSTEM}) */
-    public static final Comparator PATH_SYSTEM_REVERSE = new ReverseComparator(PATH_SYSTEM_COMPARATOR);
+    public static final Comparator<File> PATH_SYSTEM_REVERSE = new ReverseComparator(PATH_SYSTEM_COMPARATOR);
 
     /** Whether the comparison is case sensitive. */
     private final IOCase caseSensitivity;
@@ -91,17 +91,15 @@
     /**
      * Compare the paths of two files the specified case sensitivity.
      * 
-     * @param obj1 The first file to compare
-     * @param obj2 The second file to compare
+     * @param file1 The first file to compare
+     * @param file2 The second file to compare
      * @return a negative value if the first file's path
      * is less than the second, zero if the paths are the
      * same and a positive value if the first files path
      * is greater than the second file.
      * 
      */
-    public int compare(Object obj1, Object obj2) {
-        File file1 = (File)obj1;
-        File file2 = (File)obj2;
+    public int compare(File file1, File file2) {
         return caseSensitivity.checkCompareTo(file1.getPath(), file2.getPath());
     }
 }

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/ReverseComparator.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/ReverseComparator.java?rev=619103&r1=619102&r2=619103&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/ReverseComparator.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/ReverseComparator.java Wed Feb  6 11:01:17 2008
@@ -18,6 +18,7 @@
 
 import java.io.Serializable;
 import java.util.Comparator;
+import java.io.File;
 
 /**
  * Reverses the result of comparing two objects using
@@ -26,16 +27,16 @@
  * @version $Revision$ $Date$
  * @since Commons IO 1.4
  */
-class ReverseComparator implements Comparator, Serializable {
+class ReverseComparator implements Comparator<File>, Serializable {
 
-    private final Comparator delegate;
+    private final Comparator<File> delegate;
 
     /**
      * Construct an instance with the sepecified delegate {@link Comparator}.
      *
      * @param delegate The comparator to delegate to
      */
-    public ReverseComparator(Comparator delegate) {
+    public ReverseComparator(Comparator<File> delegate) {
         if (delegate == null) {
             throw new IllegalArgumentException("Delegate comparator is missing");
         }
@@ -45,13 +46,13 @@
     /**
      * Compare using the delegate Comparator, but reversing the result.
      * 
-     * @param obj1 The first object to compare
-     * @param obj2 The second object to compare
+     * @param file1 The first file to compare
+     * @param file2 The second file to compare
      * @return the result from the delegate {@link Comparator#compare(Object, Object)}
      * reversing the value (i.e. positive becomes negative and vice versa)
      */
-    public int compare(Object obj1, Object obj2) {
-        return delegate.compare(obj2, obj1); // parameters switched round
+    public int compare(File file1, File file2) {
+        return delegate.compare(file2, file1); // parameters switched round
     }
 
 }

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/SizeFileComparator.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/SizeFileComparator.java?rev=619103&r1=619102&r2=619103&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/SizeFileComparator.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/SizeFileComparator.java Wed Feb  6 11:01:17 2008
@@ -49,25 +49,25 @@
  * @version $Revision$ $Date$
  * @since Commons IO 1.4
  */
-public class SizeFileComparator implements Comparator, Serializable {
+public class SizeFileComparator implements Comparator<File>, Serializable {
 
     /** Size comparator instance - directories are treated as zero size */
-    public static final Comparator SIZE_COMPARATOR = new SizeFileComparator();
+    public static final Comparator<File> SIZE_COMPARATOR = new SizeFileComparator();
 
     /** Reverse size comparator instance - directories are treated as zero size */
-    public static final Comparator SIZE_REVERSE = new ReverseComparator(SIZE_COMPARATOR);
+    public static final Comparator<File> SIZE_REVERSE = new ReverseComparator(SIZE_COMPARATOR);
 
     /**
      * Size comparator instance which sums the size of a directory's contents
      * using {@link FileUtils#sizeOfDirectory(File)}
      */
-    public static final Comparator SIZE_SUMDIR_COMPARATOR = new SizeFileComparator(true);
+    public static final Comparator<File> SIZE_SUMDIR_COMPARATOR = new SizeFileComparator(true);
 
     /**
      * Reverse size comparator instance which sums the size of a directory's contents
      * using {@link FileUtils#sizeOfDirectory(File)}
      */
-    public static final Comparator SIZE_SUMDIR_REVERSE = new ReverseComparator(SIZE_SUMDIR_COMPARATOR);
+    public static final Comparator<File> SIZE_SUMDIR_REVERSE = new ReverseComparator(SIZE_SUMDIR_COMPARATOR);
 
     /** Whether the sum of the directory's contents should be calculated. */
     private final boolean sumDirectoryContents;
@@ -97,17 +97,15 @@
     /**
      * Compare the length of two files.
      * 
-     * @param obj1 The first file to compare
-     * @param obj2 The second file to compare
+     * @param file1 The first file to compare
+     * @param file2 The second file to compare
      * @return a negative value if the first file's length
      * is less than the second, zero if the lengths are the
      * same and a positive value if the first files length
      * is greater than the second file.
      * 
      */
-    public int compare(Object obj1, Object obj2) {
-        File file1 = (File)obj1;
-        File file2 = (File)obj2;
+    public int compare(File file1, File file2) {
         long size1 = 0;
         if (file1.isDirectory()) {
             size1 = sumDirectoryContents && file1.exists() ? FileUtils.sizeOfDirectory(file1) : 0;

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/AndFileFilter.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/AndFileFilter.java?rev=619103&r1=619102&r2=619103&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/AndFileFilter.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/AndFileFilter.java Wed Feb  6 11:01:17 2008
@@ -20,7 +20,6 @@
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.List;
 
 /**
@@ -40,7 +39,7 @@
         implements ConditionalFileFilter, Serializable {
 
     /** The list of file filters. */
-    private List fileFilters;
+    private List<IOFileFilter> fileFilters;
 
     /**
      * Constructs a new instance of <code>AndFileFilter</code>.
@@ -48,7 +47,7 @@
      * @since Commons IO 1.1
      */
     public AndFileFilter() {
-        this.fileFilters = new ArrayList();
+        this.fileFilters = new ArrayList<IOFileFilter>();
     }
 
     /**
@@ -58,11 +57,11 @@
      * @param fileFilters  a List of IOFileFilter instances, copied, null ignored
      * @since Commons IO 1.1
      */
-    public AndFileFilter(final List fileFilters) {
+    public AndFileFilter(final List<IOFileFilter> fileFilters) {
         if (fileFilters == null) {
-            this.fileFilters = new ArrayList();
+            this.fileFilters = new ArrayList<IOFileFilter>();
         } else {
-            this.fileFilters = new ArrayList(fileFilters);
+            this.fileFilters = new ArrayList<IOFileFilter>(fileFilters);
         }
     }
 
@@ -77,7 +76,7 @@
         if (filter1 == null || filter2 == null) {
             throw new IllegalArgumentException("The filters must not be null");
         }
-        this.fileFilters = new ArrayList();
+        this.fileFilters = new ArrayList<IOFileFilter>();
         addFileFilter(filter1);
         addFileFilter(filter2);
     }
@@ -92,7 +91,7 @@
     /**
      * {@inheritDoc}
      */
-    public List getFileFilters() {
+    public List<IOFileFilter> getFileFilters() {
         return Collections.unmodifiableList(this.fileFilters);
     }
 
@@ -106,8 +105,8 @@
     /**
      * {@inheritDoc}
      */
-    public void setFileFilters(final List fileFilters) {
-        this.fileFilters = new ArrayList(fileFilters);
+    public void setFileFilters(final List<IOFileFilter> fileFilters) {
+        this.fileFilters = new ArrayList<IOFileFilter>(fileFilters);
     }
 
     /**
@@ -117,8 +116,7 @@
         if (this.fileFilters.size() == 0) {
             return false;
         }
-        for (Iterator iter = this.fileFilters.iterator(); iter.hasNext();) {
-            IOFileFilter fileFilter = (IOFileFilter) iter.next();
+        for (IOFileFilter fileFilter : fileFilters) {
             if (!fileFilter.accept(file)) {
                 return false;
             }
@@ -133,8 +131,7 @@
         if (this.fileFilters.size() == 0) {
             return false;
         }
-        for (Iterator iter = this.fileFilters.iterator(); iter.hasNext();) {
-            IOFileFilter fileFilter = (IOFileFilter) iter.next();
+        for (IOFileFilter fileFilter : fileFilters) {
             if (!fileFilter.accept(file, name)) {
                 return false;
             }

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/ConditionalFileFilter.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/ConditionalFileFilter.java?rev=619103&r1=619102&r2=619103&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/ConditionalFileFilter.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/ConditionalFileFilter.java Wed Feb  6 11:01:17 2008
@@ -43,7 +43,7 @@
      * @return the file filter list
      * @since Commons IO 1.1
      */
-    public List getFileFilters();
+    public List<IOFileFilter> getFileFilters();
 
     /**
      * Removes the specified file filter.
@@ -62,6 +62,6 @@
      * @param fileFilters the list of filters
      * @since Commons IO 1.1
      */
-    public void setFileFilters(List fileFilters);
+    public void setFileFilters(List<IOFileFilter> fileFilters);
 
 }

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/NameFileFilter.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/NameFileFilter.java?rev=619103&r1=619102&r2=619103&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/NameFileFilter.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/NameFileFilter.java Wed Feb  6 11:01:17 2008
@@ -114,7 +114,7 @@
      * @throws IllegalArgumentException if the name list is null
      * @throws ClassCastException if the list does not contain Strings
      */
-    public NameFileFilter(List names) {
+    public NameFileFilter(List<String> names) {
         this(names, null);
     }
 
@@ -126,11 +126,11 @@
      * @throws IllegalArgumentException if the name list is null
      * @throws ClassCastException if the list does not contain Strings
      */
-    public NameFileFilter(List names, IOCase caseSensitivity) {
+    public NameFileFilter(List<String> names, IOCase caseSensitivity) {
         if (names == null) {
             throw new IllegalArgumentException("The list of names must not be null");
         }
-        this.names = (String[]) names.toArray(new String[names.size()]);
+        this.names = names.toArray(new String[names.size()]);
         this.caseSensitivity = (caseSensitivity == null ? IOCase.SENSITIVE : caseSensitivity);
     }
 

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/OrFileFilter.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/OrFileFilter.java?rev=619103&r1=619102&r2=619103&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/OrFileFilter.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/OrFileFilter.java Wed Feb  6 11:01:17 2008
@@ -20,7 +20,6 @@
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.List;
 
 /**
@@ -40,7 +39,7 @@
         implements ConditionalFileFilter, Serializable {
 
     /** The list of file filters. */
-    private List fileFilters;
+    private List<IOFileFilter> fileFilters;
 
     /**
      * Constructs a new instance of <code>OrFileFilter</code>.
@@ -48,7 +47,7 @@
      * @since Commons IO 1.1
      */
     public OrFileFilter() {
-        this.fileFilters = new ArrayList();
+        this.fileFilters = new ArrayList<IOFileFilter>();
     }
 
     /**
@@ -58,11 +57,11 @@
      * @param fileFilters  the file filters for this filter, copied, null ignored
      * @since Commons IO 1.1
      */
-    public OrFileFilter(final List fileFilters) {
+    public OrFileFilter(final List<IOFileFilter> fileFilters) {
         if (fileFilters == null) {
-            this.fileFilters = new ArrayList();
+            this.fileFilters = new ArrayList<IOFileFilter>();
         } else {
-            this.fileFilters = new ArrayList(fileFilters);
+            this.fileFilters = new ArrayList<IOFileFilter>(fileFilters);
         }
     }
 
@@ -77,7 +76,7 @@
         if (filter1 == null || filter2 == null) {
             throw new IllegalArgumentException("The filters must not be null");
         }
-        this.fileFilters = new ArrayList();
+        this.fileFilters = new ArrayList<IOFileFilter>();
         addFileFilter(filter1);
         addFileFilter(filter2);
     }
@@ -92,7 +91,7 @@
     /**
      * {@inheritDoc}
      */
-    public List getFileFilters() {
+    public List<IOFileFilter> getFileFilters() {
         return Collections.unmodifiableList(this.fileFilters);
     }
 
@@ -106,7 +105,7 @@
     /**
      * {@inheritDoc}
      */
-    public void setFileFilters(final List fileFilters) {
+    public void setFileFilters(final List<IOFileFilter> fileFilters) {
         this.fileFilters = fileFilters;
     }
 
@@ -114,8 +113,7 @@
      * {@inheritDoc}
      */
     public boolean accept(final File file) {
-        for (Iterator iter = this.fileFilters.iterator(); iter.hasNext();) {
-            IOFileFilter fileFilter = (IOFileFilter) iter.next();
+        for (IOFileFilter fileFilter : fileFilters) {
             if (fileFilter.accept(file)) {
                 return true;
             }
@@ -127,8 +125,7 @@
      * {@inheritDoc}
      */
     public boolean accept(final File file, final String name) {
-        for (Iterator iter = this.fileFilters.iterator(); iter.hasNext();) {
-            IOFileFilter fileFilter = (IOFileFilter) iter.next();
+        for (IOFileFilter fileFilter : fileFilters) {
             if (fileFilter.accept(file, name)) {
                 return true;
             }

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/PrefixFileFilter.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/PrefixFileFilter.java?rev=619103&r1=619102&r2=619103&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/PrefixFileFilter.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/PrefixFileFilter.java Wed Feb  6 11:01:17 2008
@@ -119,7 +119,7 @@
      * @throws IllegalArgumentException if the prefix list is null
      * @throws ClassCastException if the list does not contain Strings
      */
-    public PrefixFileFilter(List prefixes) {
+    public PrefixFileFilter(List<String> prefixes) {
         this(prefixes, IOCase.SENSITIVE);
     }
 
@@ -133,11 +133,11 @@
      * @throws ClassCastException if the list does not contain Strings
      * @since Commons IO 1.4
      */
-    public PrefixFileFilter(List prefixes, IOCase caseSensitivity) {
+    public PrefixFileFilter(List<String> prefixes, IOCase caseSensitivity) {
         if (prefixes == null) {
             throw new IllegalArgumentException("The list of prefixes must not be null");
         }
-        this.prefixes = (String[]) prefixes.toArray(new String[prefixes.size()]);
+        this.prefixes = prefixes.toArray(new String[prefixes.size()]);
         this.caseSensitivity = (caseSensitivity == null ? IOCase.SENSITIVE : caseSensitivity);
     }
 

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/SuffixFileFilter.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/SuffixFileFilter.java?rev=619103&r1=619102&r2=619103&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/SuffixFileFilter.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/SuffixFileFilter.java Wed Feb  6 11:01:17 2008
@@ -120,7 +120,7 @@
      * @throws IllegalArgumentException if the suffix list is null
      * @throws ClassCastException if the list does not contain Strings
      */
-    public SuffixFileFilter(List suffixes) {
+    public SuffixFileFilter(List<String> suffixes) {
         this(suffixes, IOCase.SENSITIVE);
     }
 
@@ -134,11 +134,11 @@
      * @throws ClassCastException if the list does not contain Strings
      * @since Commons IO 1.4
      */
-    public SuffixFileFilter(List suffixes, IOCase caseSensitivity) {
+    public SuffixFileFilter(List<String> suffixes, IOCase caseSensitivity) {
         if (suffixes == null) {
             throw new IllegalArgumentException("The list of suffixes must not be null");
         }
-        this.suffixes = (String[]) suffixes.toArray(new String[suffixes.size()]);
+        this.suffixes = suffixes.toArray(new String[suffixes.size()]);
         this.caseSensitivity = (caseSensitivity == null ? IOCase.SENSITIVE : caseSensitivity);
     }
 

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/WildcardFileFilter.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/WildcardFileFilter.java?rev=619103&r1=619102&r2=619103&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/WildcardFileFilter.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/WildcardFileFilter.java Wed Feb  6 11:01:17 2008
@@ -119,7 +119,7 @@
      * @throws IllegalArgumentException if the pattern list is null
      * @throws ClassCastException if the list does not contain Strings
      */
-    public WildcardFileFilter(List wildcards) {
+    public WildcardFileFilter(List<String> wildcards) {
         this(wildcards, null);
     }
 
@@ -131,11 +131,11 @@
      * @throws IllegalArgumentException if the pattern list is null
      * @throws ClassCastException if the list does not contain Strings
      */
-    public WildcardFileFilter(List wildcards, IOCase caseSensitivity) {
+    public WildcardFileFilter(List<String> wildcards, IOCase caseSensitivity) {
         if (wildcards == null) {
             throw new IllegalArgumentException("The wildcard list must not be null");
         }
-        this.wildcards = (String[]) wildcards.toArray(new String[wildcards.size()]);
+        this.wildcards = wildcards.toArray(new String[wildcards.size()]);
         this.caseSensitivity = (caseSensitivity == null ? IOCase.SENSITIVE : caseSensitivity);
     }
 

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/WildcardFilter.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/WildcardFilter.java?rev=619103&r1=619102&r2=619103&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/WildcardFilter.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/WildcardFilter.java Wed Feb  6 11:01:17 2008
@@ -32,7 +32,7 @@
  * single or multiple wildcard characters.
  * This is the same as often found on Dos/Unix command lines.
  * The extension check is case-sensitive.
- * See {@link FilenameUtils#wildcardMatch} for more information.
+ * See {@link FilenameUtils#wildcardMatch(String, String)} for more information.
  * <p>
  * For example:
  * <pre>
@@ -88,11 +88,11 @@
      * @throws IllegalArgumentException if the pattern list is null
      * @throws ClassCastException if the list does not contain Strings
      */
-    public WildcardFilter(List wildcards) {
+    public WildcardFilter(List<String> wildcards) {
         if (wildcards == null) {
             throw new IllegalArgumentException("The wildcard list must not be null");
         }
-        this.wildcards = (String[]) wildcards.toArray(new String[wildcards.size()]);
+        this.wildcards = wildcards.toArray(new String[wildcards.size()]);
     }
 
     //-----------------------------------------------------------------------

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/input/ClassLoaderObjectInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/input/ClassLoaderObjectInputStream.java?rev=619103&r1=619102&r2=619103&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/input/ClassLoaderObjectInputStream.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/input/ClassLoaderObjectInputStream.java Wed Feb  6 11:01:17 2008
@@ -61,7 +61,7 @@
      * @throws IOException in case of an I/O error
      * @throws ClassNotFoundException if the Class cannot be found
      */
-    protected Class resolveClass(ObjectStreamClass objectStreamClass)
+    protected Class<?> resolveClass(ObjectStreamClass objectStreamClass)
             throws IOException, ClassNotFoundException {
         
         Class clazz = Class.forName(objectStreamClass.getName(), false, classLoader);

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/input/DemuxInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/input/DemuxInputStream.java?rev=619103&r1=619102&r2=619103&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/input/DemuxInputStream.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/input/DemuxInputStream.java Wed Feb  6 11:01:17 2008
@@ -29,7 +29,7 @@
 public class DemuxInputStream
     extends InputStream
 {
-    private InheritableThreadLocal m_streams = new InheritableThreadLocal();
+    private InheritableThreadLocal<InputStream> m_streams = new InheritableThreadLocal<InputStream>();
 
     /**
      * Bind the specified stream to the current thread.
@@ -39,7 +39,7 @@
      */
     public InputStream bindStream( InputStream input )
     {
-        InputStream oldValue = getStream();
+        InputStream oldValue = m_streams.get();
         m_streams.set( input );
         return oldValue;
     }
@@ -52,7 +52,7 @@
     public void close()
         throws IOException
     {
-        InputStream input = getStream();
+        InputStream input = m_streams.get();
         if( null != input )
         {
             input.close();
@@ -68,7 +68,7 @@
     public int read()
         throws IOException
     {
-        InputStream input = getStream();
+        InputStream input = m_streams.get();
         if( null != input )
         {
             return input.read();
@@ -77,15 +77,5 @@
         {
             return -1;
         }
-    }
-
-    /**
-     * Utility method to retrieve stream bound to current thread (if any).
-     *
-     * @return the input stream
-     */
-    private InputStream getStream()
-    {
-        return (InputStream)m_streams.get();
     }
 }

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/output/ByteArrayOutputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/output/ByteArrayOutputStream.java?rev=619103&r1=619102&r2=619103&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/output/ByteArrayOutputStream.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/output/ByteArrayOutputStream.java Wed Feb  6 11:01:17 2008
@@ -54,7 +54,7 @@
     private static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
 
     /** The list of buffers, which grows and never reduces. */
-    private List buffers = new ArrayList();
+    private List<byte[]> buffers = new ArrayList<byte[]>();
     /** The index of the current buffer. */
     private int currentBufferIndex;
     /** The total count of bytes in all the filled buffers. */
@@ -88,17 +88,6 @@
     }
 
     /**
-     * Return the appropriate <code>byte[]</code> buffer 
-     * specified by index.
-     *
-     * @param index  the index of the buffer required
-     * @return the buffer
-     */
-    private byte[] getBuffer(int index) {
-        return (byte[]) buffers.get(index);
-    }
-
-    /**
      * Makes a new buffer available either by allocating
      * a new one or re-cycling an existing one.
      *
@@ -110,7 +99,7 @@
             filledBufferSum += currentBuffer.length;
             
             currentBufferIndex++;
-            currentBuffer = getBuffer(currentBufferIndex);
+            currentBuffer = buffers.get(currentBufferIndex);
         } else {
             //Creating new buffer
             int newBufferSize;
@@ -232,7 +221,7 @@
         count = 0;
         filledBufferSum = 0;
         currentBufferIndex = 0;
-        currentBuffer = getBuffer(currentBufferIndex);
+        currentBuffer = buffers.get(currentBufferIndex);
     }
 
     /**
@@ -246,7 +235,7 @@
     public synchronized void writeTo(OutputStream out) throws IOException {
         int remaining = count;
         for (int i = 0; i < buffers.size(); i++) {
-            byte[] buf = getBuffer(i);
+            byte[] buf = buffers.get(i);
             int c = Math.min(buf.length, remaining);
             out.write(buf, 0, c);
             remaining -= c;
@@ -271,7 +260,7 @@
         byte newbuf[] = new byte[remaining];
         int pos = 0;
         for (int i = 0; i < buffers.size(); i++) {
-            byte[] buf = getBuffer(i);
+            byte[] buf = buffers.get(i);
             int c = Math.min(buf.length, remaining);
             System.arraycopy(buf, 0, newbuf, pos, c);
             pos += c;

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/output/DemuxOutputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/output/DemuxOutputStream.java?rev=619103&r1=619102&r2=619103&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/output/DemuxOutputStream.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/output/DemuxOutputStream.java Wed Feb  6 11:01:17 2008
@@ -29,7 +29,7 @@
 public class DemuxOutputStream
     extends OutputStream
 {
-    private InheritableThreadLocal m_streams = new InheritableThreadLocal();
+    private InheritableThreadLocal<OutputStream> m_streams = new InheritableThreadLocal<OutputStream>();
 
     /**
      * Bind the specified stream to the current thread.
@@ -39,7 +39,7 @@
      */
     public OutputStream bindStream( OutputStream output )
     {
-        OutputStream stream = getStream();
+        OutputStream stream = m_streams.get();
         m_streams.set( output );
         return stream;
     }
@@ -52,7 +52,7 @@
     public void close()
         throws IOException
     {
-        OutputStream output = getStream();
+        OutputStream output = m_streams.get();
         if( null != output )
         {
             output.close();
@@ -67,7 +67,7 @@
     public void flush()
         throws IOException
     {
-        OutputStream output = getStream();
+        OutputStream output = m_streams.get();
         if( null != output )
         {
             output.flush();
@@ -83,20 +83,10 @@
     public void write( int ch )
         throws IOException
     {
-        OutputStream output = getStream();
+        OutputStream output = m_streams.get();
         if( null != output )
         {
             output.write( ch );
         }
-    }
-
-    /**
-     * Utility method to retrieve stream bound to current thread (if any).
-     *
-     * @return the output stream
-     */
-    private OutputStream getStream()
-    {
-        return (OutputStream)m_streams.get();
     }
 }



Mime
View raw message