Hi,
I try to send binary data (8 bit) using the CORBA octet data type. As
far as I know this map directly to byte in Java. However, Javadoc says
that bytes' min and max values are 2^7-1, which is obviously only 7
bits. On one side I use C++ and the data I get is really 8 bit, on the
other side I use JAVA and the highest bit gets lost. Also I cannot
assign eg 0xFE to a byte, the compiler complains on trying to match a
int to a byte.
So how can this be solved? Do I have to use CORBA::short instead?
Thanks
Volker
David Rabinowitz - 17 Feb 2004 10:31 GMT
I think you misunderstood the javadoc. Java's byte is an 8 bit
primitive. It's range is form -(2^7) to (2^7)-1, clearly you need enough
bits to have 2^8 different numbers...
I've worked with octet before, it maps to Java's byte without problems.
David
> Hi,
> I try to send binary data (8 bit) using the CORBA octet data type. As
[quoted text clipped - 7 lines]
> Thanks
> Volker
Tillmann Wegst - 18 Feb 2004 14:37 GMT
Hi Volker,
> I cannot assign eg 0xFE to a byte
Java is more strictly typed than C/C++; therefore you need to
cast the 0xFE to a byte:
byte b=(byte)0xFE;
Best,
Tillmann
> Hi,
> I try to send binary data (8 bit) using the CORBA octet data type. As
[quoted text clipped - 7 lines]
> Thanks
> Volker