Пример #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public void checkIntegrity() throws java.io.IOException
        public override void checkIntegrity()
        {
            if (version >= VERSION_CHECKSUM)
            {
                CodecUtil.checksumEntireFile(data);
            }
        }
Пример #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public FSTTermsReader(index.SegmentReadState state, codecs.PostingsReaderBase postingsReader) throws java.io.IOException
        public FSTTermsReader(SegmentReadState state, PostingsReaderBase postingsReader)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String termsFileName = index.IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, FSTTermsWriter.TERMS_EXTENSION);
            string termsFileName = IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, FSTTermsWriter.TERMS_EXTENSION);

            this.postingsReader = postingsReader;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final store.IndexInput in = state.directory.openInput(termsFileName, state.context);
            IndexInput @in = state.directory.openInput(termsFileName, state.context);

            bool success = false;

            try
            {
                version = readHeader(@in);
                if (version >= FSTTermsWriter.TERMS_VERSION_CHECKSUM)
                {
                    CodecUtil.checksumEntireFile(@in);
                }
                this.postingsReader.init(@in);
                seekDir(@in);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final index.FieldInfos fieldInfos = state.fieldInfos;
                FieldInfos fieldInfos = state.fieldInfos;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int numFields = in.readVInt();
                int numFields = @in.readVInt();
                for (int i = 0; i < numFields; i++)
                {
                    int         fieldNumber      = @in.readVInt();
                    FieldInfo   fieldInfo        = fieldInfos.fieldInfo(fieldNumber);
                    long        numTerms         = @in.readVLong();
                    long        sumTotalTermFreq = fieldInfo.IndexOptions == IndexOptions.DOCS_ONLY ? -1 : @in.readVLong();
                    long        sumDocFreq       = @in.readVLong();
                    int         docCount         = @in.readVInt();
                    int         longsSize        = @in.readVInt();
                    TermsReader current          = new TermsReader(this, fieldInfo, @in, numTerms, sumTotalTermFreq, sumDocFreq, docCount, longsSize);
                    TermsReader previous         = fields[fieldInfo.name] = current;
                    checkFieldSummary(state.segmentInfo, @in, current, previous);
                }
                success = true;
            }
            finally
            {
                if (success)
                {
                    IOUtils.close(@in);
                }
                else
                {
                    IOUtils.closeWhileHandlingException(@in);
                }
            }
        }