code: private long scanItem(InStore is, long address, byte []readBuffer,
                          byte []tempBuffer)
    {
      startRead();
      
      byte []headerBuffer = _headerBuffer;
      
      while (address + 2 < _tailAddress) {
        readImpl(is, address, readBuffer, headerBuffer, 0, 2);
        
        address += 2;
        
        int len = BitsUtil.readInt16(headerBuffer, 0);
  
        if ((len & 0x8000) != 0) {
          if (len == CHECKPOINT_START) {
            setSequence(_sequence + 1);
          }
          
          startRead();
          
          continue;
        }
          
        if (len == 0) {
          readImpl(is, address, readBuffer, headerBuffer, 0, 4);
          address += 4;
          
          int crc = BitsUtil.readInt(headerBuffer, 0);
          
          int digest = (int) _crc.getValue();
  
          if (crc == digest) {
            return address;
          }
          else {
            return -1;
          }
        }
        
        if (_tailAddress < address + len) {
          return -1;
        }
        
        int readLen = len;
        
        while (readLen > 0) {
          int sublen = Math.min(readLen, tempBuffer.length);
        
          readImpl(is, address, readBuffer, tempBuffer, 0, sublen);
          _crc.update(tempBuffer, 0, sublen);
          
          address += sublen;
          readLen -= sublen;
        }
      }
  
      return -1;
    }
docs: Validates that the item is complete and correct.