Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
Java Example of org.apache.commons.io.filefilter
Where can I find an example Java code that uses the org.apache.commons.io.filefilter package?
✍: FYIcenter.com
org.apache.commons.io.filefilter package
defines an interface (IOFileFilter) that combines both
java.io.FileFilter and java.io.FilenameFilter. Besides that the
package offers a series of ready-to-use implementations of the
IOFileFilter interface including implementation that allow you to
combine other such filters. These filters can be used to list
files or in FileDialog, for example.
Here is very simple Java example that uses the org.apache.commons.io.filefilter package:
// Copyright (c) 2016-2018 FYIcenter.com // Supports commons-io-2.6 // Supports commons-io-2.5 import java.io.File; import java.io.FileFilter; import org.apache.commons.io.filefilter.WildcardFileFilter; public class WildcardFileFilterTest { public static void main(String[] args) throws Exception { File dir = new File("."); FileFilter fileFilter = new WildcardFileFilter("*.java"); File[] files = dir.listFiles(fileFilter); for (int i = 0; i < files.length; i++) { System.out.println(files[i]); } } }
You can compile and run the above example in a command window as shown below:
C:\fyicenter>javac -cp C:\fyicenter\commons-io-2.6\commons-io-2.6.jar WildcardFileFilterTest.java C:\fyicenter>java -cp .;C:\fyicenter\commons-io-2.6\commons-io-2.6.jar WildcardFileFilterTest .\LastModFileComparatorExample.java .\SimpleTestMonitor.java .\WildcardFileFilterTest.java
⇒ Java Example of org.apache.commons.io.comparator
⇐ Using commons-io.jar in Java Code
2017-04-28, 2514🔥, 0💬
Popular Posts:
JDK 11 jdk.scripting.nashorn.jm odis the JMOD file for JDK 11 Scripting Nashorn module. JDK 11 Scrip...
JDK 11 jdk.jshell.jmod is the JMOD file for JDK 11 JShell tool, which can be invoked by the "jshell"...
How to download and install JDK (Java Development Kit) 7? If you want to write Java applications, yo...
JDK 11 jdk.rmic.jmod is the JMOD file for JDK 11 RMI (Remote Method Invocation) Compiler Tool tool, ...
JDK 11 jdk.jshell.jmod is the JMOD file for JDK 11 JShell tool, which can be invoked by the "jshell"...