Package com.sun.jna
Class NativeString
java.lang.Object
com.sun.jna.NativeString
- All Implemented Interfaces:
CharSequence
,Comparable
Provides a temporary allocation of an immutable C string
(
const char*
or const wchar_t*
) for use when
converting a Java String into a native memory function argument.- Author:
- Todd Fast, [email protected], [email protected]
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionNativeString
(WString string) Create a native string as a NUL-terminated array ofwchar_t
.NativeString
(String string) Create a native string (NUL-terminated array ofchar
).NativeString
(String string, boolean wide) Create a native string as a NUL-terminated array ofwchar_t
(ifwide
is true) orchar
.NativeString
(String string, String encoding) Create a native string (NUL-terminated array ofchar
), using the requested encoding. -
Method Summary
Modifier and TypeMethodDescriptionchar
charAt
(int index) int
boolean
int
hashCode()
int
length()
subSequence
(int start, int end) toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.CharSequence
chars, codePoints, isEmpty
-
Field Details
-
WIDE_STRING
- See Also:
-
-
Constructor Details
-
NativeString
Create a native string (NUL-terminated array ofchar
).Uses the encoding returned by
Native.getDefaultStringEncoding()
. -
NativeString
Create a native string as a NUL-terminated array ofwchar_t
(ifwide
is true) orchar
.If not
wide
, the encoding is obtained fromNative.getDefaultStringEncoding()
.- Parameters:
string
- value to write to native memorywide
- whether to store the String aswchar_t
-
NativeString
Create a native string as a NUL-terminated array ofwchar_t
. -
NativeString
Create a native string (NUL-terminated array ofchar
), using the requested encoding.
-
-
Method Details
-
hashCode
public int hashCode() -
equals
-
toString
- Specified by:
toString
in interfaceCharSequence
- Overrides:
toString
in classObject
-
getPointer
-
charAt
public char charAt(int index) - Specified by:
charAt
in interfaceCharSequence
-
length
public int length()- Specified by:
length
in interfaceCharSequence
-
subSequence
- Specified by:
subSequence
in interfaceCharSequence
-
compareTo
- Specified by:
compareTo
in interfaceComparable
-