@SuppressWarnings({"rawtypes","unchecked"}) void appendQueryFields(final StringBuffer buf,final Map fields){
  final List fieldNames=new ArrayList(fields.keySet());
  final Iterator itr=fieldNames.iterator();
  while (itr.hasNext()) {
    final String fieldName=(String)itr.next();
    final String fieldValue=(String)fields.get(fieldName);
    if (fieldValue != null && fieldValue.length() > 0)     try {
      buf.append(URLEncoder.encode(fieldName,"UTF-8"));
      buf.append('=');
      buf.append(URLEncoder.encode(fieldValue,"UTF-8"));
    }
 catch (    final UnsupportedEncodingException e) {
      throw new RuntimeException(e.getMessage());
    }
    if (itr.hasNext())     buf.append('&');
  }
}

@ SuppressWarnings ( { "rawtypes" , "unchecked" } ) void appendQueryFields ( final StringBuffer buf , final Map fields ) { final List fieldNames = new ArrayList ( fields . keySet ( ) ) ; final Iterator itr = fieldNames . iterator ( ) ; while ( itr . hasNext ( ) ) { final String fieldName = ( String ) itr . next ( ) ; final String fieldValue = ( String ) fields . get ( fieldName ) ; if ( fieldValue != null && fieldValue . length ( ) > 0 ) try { buf . append ( URLEncoder . encode ( fieldName , "UTF-8" ) ) ; buf . append ( '=' ) ; buf . append ( URLEncoder . encode ( fieldValue , "UTF-8" ) ) ; } catch ( final UnsupportedEncodingException e ) { throw new RuntimeException ( e . getMessage ( ) ) ; } if ( itr . hasNext ( ) ) buf . append ( '&' ) ; } }
this method is for creating a url query string .
