Dicttool to handle unpackaging non-latest version dicts

Change-Id: I738735186213b3a40eff997ae2fd83069c6445f1
main
Adrian Velicu 2014-11-11 16:33:53 -08:00
parent da99cfc29d
commit 1e72f9da12
1 changed files with 6 additions and 4 deletions

View File

@ -16,6 +16,8 @@
package com.android.inputmethod.latin.dicttool;
import com.android.inputmethod.latin.makedict.DictionaryHeader;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
@ -77,16 +79,16 @@ public class Package {
if (mArgs.length != 2) {
throw new RuntimeException("Too many/too few arguments for command " + COMMAND);
}
final BinaryDictOffdeviceUtils.DecoderChainSpec<File> decodedSpec =
BinaryDictOffdeviceUtils.getRawDictionaryOrNull(new File(mArgs[0]));
final BinaryDictOffdeviceUtils.DecoderChainSpec<DictionaryHeader> decodedSpec =
BinaryDictOffdeviceUtils.decodeDictionaryForProcess(new File(mArgs[0]),
new BinaryDictOffdeviceUtils.HeaderReaderProcessor());
if (null == decodedSpec) {
System.out.println(mArgs[0] + " does not seem to be a dictionary");
return;
}
System.out.println("Packaging : " + decodedSpec.describeChain());
System.out.println("Uncompressed size : " + decodedSpec.mResult.length());
try (
final InputStream input = getFileInputStream(decodedSpec.mResult);
final InputStream input = decodedSpec.getStream(new File(mArgs[0]));
final OutputStream output = new BufferedOutputStream(
getFileOutputStreamOrStdOut(mArgs[1]))
) {