aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/makedict/DictDecoder.java
diff options
context:
space:
mode:
authorYuichiro Hanada <yhanada@google.com>2013-08-22 22:43:20 +0900
committerYuichiro Hanada <yhanada@google.com>2013-08-23 20:29:25 +0900
commite9a10ff0f026b5ec458f116afc7a75806574cbcd (patch)
treeb50ff7fc7e7b4a71db9410bfea829905f00817fb /java/src/com/android/inputmethod/latin/makedict/DictDecoder.java
parentb64157bf4720dfc2aa40ad8e6806459012f81082 (diff)
downloadlatinime-e9a10ff0f026b5ec458f116afc7a75806574cbcd.tar.gz
latinime-e9a10ff0f026b5ec458f116afc7a75806574cbcd.tar.xz
latinime-e9a10ff0f026b5ec458f116afc7a75806574cbcd.zip
Add DictDecoder.readDictionaryBinary.
Bug: 10434720 Change-Id: I14690a6e0f922ed1bab3a4b6c9a457ae84d4c1a4
Diffstat (limited to 'java/src/com/android/inputmethod/latin/makedict/DictDecoder.java')
-rw-r--r--java/src/com/android/inputmethod/latin/makedict/DictDecoder.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/makedict/DictDecoder.java b/java/src/com/android/inputmethod/latin/makedict/DictDecoder.java
index c02097fa7..13a42fabf 100644
--- a/java/src/com/android/inputmethod/latin/makedict/DictDecoder.java
+++ b/java/src/com/android/inputmethod/latin/makedict/DictDecoder.java
@@ -44,6 +44,26 @@ public interface DictDecoder {
*/
public CharGroupInfo readPtNode(final int ptNodePos, final FormatOptions formatOptions);
+ /**
+ * Reads a buffer and returns the memory representation of the dictionary.
+ *
+ * This high-level method takes a buffer and reads its contents, populating a
+ * FusionDictionary structure. The optional dict argument is an existing dictionary to
+ * which words from the buffer should be added. If it is null, a new dictionary is created.
+ *
+ * @param dict an optional dictionary to add words to, or null.
+ * @return the created (or merged) dictionary.
+ */
+ @UsedForTesting
+ public FusionDictionary readDictionaryBinary(final FusionDictionary dict)
+ throws FileNotFoundException, IOException, UnsupportedFormatException;
+
+ // Flags for DictionaryBufferFactory.
+ public static final int USE_READONLY_BYTEBUFFER = 0x01000000;
+ public static final int USE_BYTEARRAY = 0x02000000;
+ public static final int USE_WRITABLE_BYTEBUFFER = 0x04000000;
+ public static final int MASK_DICTBUFFER = 0x0F000000;
+
public interface DictionaryBufferFactory {
public DictBuffer getDictionaryBuffer(final File file)
throws FileNotFoundException, IOException;