]> gitweb.fperrin.net Git - Dictionary.git/blobdiff - src/com/hughes/android/dictionary/engine/Dictionary.java
Fix comparison for entries starting with "-".
[Dictionary.git] / src / com / hughes / android / dictionary / engine / Dictionary.java
index cb7d32fc3599094c60a8f55bf6d5c8cc5dceea58..1a57d89c44942094e996613e1ee62bdca6030ec3 100644 (file)
@@ -83,20 +83,20 @@ 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),
                     CACHE_SIZE);
             if (dictFileVersion >= 5) {
                 htmlEntries = CachingList.create(
-                        RAFList.create(raf, new HtmlEntry.Serializer(this), raf.getFilePointer(), dictFileVersion, dictFileVersion >= 7 ? 64 : 1, dictFileVersion >= 7),
+                        RAFList.create(raf, new HtmlEntry.Serializer(this), raf.getFilePointer(), dictFileVersion),
                         CACHE_SIZE);
             } else {
                 htmlEntries = Collections.emptyList();
             }
             if (dictFileVersion >= 7) {
-                htmlData = RAFList.create(raf, new HtmlEntry.DataDeserializer(), raf.getFilePointer(), dictFileVersion, 16, true);
+                htmlData = RAFList.create(raf, new HtmlEntry.DataDeserializer(), raf.getFilePointer(), dictFileVersion);
             } else {
                 htmlData = null;
             }
@@ -125,10 +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());
+        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(), 16, true);
+        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());
@@ -150,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
@@ -195,7 +194,10 @@ public class Dictionary implements RAFSerializable<Dictionary> {
             raf.close();
             return dictionaryInfo;
         } catch (IOException e) {
-            return null;
+            final DictionaryInfo dictionaryInfo = new DictionaryInfo();
+            dictionaryInfo.uncompressedFilename = file.getName();
+            dictionaryInfo.uncompressedBytes = file.length();
+            return dictionaryInfo;
         } finally {
             if (raf != null) {
                 try {