[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Java Newcomer: Byte Data Type Conversion



To read only the first byte, use readUnsignedByte().

Raj

>From: Paul Philion <philion@acmerocket.com>
>To: ajug-members@www.ajug.org
>Subject: Re: Java Newcomer: Byte Data Type Conversion
>Date: Tue, 17 Dec 2002 12:57:03 -0500
>
>Greg -
>
>Wrap the InputStream in a DataInputStream, then use readInt();
>
>Gregory A. Lusk wrote:
>
>>Hello all,
>>
>>
>>
>>I am reading data into a byte array from an InputStream using the read() 
>>method.  I need to be able to read the first byte, which is always a 
>>header field containing the total length of the packet, and convert that 
>>to an integer value.  Can someone recommend how to do this?  Sorry this 
>>question is so elementary.
>>
>>
>>
>>Thanks,
>>
>>
>>
>>Greg Lusk
>>
>>
>>


_________________________________________________________________
MSN 8 with e-mail virus protection service: 3 months FREE*. 
http://join.msn.com/?page=features/virus&xAPID=42&PS=47575&PI=7324&DI=7474&SU= 
http://www.hotmail.msn.com/cgi-bin/getmsg&HL=1216hotmailtaglines_eliminateviruses_3mf