| AndBase开发框架 1.6

- 首页
- 相关页面
- 命名空间
- 类
- 文件

- 类列表
- 类索引
- 类继承关系
- 类成员

全部 类 命名空间 文件 函数 变量 枚举值 页
类 | Public 成员函数 | Private 成员函数 | Private 属性 | 静态 Private 属性 | 所有成员列表
com.ab.http.AbMultipartEntity类 参考
类 com.ab.http.AbMultipartEntity 继承关系图:

## 类
class | FilePart

## Public 成员函数
| AbMultipartEntity (AbHttpResponseListener responseListener)
void | addPart (String key, String value, String contentType)
void | addPart (String key, String value)
void | addPart (String key, File file)
void | addPart (String key, File file, String type)
void | addPart (String key, String streamName, InputStream inputStream, String type) throws IOException
long | getContentLength ()
Header | getContentType ()
boolean | isChunked ()
boolean | isRepeatable ()
boolean | isStreaming ()
void | writeTo (final OutputStream outstream) throws IOException
Header | getContentEncoding ()
void | consumeContent () throws IOException, UnsupportedOperationException
InputStream | getContent () throws IOException, UnsupportedOperationException

## Private 成员函数
byte[] | createContentType (String type)
byte[] | createContentDisposition (final String key)
byte[] | createContentDisposition (final String key, final String fileName)
void | updateProgress (int count)

## Private 属性
String | boundary
byte[] | boundaryLine
byte[] | boundaryEnd
List< FilePart > | fileParts = new ArrayList<FilePart>()
ByteArrayOutputStream | out = new ByteArrayOutputStream()
AbHttpResponseListener | responseListener
int | bytesWritten
int | totalSize

## 静态 Private 属性
static final String | APPLICATION_OCTET_STREAM = "application/octet-stream"
static final byte[] | CR_LF = ("\r\n").getBytes()
static final byte[] | TRANSFER_ENCODING_BINARY
static final char[] | MULTIPART_CHARS = "-_1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray()

## 详细描述

© 2012 amsoft.cn 名称：AbMultipartEntity.java 描述：用于文件上传

作者
  还如一梦中

版本
  v1.0

日期
  ：2013-11-13 下午1:09:20

## 构造及析构函数说明

com.ab.http.AbMultipartEntity.AbMultipartEntity | ( | AbHttpResponseListener | responseListener | ) |
| inline

构造方法.

参数

  responseListener | 监听器

## 成员函数说明

void com.ab.http.AbMultipartEntity.addPart | ( | String | key,
|  | String | value,
|  | String | contentType
| ) |  |
| inline

Adds the part.

参数

  key | the key
  value | the value
  contentType | the content type

void com.ab.http.AbMultipartEntity.addPart | ( | String | key,
|  | String | value
| ) |  |
| inline

Adds the part.

参数

  key | the key
  value | the value

void com.ab.http.AbMultipartEntity.addPart | ( | String | key,
|  | File | file
| ) |  |
| inline

Adds the part.

参数

  key | the key
  file | the file

void com.ab.http.AbMultipartEntity.addPart | ( | String | key,
|  | File | file,
|  | String | type
| ) |  |
| inline

Adds the part.

参数

  key | the key
  file | the file
  type | the type

void com.ab.http.AbMultipartEntity.addPart | ( | String | key,
|  | String | streamName,
|  | InputStream | inputStream,
|  | String | type
| ) |  | throws IOException
| inline

Adds the part.

参数

  key | the key
  streamName | the stream name
  inputStream | the input stream
  type | the type

异常

  IOException | Signals that an I/O exception has occurred.

void com.ab.http.AbMultipartEntity.consumeContent | ( |  | ) | throws IOException, UnsupportedOperationException
| inline

描述：TODO.

异常

  IOException | Signals that an I/O exception has occurred.
  UnsupportedOperationException | the unsupported operation exception

参见
  org.apache.http.HttpEntity::consumeContent()

byte [] com.ab.http.AbMultipartEntity.createContentDisposition | ( | final String | key | ) |
| inline private

Creates the content disposition.

参数

  key | the key

返回
  the byte[]

byte [] com.ab.http.AbMultipartEntity.createContentDisposition | ( | final String | key,
|  | final String | fileName
| ) |  |
| inline private

Creates the content disposition.

参数

  key | the key
  fileName | the file name

返回
  the byte[]

byte [] com.ab.http.AbMultipartEntity.createContentType | ( | String | type | ) |
| inline private

Creates the content type.

参数

  type | the type

返回
  the byte[]

InputStream com.ab.http.AbMultipartEntity.getContent | ( |  | ) | throws IOException, UnsupportedOperationException
| inline

描述：获取内容流.

返回
  the content

异常

  IOException | Signals that an I/O exception has occurred.
  UnsupportedOperationException | the unsupported operation exception

参见
  org.apache.http.HttpEntity::getContent()

Header com.ab.http.AbMultipartEntity.getContentEncoding | ( |  | ) |
| inline

描述：获取编码.

返回
  the content encoding

参见
  org.apache.http.HttpEntity::getContentEncoding()

long com.ab.http.AbMultipartEntity.getContentLength | ( |  | ) |
| inline

描述：获取长度.

返回
  the content length

参见
  org.apache.http.HttpEntity::getContentLength()

Header com.ab.http.AbMultipartEntity.getContentType | ( |  | ) |
| inline

描述：获取类型.

版本
  v1.0

返回
  the content type

参见
  org.apache.http.HttpEntity::getContentType()

作者
  : amsoft.cn

日期
  ：2013-10-22 下午4:23:15

boolean com.ab.http.AbMultipartEntity.isChunked | ( |  | ) |
| inline

描述：输出的内容长度不能确定.

返回
  true, if is chunked

参见
  org.apache.http.HttpEntity::isChunked()

boolean com.ab.http.AbMultipartEntity.isRepeatable | ( |  | ) |
| inline

描述：是否使用了不可重复的请求实体.

返回
  true, if is repeatable

参见
  org.apache.http.HttpEntity::isRepeatable()

boolean com.ab.http.AbMultipartEntity.isStreaming | ( |  | ) |
| inline

描述：TODO.

返回
  true, if is streaming

参见
  org.apache.http.HttpEntity::isStreaming()

void com.ab.http.AbMultipartEntity.updateProgress | ( | int | count | ) |
| inline private

Update progress.

参数

  count | the count

void com.ab.http.AbMultipartEntity.writeTo | ( | final OutputStream | outstream | ) | throws IOException
| inline

描述：写入.

参数

  outstream | the outstream

异常

  IOException | Signals that an I/O exception has occurred.

参见
  org.apache.http.HttpEntity::writeTo(java.io.OutputStream)

## 类成员变量说明

final String com.ab.http.AbMultipartEntity.APPLICATION_OCTET_STREAM = "application/octet-stream"
| static private

流常量.

String com.ab.http.AbMultipartEntity.boundary
| private

二进制串.

byte [] com.ab.http.AbMultipartEntity.boundaryEnd
| private

二进制的结束.

byte [] com.ab.http.AbMultipartEntity.boundaryLine
| private

二进制的换行.

int com.ab.http.AbMultipartEntity.bytesWritten
| private

已经写的字节数.

final byte [] com.ab.http.AbMultipartEntity.CR_LF = ("\r\n").getBytes()
| static private

结束符.

List<FilePart> com.ab.http.AbMultipartEntity.fileParts = new ArrayList<FilePart>()
| private

文件域部分.

final char [] com.ab.http.AbMultipartEntity.MULTIPART_CHARS = "-_1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray()
| static private

字符.

ByteArrayOutputStream com.ab.http.AbMultipartEntity.out = new ByteArrayOutputStream()
| private

输出流.

AbHttpResponseListener com.ab.http.AbMultipartEntity.responseListener
| private

响应监听器.

int com.ab.http.AbMultipartEntity.totalSize
| private

总大小.

final byte [] com.ab.http.AbMultipartEntity.TRANSFER_ENCODING_BINARY
| static private

初始值:
= "Content-Transfer-Encoding: binary\r\n"
.getBytes()

编码转换二进制.

该类的文档由以下文件生成:

- src/com/ab/http/AbMultipartEntity.java