Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading binary data using DataInputStream class

Status
Not open for further replies.

rm2000

Programmer
May 8, 2002
7
US
Hi,

I am having difficulty reading binary data using the DataInputStream class. The problem is that the high byte characters (>= ascii 128) are being read as signed numbers when I use the myDIS.readFully() method where as I want to read these as the characters corresponding to their (>=128) ascii code.

I could this by going into a loop for the length of the data and then use myDIS.readUnsignedByte() method to read each character out of the stream one by one but obviously it is not a very efficient way and it takes longer to read the file when the file is long.

I was wondering if there is an easier and efficient way of doing the same?

Is their any way to convert signed byte to unsigned byte? (I can get the character once I have the unsigned byte)

Thanks for any help. RM
=============================
Complete solution for digital photos (FREE) @
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top