aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2014-02-24 13:57:46 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-02-24 13:57:46 +0000
commit6e224a236a0a7cd253f74c7ed8b9a8f2eea41600 (patch)
tree9214094f6008e98fcca15af9453ca4f232ad55b8 /java/src/com/android/inputmethod/latin/makedict/FormatSpec.java
parent64ace089a8cde06ff030aa491b798ec7d32a3ad7 (diff)
parent890b44e5376413adc73025e046072bcce3e119c5 (diff)
downloadlatinime-6e224a236a0a7cd253f74c7ed8b9a8f2eea41600.tar.gz
latinime-6e224a236a0a7cd253f74c7ed8b9a8f2eea41600.tar.xz
latinime-6e224a236a0a7cd253f74c7ed8b9a8f2eea41600.zip
Merge "Correctly read the header of APK-embedded dicts"
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, 11 insertions, 7 deletions
diff --git a/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java b/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java
index c7635eff9..9abecbfec 100644
--- a/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java
+++ b/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java
@@ -326,30 +326,34 @@ public final class FormatSpec {
* Returns new dictionary decoder.
*
* @param dictFile the dictionary file.
+ * @param offset the offset in the file.
+ * @param length the length of the file, in bytes.
* @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) {
+ public static DictDecoder getDictDecoder(final File dictFile, final long offset,
+ final long length, final int bufferType) {
if (dictFile.isDirectory()) {
return new Ver4DictDecoder(dictFile, bufferType);
} else if (dictFile.isFile()) {
- return new Ver2DictDecoder(dictFile, bufferType);
+ return new Ver2DictDecoder(dictFile, offset, length, bufferType);
}
return null;
}
- public static DictDecoder getDictDecoder(final File dictFile,
- final DictionaryBufferFactory factory) {
+ public static DictDecoder getDictDecoder(final File dictFile, final long offset,
+ final long length, final DictionaryBufferFactory factory) {
if (dictFile.isDirectory()) {
return new Ver4DictDecoder(dictFile, factory);
} else if (dictFile.isFile()) {
- return new Ver2DictDecoder(dictFile, factory);
+ return new Ver2DictDecoder(dictFile, offset, length, factory);
}
return null;
}
- public static DictDecoder getDictDecoder(final File dictFile) {
- return getDictDecoder(dictFile, DictDecoder.USE_READONLY_BYTEBUFFER);
+ public static DictDecoder getDictDecoder(final File dictFile, final long offset,
+ final long length) {
+ return getDictDecoder(dictFile, offset, length, DictDecoder.USE_READONLY_BYTEBUFFER);
}
private FormatSpec() {