|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD | |||||||||
java.lang.Objectjava.lang.Enum<Charset>
com.jinvoke.Charset
public enum Charset
Indicates how Java Strings are converted when passing to native code.
Strings in native code can be wide character(Unicode i.e. wchar_t*) or single character(Ansi i.e. char*).
This enumeration specifies the character set for native methods using the
NativeImport annotation, and for String, StringBuffer and StringBuilder members
of native structs using the NativeStruct annotation.
This attribute affects how arguments of type are passed to the native function.
Examples:
The following code example shows how to specify a charset enumeration value when declaring a @NativeStruct. In this case, the pszDisplayName and lpszTitle members are converted to/from Ansi strings.
import com.jinvoke.Charset;
import com.jinvoke.NativeStruct;
@NativeStruct(charset=Charset.ANSI)
public class BrowseInfo {
public int hwndOwner;
public int pidlRoot;
public StringBuffer pszDisplayName; // display name of item selected - returned
public String lpszTitle; // text to go in the banner over the tree
public int ulFlags;
public int lpfn;
public int lParam;
public int iImage;
}
The following code example shows how to specify a charset enumeration value when declaring a native method using the @NativeImport annotation:
@NativeImport(library="Shell32", charset=Charset.ANSI)
public static native boolean SHGetPathFromIDListA(int pidl, StringBuffer path);
| Enum Constant Summary | |
|---|---|
ANSI
Convert Strings to single-character strings. |
|
AUTO
Automatically convert Strings appropriately for the target operating system. |
|
UNICODE
Convert Strings to wide-character strings. |
|
| Method Summary | |
|---|---|
int |
getIntCode()
|
static Charset |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. |
static Charset[] |
values()
Returns an array containing the constants of this enum type, in the order they're declared. |
| Methods inherited from class java.lang.Enum |
|---|
compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Enum Constant Detail |
|---|
public static final Charset ANSI
char when converting Strings to native strings.
public static final Charset UNICODE
wchar_t when converting Strings to native strings.
public static final Charset AUTO
| Method Detail |
|---|
public static final Charset[] values()
for(Charset c : Charset.values())
System.out.println(c);
public static Charset valueOf(java.lang.String name)
name - the name of the enum constant to be returned.
java.lang.IllegalArgumentException - if this enum type has no constant
with the specified namepublic int getIntCode()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD | |||||||||