When data moves between IDL and a Java object, IDL automatically converts variable data types.

The following table maps how Java data types correlate to IDL data types.

Java Type (# bytes)

IDL Type

Notes

boolean (1)

Integer

True becomes 1, false becomes 0

byte (1)

Byte

 

char (2)

Byte

The bridge handles Java UTF characters

short (2)

Integer

 

int (4)

Long

 

long (8)

Long64

 

float (4)

Float

 

double (8)

Double

 

Java.lang.String

String

Java has the notion of a NULL string (the java.lang.String reference equals null) and the concept of an empty string. IDL makes no such differentiation, so both are identically converted.

Arrays of the above types

IDL array of the same dimensions (from 1 to 8 dimensions) and corresponding type.

 

Java.lang.Object (or array of java.lang.Object) and any subclass of java.lang.Object

IDL array of primitives or IDL array of IDLjavaObjects

In Java, everything is a subclass of Object. If the Java object is an array of primitives, an IDL array of the same dimensions and corresponding type (shown in this table) is created. IDL similarly converts arrays of primitives, arrays of strings, arrays of other Java objects to an IDL Java object of the same dimensions. If the Object is some single Java object, IDL creates an object reference of the IDLjavaObject class.

Null object

IDL Null object

 

The following table shows how data types are mapped from IDL to Java.

IDL Type

Java Type (# bytes)

Notes

Byte

byte (1)

IDL bytes range from 0 to 255, Java bytes are -128 to 127. IDL bytes converted to Java bytes will retain their binary representation but values greater than 127 will change. For example, BYTE(255) becomes a Java byte of -1. If BYTE is converted to wider Java value, the sign and value is preserved.

Integer

short (2)

 

Unsigned integer

short (2)

IDL unsigned integers range from 0 to 65535, Java shorts are -32768 to 32767. IDL unsigned integers converted to Java shorts will retain their binary representation but values greater than 32768 will change. For example, UINT(65535) becomes a Java short of -1. If UINT is converted to wider Java value, the sign and value is preserved.

Long

int (4)

 

Unsigned long

int (4)

IDL unsigned longs range from 0 to 4294967295, Java ints are - 2147483648 to 2147483647. IDL unsigned longs converted to Java ints will retain their binary representation but values greater than 2147483647 will change. For example, ULONG(4294967295) becomes a Java int of -1. If ULONG is converted to wider Java value, the sign and value is preserved.

Long64

long (8)

 

Unsigned Long64

long (8)

IDL unsigned long64 range from 0 to 18446744073709551615, Java ints range from -9223372036854775808 to 9223372036854775807. IDL unsigned long64 converted to Java longs will retain their binary representation values greater than 9223372036854775807 will change. For example, ULONG64(1844674407370955 1615) becomes a Java long of -1.

Float

float (4)

 

Double

double (8)

 

String

Java.lang.String

 

Arrays of the above types

Java array of the same dimensions and corresponding type

 

IDLjavaObject

Object of corresponding Java class

 

Arrays of objects

Java array of the same dimensions, consisting of corresponding Java proxy objects

Only objects of type IDLjavaObject are converted.

Null object

Java null

 

When calling a Java method or constructor from IDL, the data parameters are promoted as little as possible based on the signature of the given method. The following table shows how data types are promoted within Java relative to IDL.

Note: When strings and arrays are passed between IDL and Java, the array must be copied. Depending upon the size of the array, this copy may be time intensive. Care should be taken to minimize array copying.

IDL Type

Java Type (# bytes)

Notes

Byte

byte, char, short, int, long, float, double, boolean

 

Integer

short, int, long, float, double, boolean

 

Unsigned integer

short, int, long, float, double, boolean

 

Long

int, long, float, double, boolean

 

Unsigned long

int, long, float, double, boolean

 

Long64

long, float, double, boolean

 

Unsigned Long64

long, float, double, boolean

 

Float

float, double

 

Double

double

 

String

Java.lang.String

 

IDLjavaObject

Java.lang.Object