On Jan 13, 2:23 am, 飞 杨 <[email protected]> wrote: > Dear sir, > > I found, in the protocolbuf int encode, the byte 0xFF may appear, then > how can i distinguish the EOS and the business -1, the two both are -1 > when use the inputstream.read()..
Pay closer attention to the definition of InputStream.read(). The return type is an int, which is 32-bits. '-1' and 0x000000FF are distinct values. Make the check before casting the return value to an byte. That being said, I wouldn't read data one byte at a time either without a good reason. Adam -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
