ID (@NotNull String s) { // Use a byte[] rather than letting jna do the String -> char* marshalling itself. // Turns out about 10% quicker for long strings. if (s.isEmpty()) { return invoke(nsStringCls, stringSel); } byte[] utf16Bytes = s.getBytes(StandardCharsets.UTF_16LE); return create(utf16Bytes); }