| java.lang.Object org.apache.harmony.misc.accessors.StringAccessor
StringAccessor | public class StringAccessor (Code) | | This class allows to copy data from String objects to native buffers, and
construct String objects from native strings. This allows to pass and receive
string arguments from native libraries.
The main difference between modified UTF8 and UTF8 is two trailing 0 instead
of one (see JNI 5.0 spec on Modified UTF-8 Strings).
|
Method Summary | |
public int | compareString(String strObj, long str, int len, int byteOrder) Lexicographically compares Java string with native UTF-16 encoded string
in byteOrder order. | public int | compareString(String strObj, long str, int len) Lexicographically compares Java string with native UTF-16 encoded string
in platform default order. | public int | compareStringAndChars(String strObj, char[] str, int offset, int len) Lexicographically compares the Java string with the character sequence
represented by the part of char array str. | public int | compareStringUTF(String strObj, long str) Lexicographically compares Java string with native UTF-8 encoded string .
The comparison is based on the Unicode value of each character in the
strings. | native public String | createOrderedString(long wstr, int order) Creates String from 0 terminated UTF16 (Unicode) native string of max
strlen length in bytes. | native public String | createString(long wstr) Creates String from 0 terminated UTF16 (Unicode) native string
This method has an effect of NewString JNI call. | native public String | createString(long wstr, long strlen) Creates String from 0 terminated UTF16 (Unicode) native string of max
strlen length in bytes. | native public String | createStringUTF(long str) Creates String from 0 terminated modified UTF8 native string
This method has an effect of NewStringUTF JNI call. | native public String | createStringUTF(long str, long strlen) Creates String from 0 terminated modified UTF8 native string of max
strlen length in bytes. | native public long | getChars(String str) Creates UTF16 (Unicode) copy of String object in native heap. | public long | getChars(long buf, long buflen, String str, int start, int len) Copies len UTF16 (Unicode) encoded chars or buflen bytes whichever is
smaller from String to native buffer. | static StringAccessor | getInstance() | native public long | getUTFChars(String str) Creates modified UTF8 encoded copy of String object in native heap.
Allocates buffer enough to represent 0 terminated string in native heap.
Adds 2 trailing 0 to the end of native string. | public long | getUTFChars(long buf, long buflen, String str, int start, int len) Copies len modified UTF8 encoded chars or buflen bytes whichever is
smaller from String to native buffer. |
compareString | public int compareString(String strObj, long str, int len, int byteOrder)(Code) | | Lexicographically compares Java string with native UTF-16 encoded string
in byteOrder order.
Parameters: strObj - Java string Parameters: str - native string memory address Parameters: len - length of native string Parameters: byteOrder - either ByteOrder.BIG_ENDIAN or ByteOrder.LITTLE_ENDIAN 0 if strings are equal,<0 if Java string is lexicographically less than the native string,>0 if Java string is lexicographically greater than the native string. |
compareString | public int compareString(String strObj, long str, int len)(Code) | | Lexicographically compares Java string with native UTF-16 encoded string
in platform default order.
Parameters: strObj - Java string Parameters: str - native string memory address Parameters: len - length of native string 0 if strings are equal,<0 if Java string is lexicographically less than the native string,>0 if Java string is lexicographically greater than the native string. |
compareStringAndChars | public int compareStringAndChars(String strObj, char[] str, int offset, int len)(Code) | | Lexicographically compares the Java string with the character sequence
represented by the part of char array str.
Parameters: strObj - Java string Parameters: str - char array Parameters: offset - offset within char array 0 if strings are equal,<0 if Java string is lexicographically less than the native string,>0 if Java string is lexicographically greater than the native string. |
compareStringUTF | public int compareStringUTF(String strObj, long str)(Code) | | Lexicographically compares Java string with native UTF-8 encoded string .
The comparison is based on the Unicode value of each character in the
strings. The character sequence represented by String object is compared
lexicographically to the character sequence represented by the native
UTF-8 string. The result is a negative integer if String object
lexicographically precedes the argument str. The result is a positive
integer if this String object lexicographically follows the argument str.
The result is zero if the strings are equal.
Parameters: strObj - Java string Parameters: str - native string memory address 0 if strings are equal,<0 if Java string is lexicographically less than the native string,>0 if Java string is lexicographically greater than the native string. |
createOrderedString | native public String createOrderedString(long wstr, int order)(Code) | | Creates String from 0 terminated UTF16 (Unicode) native string of max
strlen length in bytes.
This method has an effect of NewString JNI call.
Parameters: wstr - memory address of native Parameters: order - byte order new String |
createString | native public String createString(long wstr)(Code) | | Creates String from 0 terminated UTF16 (Unicode) native string
This method has an effect of NewString JNI call.
Parameters: wstr - memory address of native new String |
createString | native public String createString(long wstr, long strlen)(Code) | | Creates String from 0 terminated UTF16 (Unicode) native string of max
strlen length in bytes.
This method has an effect of NewString JNI call.
Parameters: wstr - memory address of native Parameters: strlen - max length of native string in bytes new String |
createStringUTF | native public String createStringUTF(long str)(Code) | | Creates String from 0 terminated modified UTF8 native string
This method has an effect of NewStringUTF JNI call.
Parameters: str - memory address of native new String |
createStringUTF | native public String createStringUTF(long str, long strlen)(Code) | | Creates String from 0 terminated modified UTF8 native string of max
strlen length in bytes.
This method has an effect of NewStringUTF JNI call.
Parameters: str - memory address of native Parameters: strlen - max length of native string in bytes new String |
getChars | native public long getChars(String str)(Code) | | Creates UTF16 (Unicode) copy of String object in native heap. Allocates
buffer enough to represent 0 terminated string in native heap. The
returned buffer should be deallocated by
MemoryAccessor.free
This method has an effect of GetStringChars JNI call.
Parameters: str - -string to copy buffer memory address |
getChars | public long getChars(long buf, long buflen, String str, int start, int len)(Code) | | Copies len UTF16 (Unicode) encoded chars or buflen bytes whichever is
smaller from String to native buffer. If there is a room in buffer after
last copied string char, 2 trailing 0 are added. Buffer should be at
least 2 * len bytes to guaranty String chars will fully fit.
This method has an effect of GetStringRegion JNI call.
Parameters: buf - memory address of native buf Parameters: buflen - length of buffer in bytes Parameters: str - string to copy Parameters: start - first char index Parameters: len - number of chars to copy buf |
getUTFChars | native public long getUTFChars(String str)(Code) | | Creates modified UTF8 encoded copy of String object in native heap.
Allocates buffer enough to represent 0 terminated string in native heap.
Adds 2 trailing 0 to the end of native string. The returned buffer should
be deallocated by
MemoryAccessor.free
This method has an effect of GetStringUTFChars JNI call.
Parameters: str - string to copy buffer memory address |
getUTFChars | public long getUTFChars(long buf, long buflen, String str, int start, int len)(Code) | | Copies len modified UTF8 encoded chars or buflen bytes whichever is
smaller from String to native buffer. If there is a room in buffer after
last copied string char, 2 trailing 0 are added. For ANSI chars buffer
should be at least len bytes, for international chars buffer should be at
least 3 * len bytes (see JNI 5.0 spec on Modified UTF-8 Strings) to
guaranty String chars will fully fit.
This method has an effect of GetStringUTFRegion JNI call.
Parameters: buf - memory address of native buf Parameters: buflen - length of buffer in bytes Parameters: str - string to copy Parameters: start - first char index Parameters: len - number of chars to copy buf |
|
|