public BlockTermsWriter(TermsIndexWriterBase termsIndexWriter,SegmentWriteState state, PostingsWriterBase postingsWriter)throws IOException {final String termsFileName = IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, TERMS_EXTENSION);this.termsIndexWriter = termsIndexWriter;maxDoc = state.segmentInfo.maxDoc();out = state.directory.createOutput(termsFileName, state.context);boolean success = false;try {fieldInfos = state.fieldInfos;CodecUtil.writeIndexHeader(out, CODEC_NAME, VERSION_CURRENT, state.segmentInfo.getId(), state.segmentSuffix);currentField = null;this.postingsWriter = postingsWriter;postingsWriter.init(out, state); success = true;} finally {if (!success) {IOUtils.closeWhileHandlingException(out);}}}
public BlockTermsWriter(TermsIndexWriterBase termsIndexWriter,SegmentWriteState state, PostingsWriterBase postingsWriter){string termsFileName = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, TERMS_EXTENSION);this.termsIndexWriter = termsIndexWriter;m_output = state.Directory.CreateOutput(termsFileName, state.Context);bool success = false;try{fieldInfos = state.FieldInfos;WriteHeader(m_output);currentField = null;this.postingsWriter = postingsWriter;postingsWriter.Init(m_output); success = true;}finally{if (!success){IOUtils.DisposeWhileHandlingException(m_output);}}}