Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Java String to CFUrlRef via JNI?



Michael Hall wrote:

On Jan 18, 2006, at 5:39 AM, Mike P wrote:

I'm need to pass a sting into some c++ code and convert the string
to a CFUrlRef.  Does anyone have experience doing such a thing?  It
doesn't need to be passed back.  The c++ code will do what it needs
without returning any value.

I think the usual approach would be to convert the string to a char
or byte array which ever works better with what the native method
expects.

IIRC there is a version of the native routine to create a CFUrlRef from a unicode character sequence directly, without having to muck about with converting the Java unicode sequence to an 8-bit format, and then have Core Foundation decode it back into unicode. There is a JNI routine to get the unicode sequence directly. I recently had to go the other way (CFUrlRef to a Java String), and did it directly with the unicode sequence, and it worked well.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.