aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-09-19 07:24:44 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-09-19 07:24:45 +0000
commit7ba78687635109e3689d8b86daeb9d9500559197 (patch)
treea074f98fc2af828102b122a9f8de9d45e91ba6a9 /java/src/com/android/inputmethod/latin/makedict/FormatSpec.java
parent11ce0545ee27cca29d16a759bd70e8a2b89c50e0 (diff)
parent14087ba52c6b5b7acd25ee4a1ef1663ceb72bbf4 (diff)
downloadlatinime-7ba78687635109e3689d8b86daeb9d9500559197.tar.gz
latinime-7ba78687635109e3689d8b86daeb9d9500559197.tar.xz
latinime-7ba78687635109e3689d8b86daeb9d9500559197.zip
Merge "Add Ver4DictDecoder."
Diffstat (limited to 'java/src/com/android/inputmethod/latin/makedict/FormatSpec.java')
-rw-r--r--java/src/com/android/inputmethod/latin/makedict/FormatSpec.java18
1 files changed, 13 insertions, 5 deletions
diff --git a/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java b/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java
index 96ccd8e49..51b89a02a 100644
--- a/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java
+++ b/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java
@@ -360,18 +360,26 @@ 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.
+ * @param bufferType The type of buffer, as one of USE_* in DictDecoder.
* @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);
+ if (dictFile.isDirectory()) {
+ return new Ver4DictDecoder(dictFile, bufferType);
+ } else if (dictFile.isFile()) {
+ return new Ver3DictDecoder(dictFile, bufferType);
+ }
+ return null;
}
public static DictDecoder getDictDecoder(final File dictFile,
final DictionaryBufferFactory factory) {
- if (!dictFile.isFile()) return null;
- return new Ver3DictDecoder(dictFile, factory);
+ if (dictFile.isDirectory()) {
+ return new Ver4DictDecoder(dictFile, factory);
+ } else if (dictFile.isFile()) {
+ return new Ver3DictDecoder(dictFile, factory);
+ }
+ return null;
}
public static DictDecoder getDictDecoder(final File dictFile) {