コード例 #1
0
 void FieldInfos::read(IndexInputPtr input, const String& fileName)
 {
     int32_t firstInt = input->readVInt();
     format = firstInt < 0 ? firstInt : FORMAT_PRE; // This is a real format?
     
     if (format != FORMAT_PRE && format != FORMAT_START)
         boost::throw_exception(CorruptIndexException(L"unrecognized format " + StringUtils::toString(format) + L" in file \"" + fileName + L"\""));
     
     int32_t size = format == FORMAT_PRE ? firstInt : input->readVInt(); // read in the size if required
     for (int32_t i = 0; i < size; ++i)
     {
         String name(input->readString());
         uint8_t bits = input->readByte();
         
         addInternal(name, (bits & IS_INDEXED) != 0, (bits & STORE_TERMVECTOR) != 0, (bits & STORE_POSITIONS_WITH_TERMVECTOR) != 0,
                     (bits & STORE_OFFSET_WITH_TERMVECTOR) != 0, (bits & OMIT_NORMS) != 0, (bits & STORE_PAYLOADS) != 0,
                     (bits & OMIT_TERM_FREQ_AND_POSITIONS) != 0);
     }
     
     if (input->getFilePointer() != input->length())
     {
         boost::throw_exception(CorruptIndexException(L"did not read all bytes from file \"" + fileName + L"\": read " + 
                                                      StringUtils::toString(input->getFilePointer()) + L" vs size " + 
                                                      StringUtils::toString(input->length())));
     }
 }
コード例 #2
0
 virtual int64_t length() {
     return input->length();
 }