com.foxinmy.weixin4j.http.apache
Class MultipartEntity

java.lang.Object
  extended by com.foxinmy.weixin4j.http.apache.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
MultipartEntity()
          Creates an instance using mode HttpMultipartMode.STRICT
MultipartEntity(HttpMultipartMode mode)
          Creates an instance using the specified HttpMultipartMode mode.
MultipartEntity(HttpMultipartMode mode, String boundary, Charset charset)
          Creates an instance using the specified parameters
 
Method Summary
 void addPart(FormBodyPart bodyPart)
           
 void addPart(String name, ContentBody contentBody)
           
 void consumeContent()
           
 InputStream getContent()
           
 long getContentLength()
           
 ContentType getContentType()
           
 boolean isChunked()
           
 boolean isRepeatable()
           
 boolean isStreaming()
           
 void writeTo(OutputStream outstream)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 be null, in which case HttpMultipartMode.STRICT is used
boundary - the boundary string, may be null, in which case generateBoundary() is invoked to create the string
charset - the character set to use, may be null, in which case MIME.DEFAULT_CHARSET - i.e. US-ASCII - is used.

MultipartEntity

public MultipartEntity(HttpMultipartMode mode)
Creates an instance using the specified HttpMultipartMode mode. Boundary and charset are set to null.

Parameters:
mode - the desired mode

MultipartEntity

public MultipartEntity()
Creates an instance using mode HttpMultipartMode.STRICT

Method Detail

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 interface HttpEntity

getContentType

public ContentType getContentType()
Specified by:
getContentType in interface HttpEntity

consumeContent

public void consumeContent()
                    throws IOException,
                           UnsupportedOperationException
Throws:
IOException
UnsupportedOperationException

getContent

public InputStream getContent()
                       throws IOException,
                              UnsupportedOperationException
Specified by:
getContent in interface HttpEntity
Throws:
IOException
UnsupportedOperationException

writeTo

public void writeTo(OutputStream outstream)
             throws IOException
Specified by:
writeTo in interface HttpEntity
Throws:
IOException


Copyright © 2014–2017. All rights reserved.