import java.io.IOException;
import java.io.PrintStream;
import java.lang.ref.SoftReference;
-import java.nio.ByteBuffer;
-import java.nio.channels.FileChannel;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.regex.Pattern;
static final class DataDeserializer implements RAFListSerializer<DataInputBuffer> {
@Override
public DataInputBuffer read(DataInput raf, final int index) throws IOException {
- return HtmlEntry.readData(raf);
+ return readData(raf);
}
@Override
public static String formatQuickdicUrl(final String indexShortName, final String text) {
assert !indexShortName.contains(":");
assert text.length() > 0;
- return String.format("q://d?%s&%s", indexShortName, StringUtil.encodeForUrl(text));
+ StringBuilder s = new StringBuilder("q://d?");
+ s.append(indexShortName);
+ s.append("&");
+ s.append(StringUtil.encodeForUrl(text));
+ return s.toString();
}
public static boolean isQuickdicUrl(String url) {
buf.readFully(zipBytes);
try {
final byte[] bytes = StringUtil.unzipFully(zipBytes, numBytes);
- html = new String(bytes, StandardCharsets.UTF_8);
+ // Cannot use StandardCharsets due to older Android.
+ html = new String(bytes, "UTF-8");
} catch (IOException e) {
throw new RuntimeException("Dictionary HTML data corrupted", e);
}