]> gitweb.fperrin.net Git - Dictionary.git/blobdiff - src/com/hughes/android/dictionary/engine/Dictionary.java
Split size statistic a bit more.
[Dictionary.git] / src / com / hughes / android / dictionary / engine / Dictionary.java
index 57ae6e73cd5f6c41ed392fa7d2f050eaa4b76251..084546def8d4316042ceb60a87f80d843f960652 100644 (file)
@@ -45,6 +45,7 @@ public class Dictionary implements RAFSerializable<Dictionary> {
     public final List<PairEntry> pairEntries;
     public final List<TextEntry> textEntries;
     public final List<HtmlEntry> htmlEntries;
+    public final List<byte[]> htmlData;
     public final List<EntrySource> sources;
     public final List<Index> indices;
 
@@ -60,6 +61,7 @@ public class Dictionary implements RAFSerializable<Dictionary> {
         pairEntries = new ArrayList<PairEntry>();
         textEntries = new ArrayList<TextEntry>();
         htmlEntries = new ArrayList<HtmlEntry>();
+        htmlData = null;
         sources = new ArrayList<EntrySource>();
         indices = new ArrayList<Index>();
     }
@@ -81,7 +83,7 @@ public class Dictionary implements RAFSerializable<Dictionary> {
             raf.seek(rafSources.getEndOffset());
 
             pairEntries = CachingList.create(
-                    RAFList.create(raf, new PairEntry.Serializer(this), raf.getFilePointer(), dictFileVersion, dictFileVersion >= 7 ? 64 : 1, dictFileVersion >= 7),
+                    RAFList.create(raf, new PairEntry.Serializer(this), raf.getFilePointer(), dictFileVersion),
                     CACHE_SIZE);
             textEntries = CachingList.create(
                     RAFList.create(raf, new TextEntry.Serializer(this), raf.getFilePointer(), dictFileVersion),
@@ -93,6 +95,11 @@ public class Dictionary implements RAFSerializable<Dictionary> {
             } else {
                 htmlEntries = Collections.emptyList();
             }
+            if (dictFileVersion >= 7) {
+                htmlData = RAFList.create(raf, new HtmlEntry.DataDeserializer(), raf.getFilePointer(), dictFileVersion);
+            } else {
+                htmlData = null;
+            }
             indices = CachingList.createFullyCached(RAFList.create(raf, indexSerializer,
                     raf.getFilePointer(), dictFileVersion));
         } catch (RuntimeException e) {
@@ -118,8 +125,11 @@ public class Dictionary implements RAFSerializable<Dictionary> {
         RAFList.write(raf, pairEntries, new PairEntry.Serializer(this), 64, true);
         System.out.println("text start: " + raf.getFilePointer());
         RAFList.write(raf, textEntries, new TextEntry.Serializer(this));
-        System.out.println("html start: " + raf.getFilePointer());
-        RAFList.write(raf, htmlEntries, new HtmlEntry.Serializer(this));
+        System.out.println("html index start: " + raf.getFilePointer());
+        RAFList.write(raf, htmlEntries, new HtmlEntry.Serializer(this), 64, true);
+        System.out.println("html data start: " + raf.getFilePointer());
+        assert htmlData == null;
+        RAFList.write(raf, htmlEntries, new HtmlEntry.DataSerializer(), 128, true);
         System.out.println("indices start: " + raf.getFilePointer());
         RAFList.write(raf, indices, indexSerializer);
         System.out.println("end: " + raf.getFilePointer());
@@ -141,9 +151,7 @@ public class Dictionary implements RAFSerializable<Dictionary> {
     final RAFListSerializer<HtmlEntry> htmlEntryIndexSerializer = new RAFListSerializer<HtmlEntry>() {
         @Override
         public void write(DataOutput raf, HtmlEntry t) throws IOException {
-            if (t.index() == -1)
-                throw new IndexOutOfBoundsException();
-            raf.writeInt(t.index());
+            assert false;
         }
 
         @Override