import java.io.RandomAccessFile;
import java.io.UnsupportedEncodingException;
import java.lang.ref.SoftReference;
import java.io.RandomAccessFile;
import java.io.UnsupportedEncodingException;
import java.lang.ref.SoftReference;
- public HtmlEntry(Dictionary dictionary, DataInput raf, final int index)
+ public HtmlEntry(Dictionary dictionary, FileChannel ch, DataInput raf, final int index)
- lazyHtmlLoader = new LazyHtmlLoader(raf, dictionary.htmlData, index);
+ lazyHtmlLoader = new LazyHtmlLoader(ch, raf, dictionary.htmlData, index);
// --------------------------------------------------------------------
public static final class LazyHtmlLoader {
// --------------------------------------------------------------------
public static final class LazyHtmlLoader {
// Not sure this volatile is right, but oh well.
volatile SoftReference<String> htmlRef = new SoftReference<String>(null);
// Not sure this volatile is right, but oh well.
volatile SoftReference<String> htmlRef = new SoftReference<String>(null);
- private LazyHtmlLoader(final DataInput inp, List<byte[]> data, int index) throws IOException {
+ private LazyHtmlLoader(FileChannel ch, final DataInput inp, List<byte[]> data, int index) throws IOException {
System.out.println("Loading Html: numBytes=" + numBytes + ", numZipBytes="
+ numZipBytes);
final byte[] zipBytes = new byte[numZipBytes];
System.out.println("Loading Html: numBytes=" + numBytes + ", numZipBytes="
+ numZipBytes);
final byte[] zipBytes = new byte[numZipBytes];
} catch (IOException e) {
throw new RuntimeException("Failed to read HTML data from dictionary", e);
}
} catch (IOException e) {
throw new RuntimeException("Failed to read HTML data from dictionary", e);
}