This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

CNI byte array


Title: CNI byte array

Hello,

I am working on a project using Cygnus Native Interface. I would like to send a message (which is a byte array) from C back to Java. Then, I need to create a object of JArrayByte (jbyteArray CNI_ArrayPtr = JvNewByteArray(ArrayLength);) and copy the content in the C byte array to the JArrayByte object (memcpy(elements(CNI_ArrayPtr), C_ArrayPtr, ArrayLength);).  It would take much more time and memory if the message traffic is heavy. If I could access the field "data" in class JArray, the problem would be solved. Unfortunately, it's a private field. 

Can you tell me any way that I might avoid this kind of memeory allocating and data copying, and the byte array still can be send out successfully?

Thanks a lot!


Shu-Fang Chen


Shu-Fang Chen
Nortel Networks
e-mobility Development
Tel: (972) 685-2449
Email: shuchen@nortelnetworks.com



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]