So I'm trying to read a file into a fileinputstream, then read it byte by byte, converting them to Hexadecimals and outputting them in the JText area. The if = 15 doesn't matter at this point, thats just demonstrating when to new line but I didn't implement it yet. However, for whatever reason nothing will write into the JTextarea when I append it.
try {
FileInputStream in = new FileInputStream(file);
FileOutputStream out = new FileOutputStream(file);
bin = new int[23123123];
String[] hexChars = new String[bin.length * 2];
int hexcount = 0;
boolean done=false;
while(!done)
{
int next = in.read();
if(next == -1)
{
done=true;
}
else
{ hexChars[hexcount] = Integer.toHexString(next);
if (hexcount == 15)
{
for (int i = 0; i < 16; i++) {
textArea.append(hexChars[i]);
}
hexcount = 0;
} else
{
hexcount++;
}
count++;
}
}
filelbl.setText("Opened: " + file.getName() + "." );
in.close();
out.close();
}