You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ni...@apache.org on 2010/08/05 02:11:38 UTC
svn commit: r982435 -
/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java
Author: niallp
Date: Thu Aug 5 00:11:38 2010
New Revision: 982435
URL: http://svn.apache.org/viewvc?rev=982435&view=rev
Log:
IO-221 Add methods for suffix and prefix filters which take an IOCase object
Modified:
commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java
Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java?rev=982435&r1=982434&r2=982435&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java Thu Aug 5 00:11:38 2010
@@ -21,6 +21,8 @@ import java.io.FileFilter;
import java.io.FilenameFilter;
import java.util.Date;
+import org.apache.commons.io.IOCase;
+
/**
* Useful utilities for working with file filters. It provides access to all
* file filter implementations in this package so you don't have to import
@@ -54,6 +56,18 @@ public class FileFilterUtils {
}
/**
+ * Returns a filter that returns true if the filename starts with the specified text.
+ *
+ * @param prefix the filename prefix
+ * @param caseSensitivity how to handle case sensitivity, null means case-sensitive
+ * @return a prefix checking filter
+ * @since Commons IO 2.0
+ */
+ public static IOFileFilter prefixFileFilter(String prefix, IOCase caseSensitivity) {
+ return new PrefixFileFilter(prefix, caseSensitivity);
+ }
+
+ /**
* Returns a filter that returns true if the filename ends with the specified text.
*
* @param suffix the filename suffix
@@ -64,6 +78,18 @@ public class FileFilterUtils {
}
/**
+ * Returns a filter that returns true if the filename ends with the specified text.
+ *
+ * @param suffix the filename suffix
+ * @param caseSensitivity how to handle case sensitivity, null means case-sensitive
+ * @return a suffix checking filter
+ * @since Commons IO 2.0
+ */
+ public static IOFileFilter suffixFileFilter(String suffix, IOCase caseSensitivity) {
+ return new SuffixFileFilter(suffix, caseSensitivity);
+ }
+
+ /**
* Returns a filter that returns true if the filename matches the specified text.
*
* @param name the filename