Add jni interface to use on memory dictionary.

Bug; 14166482

Change-Id: I33ab08dad1e39aa7617d391f7eb2561d6f2504bb
This commit is contained in:
Keisuke Kuroyanagi 2014-04-21 16:22:00 -07:00
parent c6704dbe51
commit 61cb852d33
2 changed files with 14 additions and 0 deletions

View file

@ -151,6 +151,8 @@ public final class BinaryDictionary extends Dictionary {
private static native long openNative(String sourceDir, long dictOffset, long dictSize,
boolean isUpdatable);
private static native long createOnMemoryNative(long formatVersion,
String locale, String[] attributeKeyStringArray, String[] attributeValueStringArray);
private static native void getHeaderInfoNative(long dict, int[] outHeaderSize,
int[] outFormatVersion, ArrayList<int[]> outAttributeKeys,
ArrayList<int[]> outAttributeValues);

View file

@ -65,6 +65,13 @@ static jlong latinime_BinaryDictionary_open(JNIEnv *env, jclass clazz, jstring s
return reinterpret_cast<jlong>(dictionary);
}
static jlong latinime_BinaryDictionary_createOnMemory(JNIEnv *env, jclass clazz,
jlong formatVersion, jstring locale, jobjectArray attributeKeyStringArray,
jobjectArray attributeValueStringArray) {
// TODO: Implement.
return 0;
}
static void latinime_BinaryDictionary_flush(JNIEnv *env, jclass clazz, jlong dict,
jstring filePath) {
Dictionary *dictionary = reinterpret_cast<Dictionary *>(dict);
@ -467,6 +474,11 @@ static const JNINativeMethod sMethods[] = {
const_cast<char *>("(Ljava/lang/String;JJZ)J"),
reinterpret_cast<void *>(latinime_BinaryDictionary_open)
},
{
const_cast<char *>("createOnMemoryNative"),
const_cast<char *>("(JLjava/lang/String;[Ljava/lang/String;[Ljava/lang/String;)J"),
reinterpret_cast<void *>(latinime_BinaryDictionary_createOnMemory)
},
{
const_cast<char *>("closeNative"),
const_cast<char *>("(J)V"),