public void addField(String name,String value) throws IOException {
  if (name == null) {
    throw new IllegalArgumentException("Name cannot be null or empty.");
  }
  if (formData.length() > 0) {
    formData.append("&");
  }
  formData.append(name + "=");
  if (value != null) {
    formData.append(URLEncoder.encode(value,charset));
  }
}

public void addField ( String name , String value ) throws IOException { if ( name == null ) { throw new IllegalArgumentException ( "Name cannot be null or empty." ) ; } if ( formData . length ( ) > 0 ) { formData . append ( "&" ) ; } formData . append ( name + "=" ) ; if ( value != null ) { formData . append ( URLEncoder . encode ( value , charset ) ) ; } }
writes a string field value .
