Example usage for twitter4j HttpParameter getValue

List of usage examples for twitter4j HttpParameter getValue

Introduction

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

Prototype

public String getValue() 

Source Link

Usage

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

License:Apache License

/**
 * Encodes the parameters/*  w  ww  .j a va 2s  .  c  o  m*/
 * @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();
}