Re: How can I send a char array over the Obj-C/Java bridge as a byte array?
Re: How can I send a char array over the Obj-C/Java bridge as a byte array?
- Subject: Re: How can I send a char array over the Obj-C/Java bridge as a byte array?
- From: Dave Thorup <email@hidden>
- Date: Mon, 28 Jul 2003 17:41:19 -0600
On 7/28/03 3:50 PM, "Yojimbo" <email@hidden> wrote:
>
My knowledge on the Java bridge is limited and I've found virtually no
>
documentation that helps me in this situation. I was wondering if
>
anyone on this list might happen to know how I can pass this data
>
across the Obj-C/Java bridge unaltered from an Obj-C method or could
>
point me in the right direction to look for solutions?
You might try using NSData. You could create the NSData class from an array
of bytes on the Objective-C side by using (Warning: typed in Mail, use at
own risk):
NSData* data;
data = [NSData dataWithBytes:byteArray length:length]
And then on the Java side you could get back the byte array using:
NSData data; // you'd have sent this as a parameter or something
byte[] byteArray;
byteArray = data.bytes(0, data.length());
That should do it. And if you need to do it the other way (Sending the
NSData from Java to Objective-C) then it should be pretty straight forward.
____________________________________
Dave Thorup
Software Engineer
email@hidden
www.kuwan.net
Defaults Manager - The premier editor for Mac OS X's User Defaults /
Preferences database.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.