From 93cda5bb396c22f1781e390debaf75d54cf7c0dc Mon Sep 17 00:00:00 2001
From: Keisuke Kuroyanagi <ksk@google.com>
Date: Thu, 27 Mar 2014 15:30:32 +0900
Subject: [PATCH] Move code only used for dicttool and tests under tests.

Bug: 13035567
Change-Id: I13c6df013ef2b67c9bf67455d9c32d283bf9ea2e
---
 .../latin/makedict/FormatSpec.java            | 38 ---------------
 .../latin/makedict/MakedictLog.java           | 47 -------------------
 .../latin/utils/DictionaryInfoUtils.java      |  2 -
 .../latin/BinaryDictionaryDecayingTests.java  |  4 +-
 .../latin/makedict/AbstractDictDecoder.java   |  0
 .../BinaryDictDecoderEncoderTests.java        |  6 +--
 .../makedict/BinaryDictDecoderUtils.java      |  3 +-
 .../makedict/BinaryDictEncoderUtils.java      |  0
 .../latin/makedict/BinaryDictIOUtils.java     | 34 ++++++++++++++
 .../latin/makedict/DictDecoder.java           |  0
 .../latin/makedict/DictEncoder.java           |  0
 .../latin/makedict/FusionDictionary.java      |  0
 .../latin/makedict/MakedictLog.java           |  0
 .../latin/makedict/PendingAttribute.java      |  0
 .../latin/makedict/PtNodeInfo.java            |  0
 .../latin/makedict/Ver2DictDecoder.java       |  0
 .../latin/makedict/Ver2DictEncoder.java       |  0
 .../latin/makedict/Ver4DictDecoder.java       |  0
 .../latin/makedict/Ver4DictEncoder.java       |  0
 .../latin/utils/ByteArrayDictBuffer.java      |  0
 tools/dicttool/Android.mk                     | 11 +++--
 .../dicttool/BinaryDictOffdeviceUtils.java    |  6 ++-
 .../latin/dicttool/DictionaryMaker.java       |  3 +-
 .../BinaryDictOffdeviceUtilsTests.java        |  4 +-
 24 files changed, 58 insertions(+), 100 deletions(-)
 delete mode 100644 java/src/com/android/inputmethod/latin/makedict/MakedictLog.java
 rename {java => tests}/src/com/android/inputmethod/latin/makedict/AbstractDictDecoder.java (100%)
 rename {java => tests}/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java (98%)
 rename {java => tests}/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java (100%)
 rename {java => tests}/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtils.java (88%)
 rename {java => tests}/src/com/android/inputmethod/latin/makedict/DictDecoder.java (100%)
 rename {java => tests}/src/com/android/inputmethod/latin/makedict/DictEncoder.java (100%)
 rename {java => tests}/src/com/android/inputmethod/latin/makedict/FusionDictionary.java (100%)
 rename {tools/dicttool => tests}/src/com/android/inputmethod/latin/makedict/MakedictLog.java (100%)
 rename {java => tests}/src/com/android/inputmethod/latin/makedict/PendingAttribute.java (100%)
 rename {java => tests}/src/com/android/inputmethod/latin/makedict/PtNodeInfo.java (100%)
 rename {java => tests}/src/com/android/inputmethod/latin/makedict/Ver2DictDecoder.java (100%)
 rename {java => tests}/src/com/android/inputmethod/latin/makedict/Ver2DictEncoder.java (100%)
 rename {java => tests}/src/com/android/inputmethod/latin/makedict/Ver4DictDecoder.java (100%)
 rename {java => tests}/src/com/android/inputmethod/latin/makedict/Ver4DictEncoder.java (100%)
 rename {java => tests}/src/com/android/inputmethod/latin/utils/ByteArrayDictBuffer.java (100%)

diff --git a/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java b/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java
index 07217e48e5..f255034882 100644
--- a/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java
+++ b/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java
@@ -18,9 +18,7 @@ package com.android.inputmethod.latin.makedict;
 
 import com.android.inputmethod.annotations.UsedForTesting;
 import com.android.inputmethod.latin.Constants;
-import com.android.inputmethod.latin.makedict.DictDecoder.DictionaryBufferFactory;
 
-import java.io.File;
 import java.util.Date;
 import java.util.HashMap;
 
@@ -363,42 +361,6 @@ 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 long offset,
-            final long length, final int bufferType) {
-        if (dictFile.isDirectory()) {
-            return new Ver4DictDecoder(dictFile, bufferType);
-        } else if (dictFile.isFile()) {
-            return new Ver2DictDecoder(dictFile, offset, length, bufferType);
-        }
-        return null;
-    }
-
-    @UsedForTesting
-    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, offset, length, factory);
-        }
-        return null;
-    }
-
-    @UsedForTesting
-    public static DictDecoder getDictDecoder(final File dictFile, final long offset,
-            final long length) {
-        return getDictDecoder(dictFile, offset, length, DictDecoder.USE_READONLY_BYTEBUFFER);
-    }
-
     private FormatSpec() {
         // This utility class is not publicly instantiable.
     }
diff --git a/java/src/com/android/inputmethod/latin/makedict/MakedictLog.java b/java/src/com/android/inputmethod/latin/makedict/MakedictLog.java
deleted file mode 100644
index cf07209d96..0000000000
--- a/java/src/com/android/inputmethod/latin/makedict/MakedictLog.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.inputmethod.latin.makedict;
-
-import android.util.Log;
-
-/**
- * Wrapper to redirect log events to the right output medium.
- */
-public final class MakedictLog {
-    public static final boolean DBG = false;
-    private static final String TAG = MakedictLog.class.getSimpleName();
-
-    public static void d(String message) {
-        if (DBG) {
-            Log.d(TAG, message);
-        }
-    }
-
-    public static void i(String message) {
-        if (DBG) {
-            Log.i(TAG, message);
-        }
-    }
-
-    public static void w(String message) {
-        Log.w(TAG, message);
-    }
-
-    public static void e(String message) {
-        Log.e(TAG, message);
-    }
-}
diff --git a/java/src/com/android/inputmethod/latin/utils/DictionaryInfoUtils.java b/java/src/com/android/inputmethod/latin/utils/DictionaryInfoUtils.java
index e531d4b099..315913e2ff 100644
--- a/java/src/com/android/inputmethod/latin/utils/DictionaryInfoUtils.java
+++ b/java/src/com/android/inputmethod/latin/utils/DictionaryInfoUtils.java
@@ -23,12 +23,10 @@ import android.content.res.Resources;
 import android.text.TextUtils;
 import android.util.Log;
 
-import com.android.inputmethod.annotations.UsedForTesting;
 import com.android.inputmethod.latin.AssetFileAddress;
 import com.android.inputmethod.latin.BinaryDictionaryGetter;
 import com.android.inputmethod.latin.Constants;
 import com.android.inputmethod.latin.R;
-import com.android.inputmethod.latin.makedict.BinaryDictIOUtils;
 import com.android.inputmethod.latin.makedict.DictionaryHeader;
 import com.android.inputmethod.latin.makedict.UnsupportedFormatException;
 import com.android.inputmethod.latin.settings.SpacingAndPunctuations;
diff --git a/tests/src/com/android/inputmethod/latin/BinaryDictionaryDecayingTests.java b/tests/src/com/android/inputmethod/latin/BinaryDictionaryDecayingTests.java
index 918f09067d..ae2205b36e 100644
--- a/tests/src/com/android/inputmethod/latin/BinaryDictionaryDecayingTests.java
+++ b/tests/src/com/android/inputmethod/latin/BinaryDictionaryDecayingTests.java
@@ -20,6 +20,7 @@ import android.test.AndroidTestCase;
 import android.test.suitebuilder.annotation.LargeTest;
 import android.util.Pair;
 
+import com.android.inputmethod.latin.makedict.BinaryDictIOUtils;
 import com.android.inputmethod.latin.makedict.CodePointUtils;
 import com.android.inputmethod.latin.makedict.DictDecoder;
 import com.android.inputmethod.latin.makedict.DictionaryHeader;
@@ -151,7 +152,8 @@ public class BinaryDictionaryDecayingTests extends AndroidTestCase {
         binaryDictionary.flushWithGC();
         binaryDictionary.close();
 
-        final DictDecoder dictDecoder = FormatSpec.getDictDecoder(dictFile, 0, dictFile.length());
+        final DictDecoder dictDecoder =
+                BinaryDictIOUtils.getDictDecoder(dictFile, 0, dictFile.length());
         try {
             final FusionDictionary dict =
                     dictDecoder.readDictionaryBinary(false /* deleteDictIfBroken */);
diff --git a/java/src/com/android/inputmethod/latin/makedict/AbstractDictDecoder.java b/tests/src/com/android/inputmethod/latin/makedict/AbstractDictDecoder.java
similarity index 100%
rename from java/src/com/android/inputmethod/latin/makedict/AbstractDictDecoder.java
rename to tests/src/com/android/inputmethod/latin/makedict/AbstractDictDecoder.java
diff --git a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderEncoderTests.java b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderEncoderTests.java
index 4bf61747c7..f29fc21c1f 100644
--- a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderEncoderTests.java
+++ b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderEncoderTests.java
@@ -251,7 +251,7 @@ public class BinaryDictDecoderEncoderTests extends AndroidTestCase {
 
         FusionDictionary dict = null;
         try {
-            final DictDecoder dictDecoder = FormatSpec.getDictDecoder(file, 0, file.length(),
+            final DictDecoder dictDecoder = BinaryDictIOUtils.getDictDecoder(file, 0, file.length(),
                     bufferType);
             now = System.currentTimeMillis();
             dict = dictDecoder.readDictionaryBinary(false /* deleteDictIfBroken */);
@@ -414,7 +414,7 @@ public class BinaryDictDecoderEncoderTests extends AndroidTestCase {
 
         long now = -1, diff = -1;
         try {
-            final DictDecoder dictDecoder = FormatSpec.getDictDecoder(file, 0, file.length(),
+            final DictDecoder dictDecoder = BinaryDictIOUtils.getDictDecoder(file, 0, file.length(),
                     bufferType);
             now = System.currentTimeMillis();
             dictDecoder.readUnigramsAndBigramsBinary(resultWords, resultFreqs, resultBigrams);
@@ -539,7 +539,7 @@ public class BinaryDictDecoderEncoderTests extends AndroidTestCase {
         addBigrams(dict, words, bigrams);
         timeWritingDictToFile(file, dict, formatOptions);
 
-        final DictDecoder dictDecoder = FormatSpec.getDictDecoder(file, 0, file.length(),
+        final DictDecoder dictDecoder = BinaryDictIOUtils.getDictDecoder(file, 0, file.length(),
                 DictDecoder.USE_BYTEARRAY);
         try {
             dictDecoder.openDictBuffer();
diff --git a/java/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java
similarity index 98%
rename from java/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java
rename to tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java
index b534bcb095..6f8b07a348 100644
--- a/java/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java
+++ b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java
@@ -28,7 +28,6 @@ import java.nio.ByteBuffer;
  *
  * All the methods in this class are static.
  *
- * TODO: Remove calls from classes except Ver3DictDecoder
  * TODO: Move this file to makedict/internal.
  * TODO: Rename this class to DictDecoderUtils.
  */
@@ -356,7 +355,7 @@ public final class BinaryDictDecoderUtils {
      * @return true if it's a binary dictionary, false otherwise
      */
     public static boolean isBinaryDictionary(final File file) {
-        final DictDecoder dictDecoder = FormatSpec.getDictDecoder(file, 0, file.length());
+        final DictDecoder dictDecoder = BinaryDictIOUtils.getDictDecoder(file, 0, file.length());
         if (dictDecoder == null) {
             return false;
         }
diff --git a/java/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java
similarity index 100%
rename from java/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java
rename to tests/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java
diff --git a/java/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtils.java b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtils.java
similarity index 88%
rename from java/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtils.java
rename to tests/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtils.java
index a180f1c297..42a50be66b 100644
--- a/java/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtils.java
+++ b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtils.java
@@ -18,7 +18,9 @@ package com.android.inputmethod.latin.makedict;
 
 import com.android.inputmethod.annotations.UsedForTesting;
 import com.android.inputmethod.latin.Constants;
+import com.android.inputmethod.latin.makedict.DictDecoder.DictionaryBufferFactory;
 
+import java.io.File;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.ArrayList;
@@ -32,6 +34,38 @@ public final class BinaryDictIOUtils {
         // This utility class is not publicly instantiable.
     }
 
+    /**
+     * Returns new dictionary decoder.
+     *
+     * @param dictFile the dictionary file.
+     * @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 long offset,
+            final long length, final int bufferType) {
+        if (dictFile.isDirectory()) {
+            return new Ver4DictDecoder(dictFile, bufferType);
+        } else if (dictFile.isFile()) {
+            return new Ver2DictDecoder(dictFile, offset, length, bufferType);
+        }
+        return null;
+    }
+
+    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, offset, length, factory);
+        }
+        return null;
+    }
+
+    public static DictDecoder getDictDecoder(final File dictFile, final long offset,
+            final long length) {
+        return getDictDecoder(dictFile, offset, length, DictDecoder.USE_READONLY_BYTEBUFFER);
+    }
+
     private static final class Position {
         public static final int NOT_READ_PTNODE_COUNT = -1;
 
diff --git a/java/src/com/android/inputmethod/latin/makedict/DictDecoder.java b/tests/src/com/android/inputmethod/latin/makedict/DictDecoder.java
similarity index 100%
rename from java/src/com/android/inputmethod/latin/makedict/DictDecoder.java
rename to tests/src/com/android/inputmethod/latin/makedict/DictDecoder.java
diff --git a/java/src/com/android/inputmethod/latin/makedict/DictEncoder.java b/tests/src/com/android/inputmethod/latin/makedict/DictEncoder.java
similarity index 100%
rename from java/src/com/android/inputmethod/latin/makedict/DictEncoder.java
rename to tests/src/com/android/inputmethod/latin/makedict/DictEncoder.java
diff --git a/java/src/com/android/inputmethod/latin/makedict/FusionDictionary.java b/tests/src/com/android/inputmethod/latin/makedict/FusionDictionary.java
similarity index 100%
rename from java/src/com/android/inputmethod/latin/makedict/FusionDictionary.java
rename to tests/src/com/android/inputmethod/latin/makedict/FusionDictionary.java
diff --git a/tools/dicttool/src/com/android/inputmethod/latin/makedict/MakedictLog.java b/tests/src/com/android/inputmethod/latin/makedict/MakedictLog.java
similarity index 100%
rename from tools/dicttool/src/com/android/inputmethod/latin/makedict/MakedictLog.java
rename to tests/src/com/android/inputmethod/latin/makedict/MakedictLog.java
diff --git a/java/src/com/android/inputmethod/latin/makedict/PendingAttribute.java b/tests/src/com/android/inputmethod/latin/makedict/PendingAttribute.java
similarity index 100%
rename from java/src/com/android/inputmethod/latin/makedict/PendingAttribute.java
rename to tests/src/com/android/inputmethod/latin/makedict/PendingAttribute.java
diff --git a/java/src/com/android/inputmethod/latin/makedict/PtNodeInfo.java b/tests/src/com/android/inputmethod/latin/makedict/PtNodeInfo.java
similarity index 100%
rename from java/src/com/android/inputmethod/latin/makedict/PtNodeInfo.java
rename to tests/src/com/android/inputmethod/latin/makedict/PtNodeInfo.java
diff --git a/java/src/com/android/inputmethod/latin/makedict/Ver2DictDecoder.java b/tests/src/com/android/inputmethod/latin/makedict/Ver2DictDecoder.java
similarity index 100%
rename from java/src/com/android/inputmethod/latin/makedict/Ver2DictDecoder.java
rename to tests/src/com/android/inputmethod/latin/makedict/Ver2DictDecoder.java
diff --git a/java/src/com/android/inputmethod/latin/makedict/Ver2DictEncoder.java b/tests/src/com/android/inputmethod/latin/makedict/Ver2DictEncoder.java
similarity index 100%
rename from java/src/com/android/inputmethod/latin/makedict/Ver2DictEncoder.java
rename to tests/src/com/android/inputmethod/latin/makedict/Ver2DictEncoder.java
diff --git a/java/src/com/android/inputmethod/latin/makedict/Ver4DictDecoder.java b/tests/src/com/android/inputmethod/latin/makedict/Ver4DictDecoder.java
similarity index 100%
rename from java/src/com/android/inputmethod/latin/makedict/Ver4DictDecoder.java
rename to tests/src/com/android/inputmethod/latin/makedict/Ver4DictDecoder.java
diff --git a/java/src/com/android/inputmethod/latin/makedict/Ver4DictEncoder.java b/tests/src/com/android/inputmethod/latin/makedict/Ver4DictEncoder.java
similarity index 100%
rename from java/src/com/android/inputmethod/latin/makedict/Ver4DictEncoder.java
rename to tests/src/com/android/inputmethod/latin/makedict/Ver4DictEncoder.java
diff --git a/java/src/com/android/inputmethod/latin/utils/ByteArrayDictBuffer.java b/tests/src/com/android/inputmethod/latin/utils/ByteArrayDictBuffer.java
similarity index 100%
rename from java/src/com/android/inputmethod/latin/utils/ByteArrayDictBuffer.java
rename to tests/src/com/android/inputmethod/latin/utils/ByteArrayDictBuffer.java
diff --git a/tools/dicttool/Android.mk b/tools/dicttool/Android.mk
index 0e9c14ee48..0def53e262 100644
--- a/tools/dicttool/Android.mk
+++ b/tools/dicttool/Android.mk
@@ -30,6 +30,7 @@ LATINIME_LOCAL_DIR := ../..
 LATINIME_BASE_SOURCE_DIRECTORY := $(LATINIME_LOCAL_DIR)/java/src/com/android/inputmethod
 LATINIME_ANNOTATIONS_SOURCE_DIRECTORY := $(LATINIME_BASE_SOURCE_DIRECTORY)/annotations
 MAKEDICT_CORE_SOURCE_DIRECTORY := $(LATINIME_BASE_SOURCE_DIRECTORY)/latin/makedict
+LATINIME_TESTS_SOURCE_DIRECTORY := $(LATINIME_LOCAL_DIR)/tests/src/com/android/inputmethod/latin
 
 # Dependencies for Dicttool. Most of these files are needed by BinaryDictionary.java. Note that
 # a significant part of the dependencies are mocked in the compat/ directory, with empty or
@@ -47,7 +48,6 @@ LATINIME_SRCS_FOR_DICTTOOL := \
         latin/WordComposer.java \
         latin/settings/NativeSuggestOptions.java \
         latin/utils/BinaryDictionaryUtils.java \
-        latin/utils/ByteArrayDictBuffer.java \
         latin/utils/CollectionUtils.java \
         latin/utils/CombinedFormatUtils.java \
         latin/utils/CoordinateUtils.java \
@@ -56,8 +56,13 @@ LATINIME_SRCS_FOR_DICTTOOL := \
         latin/utils/LocaleUtils.java \
         latin/utils/ResizableIntArray.java \
         latin/utils/StringUtils.java
-USED_TARGETED_SRCS := $(addprefix $(LATINIME_BASE_SOURCE_DIRECTORY)/, \
-        $(LATINIME_SRCS_FOR_DICTTOOL))
+
+LATINIME_TEST_SRCS_FOR_DICTTOOL := \
+        utils/ByteArrayDictBuffer.java
+
+USED_TARGETED_SRCS := \
+        $(addprefix $(LATINIME_BASE_SOURCE_DIRECTORY)/, $(LATINIME_SRCS_FOR_DICTTOOL)) \
+        $(addprefix $(LATINIME_TESTS_SOURCE_DIRECTORY)/, $(LATINIME_TEST_SRCS_FOR_DICTTOOL))
 
 DICTTOOL_ONDEVICE_TESTS_DIRECTORY := \
         $(LATINIME_LOCAL_DIR)/tests/src/com/android/inputmethod/latin/makedict/
diff --git a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtils.java b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtils.java
index e31ac2ab6e..f9771c8dd4 100644
--- a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtils.java
+++ b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtils.java
@@ -17,6 +17,7 @@
 package com.android.inputmethod.latin.dicttool;
 
 import com.android.inputmethod.latin.makedict.BinaryDictDecoderUtils;
+import com.android.inputmethod.latin.makedict.BinaryDictIOUtils;
 import com.android.inputmethod.latin.makedict.DictDecoder;
 import com.android.inputmethod.latin.makedict.FormatSpec;
 import com.android.inputmethod.latin.makedict.FusionDictionary;
@@ -191,8 +192,9 @@ public final class BinaryDictOffdeviceUtils {
                     return CombinedInputOutput.readDictionaryCombined(
                             new BufferedInputStream(new FileInputStream(decodedSpec.mFile)));
                 } else {
-                    final DictDecoder dictDecoder = FormatSpec.getDictDecoder(decodedSpec.mFile,
-                            0, decodedSpec.mFile.length(), DictDecoder.USE_BYTEARRAY);
+                    final DictDecoder dictDecoder = BinaryDictIOUtils.getDictDecoder(
+                            decodedSpec.mFile, 0, decodedSpec.mFile.length(),
+                            DictDecoder.USE_BYTEARRAY);
                     if (report) {
                         System.out.println("Format : Binary dictionary format");
                         System.out.println("Packaging : " + decodedSpec.describeChain());
diff --git a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java
index 68d7850444..8e8ab19e06 100644
--- a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java
+++ b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java
@@ -17,6 +17,7 @@
 package com.android.inputmethod.latin.dicttool;
 
 import com.android.inputmethod.latin.makedict.BinaryDictDecoderUtils;
+import com.android.inputmethod.latin.makedict.BinaryDictIOUtils;
 import com.android.inputmethod.latin.makedict.DictDecoder;
 import com.android.inputmethod.latin.makedict.DictEncoder;
 import com.android.inputmethod.latin.makedict.FormatSpec;
@@ -264,7 +265,7 @@ public class DictionaryMaker {
     private static FusionDictionary readBinaryFile(final String binaryFilename)
             throws FileNotFoundException, IOException, UnsupportedFormatException {
         final File file = new File(binaryFilename);
-        final DictDecoder dictDecoder = FormatSpec.getDictDecoder(file, 0, file.length());
+        final DictDecoder dictDecoder = BinaryDictIOUtils.getDictDecoder(file, 0, file.length());
         return dictDecoder.readDictionaryBinary(false /* deleteDictIfBroken */);
     }
 
diff --git a/tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java b/tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java
index a3095da8af..4f1273bdcc 100644
--- a/tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java
+++ b/tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java
@@ -16,6 +16,8 @@
 
 package com.android.inputmethod.latin.dicttool;
 
+import com.android.inputmethod.latin.Dictionary;
+import com.android.inputmethod.latin.makedict.BinaryDictIOUtils;
 import com.android.inputmethod.latin.makedict.DictDecoder;
 import com.android.inputmethod.latin.makedict.DictEncoder;
 import com.android.inputmethod.latin.makedict.DictionaryHeader;
@@ -77,7 +79,7 @@ public class BinaryDictOffdeviceUtilsTests extends TestCase {
             assertEquals("Wrong decode spec", BinaryDictOffdeviceUtils.COMPRESSION, step);
         }
         assertEquals("Wrong decode spec", 3, decodeSpec.mDecoderSpec.size());
-        final DictDecoder dictDecoder = FormatSpec.getDictDecoder(decodeSpec.mFile, 0,
+        final DictDecoder dictDecoder = BinaryDictIOUtils.getDictDecoder(decodeSpec.mFile, 0,
                 decodeSpec.mFile.length());
         final FusionDictionary resultDict =
                 dictDecoder.readDictionaryBinary(false /* deleteDictIfBroken */);
-- 
GitLab