Package com.stripe.net
Class HttpContent
- java.lang.Object
-
- com.stripe.net.HttpContent
-
public final class HttpContent extends java.lang.Object
Represents the content of an HTTP request, i.e. the request's body. This class also holds the value of theContent-Type
header, which can depend on the body in some cases (e.g. for multipart requests).
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static HttpContent
buildFormURLEncodedContent(java.util.Collection<KeyValuePair<java.lang.String,java.lang.String>> nameValueCollection)
Builds a new HttpContent for name/value tuples encoded usingapplication/x-www-form-urlencoded
MIME type.static HttpContent
buildMultipartFormDataContent(java.util.Collection<KeyValuePair<java.lang.String,java.lang.Object>> nameValueCollection)
Builds a new HttpContent for name/value tuples encoded usingmultipart/form-data
MIME type.static HttpContent
buildMultipartFormDataContent(java.util.Collection<KeyValuePair<java.lang.String,java.lang.Object>> nameValueCollection, java.lang.String boundary)
Builds a new HttpContent for name/value tuples encoded usingmultipart/form-data
MIME type.byte[]
byteArrayContent()
The request's content, as a byte array.java.lang.String
contentType()
The value of theContent-Type
header.boolean
equals(java.lang.Object o)
int
hashCode()
java.lang.String
stringContent()
The request's content, as a string.java.lang.String
toString()
-
-
-
Method Detail
-
buildFormURLEncodedContent
public static HttpContent buildFormURLEncodedContent(java.util.Collection<KeyValuePair<java.lang.String,java.lang.String>> nameValueCollection) throws java.io.IOException
Builds a new HttpContent for name/value tuples encoded usingapplication/x-www-form-urlencoded
MIME type.- Parameters:
nameValueCollection
- the collection of name/value tuples to encode- Returns:
- the encoded HttpContent instance
- Throws:
java.lang.IllegalArgumentException
- if nameValueCollection is nulljava.io.IOException
-
stringContent
public java.lang.String stringContent()
The request's content, as a string.
-
buildMultipartFormDataContent
public static HttpContent buildMultipartFormDataContent(java.util.Collection<KeyValuePair<java.lang.String,java.lang.Object>> nameValueCollection) throws java.io.IOException
Builds a new HttpContent for name/value tuples encoded usingmultipart/form-data
MIME type.- Parameters:
nameValueCollection
- the collection of name/value tuples to encode- Returns:
- the encoded HttpContent instance
- Throws:
java.lang.IllegalArgumentException
- if nameValueCollection is nulljava.io.IOException
-
buildMultipartFormDataContent
public static HttpContent buildMultipartFormDataContent(java.util.Collection<KeyValuePair<java.lang.String,java.lang.Object>> nameValueCollection, java.lang.String boundary) throws java.io.IOException
Builds a new HttpContent for name/value tuples encoded usingmultipart/form-data
MIME type.- Parameters:
nameValueCollection
- the collection of name/value tuples to encodeboundary
- the boundary- Returns:
- the encoded HttpContent instance
- Throws:
java.lang.IllegalArgumentException
- if nameValueCollection is nulljava.io.IOException
-
byteArrayContent
public byte[] byteArrayContent()
The request's content, as a byte array.
-
contentType
public java.lang.String contentType()
The value of theContent-Type
header.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-