class Foundation {

    public static ID cfString(String s) {
        // Use a byte[] rather than letting jna do the String -> char* marshalling itself.
        // Turns out about 10% quicker for long strings.
        try {
            byte[] utf16Bytes = s.getBytes("UTF-16LE");
            return foundationLibrary.CFStringCreateWithBytes(null, utf16Bytes,
                    utf16Bytes.length,
                    StringEncoding.kCFStringEncodingUTF16LE.value, (byte) 0);
        } catch (UnsupportedEncodingException x) {
            throw new RococoaException(x);
        }
    }

    private  Foundation();

}