diff options
author | 2014-02-24 22:17:27 +0900 | |
---|---|---|
committer | 2014-02-24 22:54:01 +0900 | |
commit | 890b44e5376413adc73025e046072bcce3e119c5 (patch) | |
tree | 4baf38d0e2206ef2ee6fbe992e976fea71e74bbb /java/src/com/android/inputmethod/latin/makedict/FormatSpec.java | |
parent | b08a9e021c2e5be7375295858b28bf8c4b9767b9 (diff) | |
download | latinime-890b44e5376413adc73025e046072bcce3e119c5.tar.gz latinime-890b44e5376413adc73025e046072bcce3e119c5.tar.xz latinime-890b44e5376413adc73025e046072bcce3e119c5.zip |
Correctly read the header of APK-embedded dicts
Bug: 13164518
Change-Id: I8768ad887af8b89ad9f29637f606c3c68629c7ca
Diffstat (limited to 'java/src/com/android/inputmethod/latin/makedict/FormatSpec.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/makedict/FormatSpec.java | 18 |
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() { |