text: public VariableGapTermsIndexWriter(SegmentWriteState state, IndexTermSelector policy) throws IOException {final String indexFileName = IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, TERMS_INDEX_EXTENSION);out = state.directory.createOutput(indexFileName, state.context);boolean success = false;try {fieldInfos = state.fieldInfos;this.policy = policy;CodecUtil.writeIndexHeader(out, CODEC_NAME, VERSION_CURRENT, state.segmentInfo.getId(), state.segmentSuffix);success = true;} finally {if (!success) {IOUtils.closeWhileHandlingException(out);}}}