I need help creating a Binary file that displays in Hex and readable text! I have already completed the gui part I need help converting to Binary.
Here is what is required:
16 Byte values displayed as 2 digit hex values separated by 2 spaces, then a separator | and then the text representation of these same characters
This is what I have already, I think the problem is that I have read file instead of InputFile:
public void actionPerformed(ActionEvent evt)
{
JFileChooser chooser = new JFileChooser();
int state = chooser.showOpenDialog(null);
File file = chooser.getSelectedFile();
if(file != null && state == JFileChooser.APPROVE_OPTION)
{
JOptionPane.showMessageDialog(null, "Opening: " + file.getPath());
StringBuffer content = new StringBuffer();
BufferedReader reader = null;
try
{
reader = new BufferedReader(new FileReader(file));
String text = null;
while ((text = reader.readLine()) != null)
{
content.append(text).append(System.getProperty("line.separator"));
}
reader.close();
}
catch (IOException e)
{
e.printStackTrace();
}
resultArea.append("Integer.toHexString((int) charToConvert");
}
Any help is appreciated.
Thanks