code: protected String getContentPartAsString(Map<String,ContentPart<?>> contentPartsMap,String parameter)
      {
          //get part
          String stringValue=null;
          ContentPart<?> contentPart=contentPartsMap.get(parameter);
          if(contentPart!=null)
          {
              ContentPartType contentPartType=contentPart.getType();
              Object content=contentPart.getContent();
              if(content!=null)
              {
                  switch(contentPartType)
                  {
                      case STRING:
                          stringValue=(String)content;
                          break;
                      case BINARY:
                          byte[] data=(byte[])content;
                          String encoding=IOHelper.getDefaultEncoding();
                          try
                          {
                              stringValue=new String(data,encoding);
                          }
                          catch(UnsupportedEncodingException exception)
                          {
                              throw new FaxException("Unable to convert binary data to string for parameter: "+parameter,exception);
                          }
                          break;
                      default:
                          throw new FaxException("Unsupported content part type: "+contentPartType);
                  }
              }
          }
          
          return stringValue;
      }
docs: This function returns the content part string value.
  
  @param   contentPartsMap
  The content parts map
  @param   parameter
  The part parameter name
  @return  The part string value