public class

SimpleEntity

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

Class Overview

Simple implementation of RequestEntity.

Method add(String, String) is not supported for this entity.

Summary

Public Constructors
SimpleEntity()
Public Methods
void add(String name, String value)

Add string field to entity with given name and value.

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 setContentType(String contentType)

Sets a content type of entity.

void setData(String data)

Sets string data with UTF-8 encoding.

void setData(byte[] data)

Sets byte array data.

void setData(String data, String charsetName)

Sets string data with given charsetName encoding.

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 SimpleEntity ()

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 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 setContentType (String contentType)

Sets a content type of entity.

Parameters
contentType String: Content type.

public void setData (String data)

Sets string data with UTF-8 encoding.

Parameters
data String: String data.

public void setData (byte[] data)

Sets byte array data.

Parameters
data byte: Byte array data.

public void setData (String data, String charsetName)

Sets string data with given charsetName encoding.

Parameters
data String: String data.
charsetName String: Charset name.

public void write (OutputStream output)

Writes entity to given output.

Parameters
output OutputStream: Output stream.
Throws
IOException