text: public FSTTermsWriter(SegmentWriteState state, PostingsWriterBase postingsWriter) throws IOException {final String termsFileName = IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, TERMS_EXTENSION);this.postingsWriter = postingsWriter;this.fieldInfos = state.fieldInfos;this.out = state.directory.createOutput(termsFileName, state.context);this.maxDoc = state.segmentInfo.maxDoc();boolean success = false;try {CodecUtil.writeIndexHeader(out, TERMS_CODEC_NAME, TERMS_VERSION_CURRENT,state.segmentInfo.getId(), state.segmentSuffix);this.postingsWriter.init(out, state);success = true;} finally {if (!success) {IOUtils.closeWhileHandlingException(out);}}}