Hi,i want a help regarding to this program.in this program i have read the .txtfiles and .htmlfiles in the directory using ioexceptions.but now for this program i must use filters to read the pdf files and other files which i want.i dont know about filters plz suggest how to read files using filters.


<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
import java.io.*;

public class FileReader1{

public static void main(String[] args) {

String dir = "D:sathya";
File f = new File(dir,"files");
File folder = new File(dir);
File[] listOfFiles = folder.listFiles();

for (int i = 0; i < listOfFiles.length; i++)
{
if (listOfFiles[i].isFile())
{
System.out.println("[FILE]" + listOfFiles[i].getName());
System.out.println("path:"+f.getPath());
}
else if (listOfFiles[i].isDirectory())
{

String directoryToSearch = listOfFiles[i].getName();

System.out.println("path:"+f.getPath());
System.out.println("[DIR]" + directoryToSearch);

File subFolder = new File(dir + directoryToSearch);
File[] listOfSubFiles = subFolder.listFiles();
for (int j = 0; j < listOfSubFiles.length; j++)
{

System.out.println("\t[DIR]" + listOfSubFiles[j].getName());
System.out.println("path:"+f.getPath());
}

}
}
}

}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>