Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / CORBA / February 2004

Tip: Looking for answers? Try searching our database.

How does CORBA octet (8bit) map to JAVA byte (7bit)?

Thread view: 
Volker Henninger - 17 Feb 2004 09:24 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.