public class

MultipartEntity

extends Object
implements RequestEntity
java.lang.Object
   ↳ chan.http.MultipartEntity

Class Overview

Multipart Form Data implementation of RequestEntity.

Summary

Public Constructors
MultipartEntity()

Default constructor for a MultipartEntity.

MultipartEntity(String... alternation)

Constructor for a MultipartEntity.

Public Methods
void add(String name, String value)

Add string field to entity with given name and value.

void add(String name, File file)

Add file field to entity with given name and file.

RequestEntity copy()

Returns a deep copy of this RequestEntity instance.

long getContentLength()

Returns a content length of entity.

String getContentType()

Returns a content type of entity.

void setEncoding(String charsetName)

Changes encoding type for this entity.

void write(OutputStream output)

Writes entity to given output.

[Expand]
Inherited Methods
From class java.lang.Object
From interface chan.http.RequestEntity

Public Constructors

public MultipartEntity ()

Default constructor for a MultipartEntity.

public MultipartEntity (String... alternation)

Constructor for a MultipartEntity.

Parameters
alternation String: Alternation of string field's names and values (name, value, name, value...).

Public Methods

public void add (String name, String value)

Add string field to entity with given name and value.

Parameters
name String: Field name.
value String: Field value.

public void add (String name, File file)

Add file field to entity with given name and file.

Parameters
name String: Field name.
file File: File to write.

public RequestEntity copy ()

Returns a deep copy of this RequestEntity instance.

Returns
RequestEntity Copy of this entity.

public long getContentLength ()

Returns a content length of entity.

Returns
long Content length.

public String getContentType ()

Returns a content type of entity.

Returns
String Content type.

public void setEncoding (String charsetName)

Changes encoding type for this entity. By default UTF-8 is used.

Parameters
charsetName String: Charset name.

public void write (OutputStream output)

Writes entity to given output.

Parameters
output OutputStream: Output stream.
Throws
IOException