File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes I/O and Streams and the fly likes Search through files - API Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Search through files - API " Watch "Search through files - API " New topic
Author

Search through files - API

ksp shenoy
Greenhorn

Joined: Jun 20, 2004
Posts: 4
Hi all,

I need to implement a search feature in one of my jsp application. Here, user inputs the search keyword and the application has search through all the files stored on the server and list out all the files containg the given keyword...So, is there any specific java API for this..? Or I need to read each and every file to look for the key word...in the second case, the process will take more time to perfom the search and seems to be less efficient...So, kindly help in this regards..

Regards
Pandurang
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

Perhaps you can invoke 'grep' from java, which is quite fast and handles some kind of regularexpressions.
grep is freely available for most unixes as far as I know and for windows too.


http://home.arcor.de/hirnstrom/bewerbung
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8903
    
    8

There's an implementation of grep in the New IO Examples. Should be reasonably fast. Perhaps you can bend it to your needs.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
ksp shenoy
Greenhorn

Joined: Jun 20, 2004
Posts: 4
Thanx for the tips
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Search through files - API