commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ole ersoy" <ole.er...@gmail.com>
Subject Additional FileUtils Methods for Commons-io
Date Wed, 07 Mar 2007 16:11:35 GMT
Hi,

I created a few methods that I think might fit well with FileUtils.

    public static List<File> create(ArrayList<String> paths)
    {
        Iterator<String> pathIterator = paths.iterator();
        List<File> files  = new ArrayList<File>();
        while(pathIterator.hasNext())
        {
            files.add(new File(pathIterator.next()));
        }
        return files;
    }

    public static void create(List<File> directories)
    {
        Iterator<File> directoryIterator = directories.iterator();

        while(directoryIterator.hasNext())
        {
            File directory = directoryIterator.next();
            directory.mkdirs();
        }
    }

    public static void delete(List<File> directories) throws IOException
    {
        Iterator<File> directoriesIterator = directories.iterator();

        while(directoriesIterator.hasNext())
        {
            File file = directoriesIterator.next();
            FileUtils.deleteDirectory( file );
        }
    }

Thoughts?

Cheers,
- Ole

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message