From 66004ce2de1579d8ae1fb3411ce98f1e9e37cf8b Mon Sep 17 00:00:00 2001 From: Yuichiro Hanada Date: Tue, 20 Aug 2013 13:15:27 +0900 Subject: Remove populateOptions. Change-Id: I1a1830aaa8ea586b68fc34ff3a27ae52b810e8af --- .../latin/makedict/BinaryDictDecoderUtils.java | 47 +--------------------- 1 file changed, 1 insertion(+), 46 deletions(-) (limited to 'java/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java') 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; @@ -639,49 +637,6 @@ public final class BinaryDictDecoderUtils { return version; } - /** - * 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 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 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. * @@ -706,7 +661,7 @@ public final class BinaryDictDecoderUtils { } // Read header - final FileHeader fileHeader = readHeader(dictDecoder); + final FileHeader fileHeader = dictDecoder.readHeader(); Map reverseNodeArrayMapping = new TreeMap(); Map reverseGroupMapping = new TreeMap(); -- cgit v1.2.3-83-g751a