public Index(final Dictionary dict, final RandomAccessFile raf) throws IOException { this.dict = dict; shortName = raf.readUTF(); longName = raf.readUTF(); final String languageCode = raf.readUTF(); sortLanguage = Language.lookup(languageCode); normalizerRules = raf.readUTF(); swapPairEntries = raf.readBoolean(); if (sortLanguage == null) { throw new IOException("Unsupported language: " + languageCode); } if (dict.dictFileVersion >= 2) { mainTokenCount = raf.readInt(); } sortedIndexEntries = CachingList.create( RAFList.create(raf, indexEntrySerializer, raf.getFilePointer()), CACHE_SIZE); if (dict.dictFileVersion >= 4) { stoplist = new SerializableSerializer<Set<String>>().read(raf); } else { stoplist = Collections.emptySet(); } rows = CachingList.create( UniformRAFList.create(raf, new RowBase.Serializer(this), raf.getFilePointer()), CACHE_SIZE); }
public IndexEntry(final Index index, final RandomAccessFile raf) throws IOException { this.index = index; token = raf.readUTF(); startRow = raf.readInt(); numRows = raf.readInt(); final boolean hasNormalizedForm = raf.readBoolean(); normalizedToken = hasNormalizedForm ? raf.readUTF() : token; if (index.dict.dictFileVersion >= 6) { this.htmlEntries = CachingList.create( RAFList.create(raf, index.dict.htmlEntryIndexSerializer, raf.getFilePointer()), 1); } else { this.htmlEntries = Collections.emptyList(); } }