0

Hello!

I want to know exactly What Is Difference Between The FileFilter and FileNameFilter in java.io.*;

Do they both work the same ?

Please answer .......

-> {Pratik Bhatt}:)

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by bhattpratik
1

The FilenameFilter is used to filter out files in visual components (e.g. when you navigate to a folder, only *.java files would be seen) and in cases where you need to return file names which satisfy a given criteria. Basically for filtering needs based on "file names", FilenameFilter is used.

FileFilter on the other hand deals with "File" objects i.e. filtering based on a given File attributes like; is the file hidden, is it read only; something which a file name can't give you.

Of course, it's pretty trivial to create a File object based on its name and parent directory so I guess these "two" filters are more of convenient wrappers over the same concept but slightly different use cases.

Edited by ~s.o.s~: n/a

Votes + Comments
It's very helpfull
0

TO ~s.o.s~
Super Moderator
Featured Poster
Reputation Points: 2812
Solved Threads: 646

Respacted Sir,

Thankyou For your early and very helpfull answer.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.