X-Git-Url: https://gitweb.fperrin.net/?a=blobdiff_plain;f=src%2Fcom%2Fhughes%2Fandroid%2Fdictionary%2Fengine%2FDictionary.java;h=b9a46a01545c19d7eed612d84266e69a0e52ee17;hb=de2a7098e02252016136c114afbf8868bdff2452;hp=6539bc9b0f0a52afce3eae135fa681bf527ddc53;hpb=ba3bb0e41a0cceb851065814f8b761709bcc1412;p=Dictionary.git diff --git a/src/com/hughes/android/dictionary/engine/Dictionary.java b/src/com/hughes/android/dictionary/engine/Dictionary.java index 6539bc9..b9a46a0 100644 --- a/src/com/hughes/android/dictionary/engine/Dictionary.java +++ b/src/com/hughes/android/dictionary/engine/Dictionary.java @@ -50,6 +50,9 @@ public class Dictionary implements RAFSerializable { public final List htmlData; public final List sources; public final List indices; + // Could be a local variable in constructor, but + // this way avoids a native-image VM bug. + private final MappedByteBuffer wholefile; /** * dictFileVersion 1 adds:
  • links to sources? dictFileVersion 2 adds:
  • @@ -66,10 +69,11 @@ public class Dictionary implements RAFSerializable { htmlData = null; sources = new ArrayList<>(); indices = new ArrayList<>(); + wholefile = null; } public Dictionary(final FileChannel ch) throws IOException { - MappedByteBuffer wholefile = ch.map(FileChannel.MapMode.READ_ONLY, 0, ch.size()); + wholefile = ch.map(FileChannel.MapMode.READ_ONLY, 0, ch.size()); DataInputBuffer in = new DataInputBuffer(wholefile, 0); dictFileVersion = in.readInt(); if (dictFileVersion < 0 || dictFileVersion > CURRENT_DICT_VERSION) {