Package com.mku.utils
Class FileSearcher
java.lang.Object
com.mku.utils.FileSearcher
Class searches for files in a SalmonDrive by filename.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFunctional interface to notify when result is found.static enumEvent status types. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanTrue if a search is running.booleanTrue if last search was stopped by user.search(IVirtualFile dir, String terms, boolean any, FileSearcher.OnResultFoundListener OnResultFound, Consumer<FileSearcher.SearchEvent> onSearchEvent) Search files in directory and its subdirectories recursively for matching terms.voidstop()
-
Constructor Details
-
FileSearcher
public FileSearcher()
-
-
Method Details
-
stop
public void stop() -
isRunning
public boolean isRunning()True if a search is running.- Returns:
- True if running
-
isStopped
public boolean isStopped()True if last search was stopped by user.- Returns:
- True if user stopped
-
search
public IVirtualFile[] search(IVirtualFile dir, String terms, boolean any, FileSearcher.OnResultFoundListener OnResultFound, Consumer<FileSearcher.SearchEvent> onSearchEvent) Search files in directory and its subdirectories recursively for matching terms.- Parameters:
dir- The directory to start the search.terms- The terms to search for.any- True if you want to match any term otherwise match all terms.OnResultFound- Callback interface to receive notifications when results found.onSearchEvent- Callback interface to receive status events.- Returns:
- An array with all the results found.
-