diff options
author | 2013-08-22 16:52:05 +0900 | |
---|---|---|
committer | 2013-09-05 16:19:26 +0900 | |
commit | 55f5f7a005c00ec764ed19647b245e48636a0440 (patch) | |
tree | 7b953ae8cb89f3d52b6ba9e40f41ac7e25295cac /java/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java | |
parent | 87855f97d1a795c09e31b952fa8ef25890437b5c (diff) | |
download | latinime-55f5f7a005c00ec764ed19647b245e48636a0440.tar.gz latinime-55f5f7a005c00ec764ed19647b245e48636a0440.tar.xz latinime-55f5f7a005c00ec764ed19647b245e48636a0440.zip |
[Refactor] Add writeDictionaryHeader.
Change-Id: I69026c47ce1d23f5c39c99ace76fa6b96cd1ce1b
Diffstat (limited to 'java/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/java/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java b/java/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java index 79f5ad8bd..019e30b2e 100644 --- a/java/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java +++ b/java/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java @@ -912,23 +912,15 @@ public class BinaryDictEncoderUtils { } /** - * Dumps a FusionDictionary to a file. + * Writes a file header to an output stream. * - * @param destination the stream to write the binary data to. + * @param destination the stream to write the file header to. * @param dict the dictionary to write. * @param formatOptions file format options. */ - /* package */ static void writeDictionaryBinary(final OutputStream destination, + /* package */ static void writeDictionaryHeader(final OutputStream destination, final FusionDictionary dict, final FormatOptions formatOptions) - throws IOException, UnsupportedFormatException { - - // Addresses are limited to 3 bytes, but since addresses can be relative to each node - // array, the structure itself is not limited to 16MB. However, if it is over 16MB deciding - // the order of the PtNode arrays becomes a quite complicated problem, because though the - // dictionary itself does not have a size limit, each node array must still be within 16MB - // of all its children and parents. As long as this is ensured, the dictionary file may - // grow to any size. - + throws IOException, UnsupportedFormatException { final int version = formatOptions.mVersion; if (version < FormatSpec.MINIMUM_SUPPORTED_VERSION || version > FormatSpec.MAXIMUM_SUPPORTED_VERSION) { @@ -975,6 +967,24 @@ public class BinaryDictEncoderUtils { destination.write(bytes); headerBuffer.close(); + } + + /** + * Dumps a FusionDictionary to a file. + * + * @param destination the stream to write the dictionary body to. + * @param dict the dictionary to write. + * @param formatOptions file format options. + */ + /* package */ static void writeDictionaryBody(final OutputStream destination, + final FusionDictionary dict, final FormatOptions formatOptions) throws IOException { + + // Addresses are limited to 3 bytes, but since addresses can be relative to each node + // array, the structure itself is not limited to 16MB. However, if it is over 16MB deciding + // the order of the PtNode arrays becomes a quite complicated problem, because though the + // dictionary itself does not have a size limit, each node array must still be within 16MB + // of all its children and parents. As long as this is ensured, the dictionary file may + // grow to any size. // Leave the choice of the optimal node order to the flattenTree function. MakedictLog.i("Flattening the tree..."); |