Question
*** In Java *** I need the rest of this assignment completed. I have it 90% done, I just cant for the life of me
*** In Java ***
I need the rest of this assignment completed. I have it 90% done, I just cant for the life of me figure out the rest.
What I need done:
Ask the user if they want to change the value in that byte position. If yes, allow the user to type in a byte value AS A TWO DIGIT HEX
Replace the value in the position with the new value.
Repeat this until the user specifies a position of -1.
Allow the user to save the binary file TO A NEW FILE LOCATION. Do NOT allow the user to save to a currently existing file.
Use a hex editor to verify that the file was correctly written and the changes were made.
** Please show what you've changed **
My code:
BinaryFileExplorer.java
import java.io.DataOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.RandomAccessFile; import java.util.Scanner; import java.util.ListIterator;
/** * */ public class BinaryFileExplorer{
/** * @param args the command line arguments */ public static void main(String[] args) throws IOException { Scanner in = new Scanner(System.in); System.out.println("Enter name of file: "); String filename = in.nextLine(); File file = new File(filename); if (file.exists()) { System.out.println(file.getAbsoluteFile()); RandomAccessFile raf = new RandomAccessFile(file, "r"); System.out.println("Size: " + file.length() + " bytes."); System.out.println("Attempting to record file to AList"); AList
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started