View Full Version : Java searcher program CHALLANGE

01-08-2012, 09:22 PM
create an application, searcher that takes two command line arguments: the starting directory and the target to find.

Searcher makes use of a recursive algorithm with the method signature: public static void scan (String path). This recursive algorithm needs to scan through directories and over file names in order to locate the specified file from the command line. You will, in all likelihood, need to make your FileIOHelper class described below. once you located your file you can stop executing and display the output of where the file was located.

Create a class called FileIOHelper. This has two private String arrays, directories and files. It also includes two public instance int variables dirLength and fileLength witch stores length of directories and files String arrays respectively.

it has one constructor that takes a file object, witch is used to determine the directory where you are going to be getting the information from. the constructor needs to iterate through each array element provided and assign the String to the right array(it's either a dir or file). Your arrays need to resize properly as you iterate through them.

The fileIOHelper has two public methods, getDirectories() and getFiles() both return their respective protected String arrays.

The FileIOHelper also has 2 private methods addToFile() and addToDirectory() witch both take a String and return a String array

1)keeping track of witch stack your working on currently - loggin information to a file through a static logger class.
2)using assertions where posible.:thumbsup:

Came across it some weeks ago and thought it was a fun project to tackle and thought i'd share it