Class MultipartEntity
- java.lang.Object
-
- com.foxinmy.weixin4j.http.apache.mime.MultipartEntity
-
- All Implemented Interfaces:
HttpEntity
public class MultipartEntity extends Object implements HttpEntity
Multipart/form coded HTTP entity consisting of multiple body parts.- Since:
- 4.0
-
-
Constructor Summary
Constructors Constructor Description MultipartEntity()Creates an instance using modeHttpMultipartMode.STRICTMultipartEntity(HttpMultipartMode mode)Creates an instance using the specifiedHttpMultipartModemode.MultipartEntity(HttpMultipartMode mode, String boundary, Charset charset)Creates an instance using the specified parameters
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPart(FormBodyPart bodyPart)voidaddPart(String name, ContentBody contentBody)protected StringgenerateBoundary()protected StringgenerateContentType(String boundary, Charset charset)InputStreamgetContent()longgetContentLength()ContentTypegetContentType()booleanisChunked()booleanisRepeatable()booleanisStreaming()voidwriteTo(OutputStream outstream)
-
-
-
Constructor Detail
-
MultipartEntity
public MultipartEntity(HttpMultipartMode mode, String boundary, Charset charset)
Creates an instance using the specified parameters- Parameters:
mode- the mode to use, may benull, in which caseHttpMultipartMode.STRICTis usedboundary- the boundary string, may benull, in which casegenerateBoundary()is invoked to create the stringcharset- the character set to use, may benull, in which caseMIME.DEFAULT_CHARSET- i.e. US-ASCII - is used.
-
MultipartEntity
public MultipartEntity(HttpMultipartMode mode)
Creates an instance using the specifiedHttpMultipartModemode. Boundary and charset are set tonull.- Parameters:
mode- the desired mode
-
MultipartEntity
public MultipartEntity()
Creates an instance using modeHttpMultipartMode.STRICT
-
-
Method Detail
-
generateBoundary
protected String generateBoundary()
-
addPart
public void addPart(FormBodyPart bodyPart)
-
addPart
public void addPart(String name, ContentBody contentBody)
-
isRepeatable
public boolean isRepeatable()
-
isChunked
public boolean isChunked()
-
isStreaming
public boolean isStreaming()
-
getContentLength
public long getContentLength()
- Specified by:
getContentLengthin interfaceHttpEntity
-
getContentType
public ContentType getContentType()
- Specified by:
getContentTypein interfaceHttpEntity
-
getContent
public InputStream getContent() throws IOException, UnsupportedOperationException
- Specified by:
getContentin interfaceHttpEntity- Throws:
IOExceptionUnsupportedOperationException
-
writeTo
public void writeTo(OutputStream outstream) throws IOException
- Specified by:
writeToin interfaceHttpEntity- Throws:
IOException
-
-