com.sun.jna

Class NativeString

class NativeString extends Object implements 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, todd.fast@sun.com twall@users.sf.net

Constructor Summary
NativeString(String string)
Create a native string (NUL-terminated array of char).

If the system property jna.encoding is set, its value will be used to encode the native string.

NativeString(String string, boolean wide)
Create a native string as a NUL-terminated array of wchar_t (if wide is true) or char.

If the system property jna.encoding is set, its value will be used to encode the native charstring.

Method Summary
charcharAt(int index)
intcompareTo(Object other)
booleanequals(Object other)
PointergetPointer()
inthashCode()
intlength()
CharSequencesubSequence(int start, int end)
StringtoString()

Constructor Detail

NativeString

public NativeString(String string)
Create a native string (NUL-terminated array of char).

If the system property jna.encoding is set, its value will be used to encode the native string. If not set or if the encoding is unavailable, the default platform encoding will be used.

NativeString

public NativeString(String string, boolean wide)
Create a native string as a NUL-terminated array of wchar_t (if wide is true) or char.

If the system property jna.encoding is set, its value will be used to encode the native charstring. If not set or if the encoding is unavailable, the default platform encoding will be used.

Parameters: string value to write to native memory wide whether to store the String as wchar_t

Method Detail

charAt

public char charAt(int index)

compareTo

public int compareTo(Object other)

equals

public boolean equals(Object other)

getPointer

public Pointer getPointer()

hashCode

public int hashCode()

length

public int length()

subSequence

public CharSequence subSequence(int start, int end)

toString

public String toString()
Copyright © 2007-2009 Timothy Wall. All Rights Reserved.