/** {@inheritDoc} */ public boolean readBoolean() throws IOException { fileSize -= 1; if (fileSize < 0) { throw new EOFException(); } return dataInput.readBoolean(); }
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(); } }
public boolean getUnlockedCleanly() { assertOpen(); try { lockFileAccess.seek(STATE_REGION_POS + 1); if (!lockFileAccess.readBoolean()) { // Process has crashed while updating target file return false; } } catch (EOFException e) { // Process has crashed writing to lock file return false; } catch (Exception e) { throw UncheckedException.throwAsUncheckedException(e); } return true; }
/* @see java.io.DataInput.readBoolean() */ public boolean readBoolean() throws IOException { return raf.readBoolean(); }