Package com.stripe.net
Class HttpContent
- java.lang.Object
-
- com.stripe.net.HttpContent
-
public final class HttpContent extends java.lang.ObjectRepresents the content of an HTTP request, i.e. the request's body. This class also holds the value of theContent-Typeheader, 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 HttpContentbuildFormURLEncodedContent(java.util.Collection<KeyValuePair<java.lang.String,java.lang.String>> nameValueCollection)Builds a new HttpContent for name/value tuples encoded usingapplication/x-www-form-urlencodedMIME type.static HttpContentbuildMultipartFormDataContent(java.util.Collection<KeyValuePair<java.lang.String,java.lang.Object>> nameValueCollection)Builds a new HttpContent for name/value tuples encoded usingmultipart/form-dataMIME type.static HttpContentbuildMultipartFormDataContent(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-dataMIME type.byte[]byteArrayContent()The request's content, as a byte array.java.lang.StringcontentType()The value of theContent-Typeheader.booleanequals(java.lang.Object o)inthashCode()java.lang.StringstringContent()The request's content, as a string.java.lang.StringtoString()
-
-
-
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-urlencodedMIME 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-dataMIME 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-dataMIME 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-Typeheader.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-