To use Commons IO in a Maven 2 project, add the following
dependency to your project's pom.xml
:
Example 10.1. Adding a Dependency on Commons IO
<dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>1.4</version> </dependency>
If you are not sure what this means, I'd suggest reading Maven: The Definitive
Guide. When you depend on a library in Maven 2, all you need to
do is add the dependency groupId
,
artifactId
, and version
to your
project's dependencies. Once you do this, Maven 2 will download the
dependency and make it available on your project's classpath.
Commons IO contains a few utilities for simplifying a number of
common I/O tasks. CopyUtils
and
IOUtils
in the org.apache.commons.io
package provide a suite
of static utility methods for working with streams and readers. org.apache.commons.io.FileUtils
provides
static utility methods to help with common File
operations, such as touching a file,
recursive deletion of directories, and reading files. The org.apache.commons.io.filefilter
package
contains implementations of FilenameFilter
, such as SuffixFileFilter
, which accepts files with a
specified name suffix.
For more information about the Commons IO project, see the project page at http://commons.apache.org/io.