twitter4j

## Class HttpParameter

- java.lang.Object
- - twitter4j.HttpParameter

All Implemented Interfaces:
  Serializable, Comparable<HttpParameter>

    public final class HttpParameter
    extends Object
    implements Comparable<HttpParameter>, Serializable

A data class representing HTTP Post parameter

Author:
  Yusuke Yamamoto - yusuke at mac.com
See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`HttpParameter(JSONObject jsonObject)`
`HttpParameter(String name, boolean value)`
`HttpParameter(String name, double value)`
`HttpParameter(String name, File file)`
`HttpParameter(String name, int value)`
`HttpParameter(String name, long value)`
`HttpParameter(String name, String value)`
`HttpParameter(String name, String fileName, InputStream fileBody)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`int` `compareTo(HttpParameter o)`
`static boolean` `containsFile(HttpParameter[] params)`
`static boolean` `containsJson(HttpParameter[] params)`
`static String` `decode(String value)`
`static List<HttpParameter>` `decodeParameters(String queryParameters)` Parses a query string without the leading "?"
`static String` `encode(String value)`
`static String` `encodeParameters(HttpParameter[] httpParams)`
`boolean` `equals(Object o)`
`String` `getContentType()`
`File` `getFile()`
`InputStream` `getFileBody()`
`JSONObject` `getJsonObject()`
`String` `getName()`
`static HttpParameter[]` `getParameterArray(String name, int value)`
`static HttpParameter[]` `getParameterArray(String name1, int value1, String name2, int value2)`
`static HttpParameter[]` `getParameterArray(String name, String value)`
`static HttpParameter[]` `getParameterArray(String name1, String value1, String name2, String value2)`
`String` `getValue()`
`boolean` `hasFileBody()`
`int` `hashCode()`
`boolean` `isFile()`
`boolean` `isJson()`
`String` `toString()`

### Methods inherited from class java.lang.Object

`getClass, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### HttpParameter

    public HttpParameter(String name,
                         String value)

#### HttpParameter

    public HttpParameter(JSONObject jsonObject)

#### HttpParameter

    public HttpParameter(String name,
                         File file)

#### HttpParameter

    public HttpParameter(String name,
                         String fileName,
                         InputStream fileBody)

#### HttpParameter

    public HttpParameter(String name,
                         int value)

#### HttpParameter

    public HttpParameter(String name,
                         long value)

#### HttpParameter

    public HttpParameter(String name,
                         double value)

#### HttpParameter

    public HttpParameter(String name,
                         boolean value)

### Method Detail

#### getName

    public String getName()

#### getValue

    public String getValue()

#### getJsonObject

    public JSONObject getJsonObject()

#### getFile

    public File getFile()

#### getFileBody

    public InputStream getFileBody()

#### isFile

    public boolean isFile()

#### isJson

    public boolean isJson()

#### hasFileBody

    public boolean hasFileBody()

#### getContentType

    public String getContentType()

Returns:
  content-type

#### equals

    public boolean equals(Object o)

Overrides:
  `equals` in class `Object`

#### containsJson

    public static boolean containsJson(HttpParameter[] params)

#### containsFile

    public static boolean containsFile(HttpParameter[] params)

#### getParameterArray

    public static HttpParameter[] getParameterArray(String name,
                                                    String value)

#### getParameterArray

    public static HttpParameter[] getParameterArray(String name,
                                                    int value)

#### getParameterArray

    public static HttpParameter[] getParameterArray(String name1,
                                                    String value1,
                                                    String name2,
                                                    String value2)

#### getParameterArray

    public static HttpParameter[] getParameterArray(String name1,
                                                    int value1,
                                                    String name2,
                                                    int value2)

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `Object`

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

#### compareTo

    public int compareTo(HttpParameter o)

Specified by:
  `compareTo` in interface `Comparable<HttpParameter>`

#### encodeParameters

    public static String encodeParameters(HttpParameter[] httpParams)

#### encode

    public static String encode(String value)

Parameters:
  `value` - string to be encoded
Returns:
  encoded string
See Also:
  OAuth / TestCases, Space encoding - OAuth | Google Groups, RFC 3986 - Uniform Resource Identifier (URI): Generic Syntax - 2.1. Percent-Encoding

#### decode

    public static String decode(String value)

Parameters:
  `value` - string to be decoded. The natural opposite of encode() above.
Returns:
  encoded string
See Also:
  OAuth / TestCases, Space encoding - OAuth | Google Groups, RFC 3986 - Uniform Resource Identifier (URI): Generic Syntax - 2.1. Percent-Encoding

#### decodeParameters

    public static List<HttpParameter> decodeParameters(String queryParameters)

Parses a query string without the leading "?"

Parameters:
  `queryParameters` - a query parameter string, like a=hello&b=world
Returns:
  decoded parameters