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.STRICT
MultipartEntity(HttpMultipartMode mode)
Creates an instance using the specifiedHttpMultipartMode
mode.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 void
addPart(FormBodyPart bodyPart)
void
addPart(String name, ContentBody contentBody)
protected String
generateBoundary()
protected String
generateContentType(String boundary, Charset charset)
InputStream
getContent()
long
getContentLength()
ContentType
getContentType()
boolean
isChunked()
boolean
isRepeatable()
boolean
isStreaming()
void
writeTo(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.STRICT
is 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 specifiedHttpMultipartMode
mode. 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:
getContentLength
in interfaceHttpEntity
-
getContentType
public ContentType getContentType()
- Specified by:
getContentType
in interfaceHttpEntity
-
getContent
public InputStream getContent() throws IOException, UnsupportedOperationException
- Specified by:
getContent
in interfaceHttpEntity
- Throws:
IOException
UnsupportedOperationException
-
writeTo
public void writeTo(OutputStream outstream) throws IOException
- Specified by:
writeTo
in interfaceHttpEntity
- Throws:
IOException
-
-