Converting Binary File to Text File
Hello,
I'm having trouble reading a binary file and converting it into readable text. The Binary file is a list of numbers, 0 thru 256, in 8-bit format. The code I have for it is:
<PRE>
import java.io.*;
import java.io.File;
import java.lang.*;
import java.util.*;
import java.sql.*;
public class ReadBinary {
// **********************************************************
public ReadBinary() {
}
// **********************************************************
public static void main(String args[]) {
try {
RandomAccessFile raf = new RandomAccessFile("input.bin","rw");
for (int x=0;x<1000;x++)
System.out.println(Byte.toString(raf.readByte()));
}
catch (Exception e) {
System.out.println("Error found");
System.exit(0);
}
}
// **********************************************************
}
</PRE>
I have a text version of the Binary file, but my program output does not match at all.
Thanks,
--Edriss

