Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need to convert a text file into hexadecimal format and display the hex format and the data offset. I have gotten the conversion to

I need to convert a text file into hexadecimal format and display the hex format and the data offset. I have gotten the conversion to hex to work, but I have been unable to figure out what/how to get the data offset. Here is the code I use to convert the file to hex and display.

public static void displayHex(File file) throws IOException { FileInputStream fis = new FileInputStream(file); int i; byte data[] = new byte[16]; do { i = fis.read(data); for (int j = 0; j out.printf("%02X ", data[j]); } while (i != -1); } 

Here is an image that shows various info, all I need is to display it in text not a GUI and only the Hex and Data Offset.

Note 1: The hexadecimal view displays each byte of the file in hexadecimal; it should look something like this, but simpler:

image text in transcribed Note2: The ASCII representation, the Current Offset and the Value Preview are NOT required; also there is no window, no graphics, no colors, just black and white text display. Being a text only display, you are required to display ONLY the Data Offset and the Hexadecimal Representation.

Position: 170 / 4B3 ( 3090 ) 00000000 56 45 52 53 00 00 00 04 00 00 00 01 54 59 50 45TERS 00000010: 00 00 00 04 00 00 00 01 55 55 49 44 00 00 00 10 00000020: F5 4C D8 23 B7 85 42 A5 AD 88 97 08 3B OD 3C DD v Value previe TYPE UUID 48 4D 43 4B 00 00 00 28 00 00 00 00 00 00 00 00 HMCK Data 0o o0 o 00 00 oo 57 52 41 Offset ASCI Hexadecimal Representation 00 53 41 4C 54 44 c1 40 D5 36 Representation 52 00 00 00 04 10 9B DS 82 43 oo0000 0 o0 00 00 R 7E 55 2D 00000080 00000090: 00 00 27 1 000000A0 ooooooB0:| 00 00 00 04 00 00 00 0B 57 52 41 50 00 00 00 04 000000CO: 00 00 00 03 57 50 4B 59 00 00 00 28 AD B9 8A DF UUID 05 99 42 BD B8 68 CA A DB SE E6 43 4C41 53 WRAP 00000OEO: FD 18 6A C7 B3 9B DC 34 F9 30 4F 6A D78F 89 A8 00000OFO: 13 36lA F2 55 55 49 44 00 00 00 10 CO 02 AE D2 j00004 00j00 D 6 UUID CLAS 000100: 94 21 4B 6E 90 19 E2 BE 77 37 01 F9 43 4C 41 53 Kn 00000110: 00 00 00 04 00 00 00 OA 57 52 41 50 00 00 00 04 00000120: 00 00 00 03 57 50 4B 59 00 00 00 28 38 71 7E 81 WRAP 00000150: DF 04 67 69 55 55 49 44 00 00 00 10 2B E3 A8 89 giUUID 00000160: FA 21 49 98 89 90 77 BD A8 57 58 B4 43 4C 41 53 0170 00 00 04 00 00 00 09 57 52 4150 00 00 00 04 WRAP BE Word: 0 Value Preview BE Dword: 4 LE Word: 0 e: LE Dword: 67108864

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Watson Watson

5th Edition

0471715360, 978-0471715368

More Books

Students also viewed these Databases questions

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago