I'm having an issue reading binary data over a socket. I'm using DataInputStream to read in the data and I'm able to print it out in Hex, but not in any kind of human readable format. Here is what I'm trying to read in and the code I'm using.
I'm supposed to read in one byte with a value of "S".
Here is the code
This code prints out HEX: 4e, which is what I'm expecting, but how would I convert the byte to make it print out the letter "S"?
Thanks for any help in advance.
posted 9 years ago
Ok, I figured that out by using this code instead.
That works great, my only question is now how would I read in and print different data types? For instance the next two values I'm supposed to read in are type short(which contains two bytes and a value of 0x0012) and type String. I'm also able to print out the expected values in HEX if that helps.