Example usage for twitter4j HttpParameter getName

List of usage examples for twitter4j HttpParameter getName

Introduction

In this page you can find the example usage for twitter4j HttpParameter getName.

Prototype

public String getName() 

Source Link

Usage

From source file:com.daiv.android.twitter.utils.api_helper.APIHelper.java

License:Apache License

/**
 * Encodes the parameters/*  w  w  w  .  j a  v a 2 s .  c om*/
 * @param httpParams parameters you want to send
 * @param splitter character used to split the parameters
 * @param quot whether you should use quotations or not
 * @return string of the desired encoding
 */
public static String encodeParameters(List<HttpParameter> httpParams, String splitter, boolean quot) {
    StringBuilder buf = new StringBuilder();
    for (HttpParameter param : httpParams) {
        if (!param.isFile()) {
            if (buf.length() != 0) {
                if (quot) {
                    buf.append("\"");
                }
                buf.append(splitter);
            }
            buf.append(HttpParameter.encode(param.getName())).append("=");
            if (quot) {
                buf.append("\"");
            }
            buf.append(HttpParameter.encode(param.getValue()));
        }
    }
    if (buf.length() != 0) {
        if (quot) {
            buf.append("\"");
        }
    }
    return buf.toString();
}