private void writeIndexCoding(IndexCoding indexCoding, NVariable variable) throws IOException {
   CfIndexCodingPart.writeIndexCoding(indexCoding, variable);
   final String[] indexNames = indexCoding.getIndexNames();
   final StringBuilder descriptions = new StringBuilder();
   for (String indexName : indexNames) {
     final MetadataAttribute index = indexCoding.getIndex(indexName);
     if (index != null) {
       final String description = index.getDescription();
       if (description != null) {
         descriptions.append(description);
       }
     }
     descriptions.append(DESCRIPTION_SEPARATOR);
   }
   variable.addAttribute(INDEX_DESCRIPTIONS, descriptions.toString().trim());
   variable.addAttribute(INDEX_CODING_NAME, indexCoding.getName());
 }
  private static IndexCoding readIndexCoding(Variable variable, String indexCodingName)
      throws ProductIOException {
    final IndexCoding indexCoding = CfIndexCodingPart.readIndexCoding(variable, indexCodingName);

    if (indexCoding != null) {
      final Attribute descriptionsAtt = variable.findAttributeIgnoreCase(INDEX_DESCRIPTIONS);
      if (descriptionsAtt != null) {
        final String[] descriptions = descriptionsAtt.getStringValue().split(DESCRIPTION_SEPARATOR);
        if (indexCoding.getNumAttributes() == descriptions.length) {
          for (int i = 0; i < descriptions.length; i++) {
            indexCoding.getAttributeAt(i).setDescription(descriptions[i]);
          }
        }
      }
      final Attribute nameAtt = variable.findAttributeIgnoreCase(INDEX_CODING_NAME);
      if (nameAtt != null) {
        indexCoding.setName(nameAtt.getStringValue());
      }
    }
    return indexCoding;
  }