If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

Java searcher program CHALLANGE

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

extra
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.

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