Write a class called testbasicfile to test your class


Write a Java program to imitate a certain file system and certain utility programs of an operating system. 

Design a class called BasicFile to accomplish the following: 

File Operations
Select a file from a file dialog box, using the class JFileChooser.
List the absolute path of the file
List all files, directories and subdirectories in the path of the file selected.
State the size of the selected file.

File security
Make a backup copy of the selected file, immediately after it has been selected. Use the class JFileChooser to select/specify the backup filename. Use the DataInputStream and DataOutputStream classes and the readByte and writeByte methods for this activity.

File Contents- account for the following information:
The number of lines in the file
The number of words in the file, and 
The number of characters in the file excluding blanks. Numbers must be treated as strings. Use the class StreamTokenizer for this. For instance when this option is chosen the program should output a line saying something like this:

File: xxx.txt has 120 lines, 317 words, 4154 characters

Search the file line by line for a given string. The output must contain the line number followed by the contents of the line that contains the search argument. For instance given the following as input string: Java, where Java is the search string the output would be something like this:

5: on the island of Java
9: The people of JAVA loves jaVa.

Use the class LineNumberReader for this exercise.

Output/Report
Write the entire result and a copy of the original file into an output file called output.txt. Use the JFileChooser class to select or specify the filename. Place this file in the directory containing your source code. 

Test class
Write a class called TestBasicFile to test your class. (You may use the one we started in class) 

NOTE: Use recursion for the following two items
List all files, directories and subdirectories in the path of the file selected.
Search the file line by line for a given string.

REMEMBER THAT I/O OPERATIONS ARE LIKELY TO THROW EXCEPTION. YOUR CODE SHOULD TAKE THIS INTO CONSIDERATION.

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Write a class called testbasicfile to test your class
Reference No:- TGS0124937

Expected delivery within 24 Hours