aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java
diff options
context:
space:
mode:
authorKen Wakasa <kwakasa@google.com>2013-09-12 09:15:27 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-09-12 09:15:27 -0700
commit712fb6c613884542bde094b5d01e5167b9a76e40 (patch)
tree954fc045ae7f9752cfdd2e194e22cd84dc572e30 /java/src/com/android/inputmethod/latin/makedict/FormatSpec.java
parentb66ecdeb7f589e2963e3e57768fd1fc71aad16b5 (diff)
parenta6dc3056ffefd40e8fa93060d096c80889e82633 (diff)
downloadlatinime-712fb6c613884542bde094b5d01e5167b9a76e40.tar.gz
latinime-712fb6c613884542bde094b5d01e5167b9a76e40.tar.xz
latinime-712fb6c613884542bde094b5d01e5167b9a76e40.zip
am a6dc3056: Merge "Add getDictDecoder."
* commit 'a6dc3056ffefd40e8fa93060d096c80889e82633': Add getDictDecoder.
Diffstat (limited to 'java/src/com/android/inputmethod/latin/makedict/FormatSpec.java')
-rw-r--r--java/src/com/android/inputmethod/latin/makedict/FormatSpec.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java b/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java
index bf35f6a8a..44ae33de1 100644
--- a/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java
+++ b/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java
@@ -18,8 +18,11 @@ package com.android.inputmethod.latin.makedict;
import com.android.inputmethod.annotations.UsedForTesting;
import com.android.inputmethod.latin.Constants;
+import com.android.inputmethod.latin.makedict.DictDecoder.DictionaryBufferFactory;
import com.android.inputmethod.latin.makedict.FusionDictionary.DictionaryOptions;
+import java.io.File;
+
/**
* Dictionary File Format Specification.
*/
@@ -341,6 +344,28 @@ public final class FormatSpec {
}
}
+ /**
+ * Returns new dictionary decoder.
+ *
+ * @param dictFile the dictionary file.
+ * @param bufferType the flag indicating buffer type which is used by the dictionary decoder.
+ * @return new dictionary decoder if the dictionary file exists, otherwise null.
+ */
+ public static DictDecoder getDictDecoder(final File dictFile, final int bufferType) {
+ if (!dictFile.isFile()) return null;
+ return new Ver3DictDecoder(dictFile, bufferType);
+ }
+
+ public static DictDecoder getDictDecoder(final File dictFile,
+ final DictionaryBufferFactory factory) {
+ if (!dictFile.isFile()) return null;
+ return new Ver3DictDecoder(dictFile, factory);
+ }
+
+ public static DictDecoder getDictDecoder(final File dictFile) {
+ return getDictDecoder(dictFile, DictDecoder.USE_READONLY_BYTEBUFFER);
+ }
+
private FormatSpec() {
// This utility class is not publicly instantiable.
}