aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java
diff options
context:
space:
mode:
authorYuichiro Hanada <yhanada@google.com>2013-08-20 13:15:27 +0900
committerYuichiro Hanada <yhanada@google.com>2013-08-20 16:06:52 +0900
commit66004ce2de1579d8ae1fb3411ce98f1e9e37cf8b (patch)
tree4109aeb448461c26d10a1e22559c46f2b41b7928 /java/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java
parent22f01a42fcd91dae2a4e723e2477a480a11daa8e (diff)
downloadlatinime-66004ce2de1579d8ae1fb3411ce98f1e9e37cf8b.tar.gz
latinime-66004ce2de1579d8ae1fb3411ce98f1e9e37cf8b.tar.xz
latinime-66004ce2de1579d8ae1fb3411ce98f1e9e37cf8b.zip
Remove populateOptions.
Change-Id: I1a1830aaa8ea586b68fc34ff3a27ae52b810e8af
Diffstat (limited to 'java/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java')
-rw-r--r--java/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java47
1 files changed, 1 insertions, 46 deletions
diff --git a/java/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java b/java/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java
index efa491099..d1974c8d4 100644
--- a/java/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java
+++ b/java/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java
@@ -22,7 +22,6 @@ import com.android.inputmethod.latin.makedict.FormatSpec.FormatOptions;
import com.android.inputmethod.latin.makedict.FusionDictionary.CharGroup;
import com.android.inputmethod.latin.makedict.FusionDictionary.PtNodeArray;
import com.android.inputmethod.latin.makedict.FusionDictionary.WeightedString;
-import com.android.inputmethod.latin.makedict.decoder.HeaderReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -33,7 +32,6 @@ import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
@@ -640,49 +638,6 @@ public final class BinaryDictDecoderUtils {
}
/**
- * Reads a header from a buffer.
- * @param headerReader the header reader
- * @throws IOException
- * @throws UnsupportedFormatException
- */
- public static FileHeader readHeader(final HeaderReader headerReader)
- throws IOException, UnsupportedFormatException {
- final int version = headerReader.readVersion();
- final int optionsFlags = headerReader.readOptionFlags();
-
- final int headerSize = headerReader.readHeaderSize();
-
- if (headerSize < 0) {
- throw new UnsupportedFormatException("header size can't be negative.");
- }
-
- final HashMap<String, String> attributes = headerReader.readAttributes(headerSize);
-
- final FileHeader header = new FileHeader(headerSize,
- new FusionDictionary.DictionaryOptions(attributes,
- 0 != (optionsFlags & FormatSpec.GERMAN_UMLAUT_PROCESSING_FLAG),
- 0 != (optionsFlags & FormatSpec.FRENCH_LIGATURE_PROCESSING_FLAG)),
- new FormatOptions(version,
- 0 != (optionsFlags & FormatSpec.SUPPORTS_DYNAMIC_UPDATE)));
- return header;
- }
-
- /**
- * Reads options from a buffer and populate a map with their contents.
- *
- * The buffer is read at the current position, so the caller must take care the pointer
- * is in the right place before calling this.
- */
- public static void populateOptions(final DictBuffer dictBuffer,
- final int headerSize, final HashMap<String, String> options) {
- while (dictBuffer.position() < headerSize) {
- final String key = CharEncoding.readString(dictBuffer);
- final String value = CharEncoding.readString(dictBuffer);
- options.put(key, value);
- }
- }
-
- /**
* Reads a buffer and returns the memory representation of the dictionary.
*
* This high-level method takes a buffer and reads its contents, populating a
@@ -706,7 +661,7 @@ public final class BinaryDictDecoderUtils {
}
// Read header
- final FileHeader fileHeader = readHeader(dictDecoder);
+ final FileHeader fileHeader = dictDecoder.readHeader();
Map<Integer, PtNodeArray> reverseNodeArrayMapping = new TreeMap<Integer, PtNodeArray>();
Map<Integer, CharGroup> reverseGroupMapping = new TreeMap<Integer, CharGroup>();