am 1e72f9da: Dicttool to handle unpackaging non-latest version dicts
* commit '1e72f9da12ae7312af0b6ee14114756552cb6576': Dicttool to handle unpackaging non-latest version dictsmain
commit
d6ba40c67a
|
@ -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]))
|
||||
) {
|
||||
|
|
Loading…
Reference in New Issue