//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: @Override public void write(store.Directory directory, String segmentName, String segmentSuffix, index.FieldInfos infos, store.IOContext context) throws java.io.IOException public override void write(Directory directory, string segmentName, string segmentSuffix, FieldInfos infos, IOContext context) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final String fileName = index.IndexFileNames.segmentFileName(segmentName, segmentSuffix, FIELD_INFOS_EXTENSION); string fileName = IndexFileNames.segmentFileName(segmentName, segmentSuffix, FIELD_INFOS_EXTENSION); IndexOutput @out = directory.createOutput(fileName, context); BytesRef scratch = new BytesRef(); bool success = false; try { SimpleTextUtil.write(@out, NUMFIELDS); SimpleTextUtil.write(@out, Convert.ToString(infos.size()), scratch); SimpleTextUtil.WriteNewline(@out); foreach (FieldInfo fi in infos) { SimpleTextUtil.write(@out, NAME); SimpleTextUtil.write(@out, fi.name, scratch); SimpleTextUtil.WriteNewline(@out); SimpleTextUtil.write(@out, NUMBER); SimpleTextUtil.write(@out, Convert.ToString(fi.number), scratch); SimpleTextUtil.WriteNewline(@out); SimpleTextUtil.write(@out, ISINDEXED); SimpleTextUtil.write(@out, Convert.ToString(fi.Indexed), scratch); SimpleTextUtil.WriteNewline(@out); if (fi.Indexed) { Debug.Assert(fi.IndexOptions.compareTo(FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0 || !fi.hasPayloads()); SimpleTextUtil.write(@out, INDEXOPTIONS); SimpleTextUtil.write(@out, fi.IndexOptions.ToString(), scratch); SimpleTextUtil.WriteNewline(@out); } SimpleTextUtil.write(@out, STORETV); SimpleTextUtil.write(@out, Convert.ToString(fi.hasVectors()), scratch); SimpleTextUtil.WriteNewline(@out); SimpleTextUtil.write(@out, PAYLOADS); SimpleTextUtil.write(@out, Convert.ToString(fi.hasPayloads()), scratch); SimpleTextUtil.WriteNewline(@out); SimpleTextUtil.write(@out, NORMS); SimpleTextUtil.write(@out, Convert.ToString(!fi.omitsNorms()), scratch); SimpleTextUtil.WriteNewline(@out); SimpleTextUtil.write(@out, NORMS_TYPE); SimpleTextUtil.write(@out, getDocValuesType(fi.NormType), scratch); SimpleTextUtil.WriteNewline(@out); SimpleTextUtil.write(@out, DOCVALUES); SimpleTextUtil.write(@out, getDocValuesType(fi.DocValuesType), scratch); SimpleTextUtil.WriteNewline(@out); SimpleTextUtil.write(@out, DOCVALUES_GEN); SimpleTextUtil.write(@out, Convert.ToString(fi.DocValuesGen), scratch); SimpleTextUtil.WriteNewline(@out); IDictionary <string, string> atts = fi.attributes(); int numAtts = atts == null ? 0 : atts.Count; SimpleTextUtil.write(@out, NUM_ATTS); SimpleTextUtil.write(@out, Convert.ToString(numAtts), scratch); SimpleTextUtil.WriteNewline(@out); if (numAtts > 0) { foreach (KeyValuePair <string, string> entry in atts.SetOfKeyValuePairs()) { SimpleTextUtil.write(@out, ATT_KEY); SimpleTextUtil.write(@out, entry.Key, scratch); SimpleTextUtil.WriteNewline(@out); SimpleTextUtil.write(@out, ATT_VALUE); SimpleTextUtil.write(@out, entry.Value, scratch); SimpleTextUtil.WriteNewline(@out); } } } SimpleTextUtil.WriteChecksum(@out, scratch); success = true; } finally { if (success) { @out.close(); } else { IOUtils.closeWhileHandlingException(@out); } } }