Results 1 to 2 of 2
- 01-08-2012, 11:51 PM #1Member
- Join Date
- Jan 2012
- Rep Power
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
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 whould like to compare my work to others.
Re: Java searcher program CHALLANGE
This looks like a nice project and I think that I speak for all in wishing much luck in successfully completing it and getting a decent grade from it.
- By popey in forum New To JavaReplies: 2Last Post: 10-22-2009, 06:32 PM
- By safecracker in forum New To JavaReplies: 8Last Post: 12-04-2008, 06:41 AM
- By hiklior in forum New To JavaReplies: 2Last Post: 04-24-2008, 06:05 AM
- By Java Tip in forum java.ioReplies: 0Last Post: 04-04-2008, 03:40 PM
- By JavaBean in forum Java TipReplies: 0Last Post: 10-04-2007, 10:33 PM