# Class: Fields

## Fields()

#### new Fields()

扩展字段头

Source:
  - Fields.js, line 11

### Methods

#### (async, static) appendField(field) → {Promise}

追加字段

##### Parameters:

Name | Type | Description
--- | --- | ---
`field` |  | 字段对象

Source:
  - Fields.js, line 70

##### Returns:

大于0成功，否则失败

Type
  Promise

#### (async, static) calLengthOffset() → {Promise}

计算各字段的二进制长度,字段偏移

Source:
  - Fields.js, line 143

##### Returns:

长度偏移值

Type
  Promise

#### (async, static) calSize() → {Promise}

计算属性结构占用存储空间大小

Source:
  - Fields.js, line 156

##### Returns:

占用存储空间大小

Type
  Promise

#### (async, static) createObj() → {Promise.<Fields>}

构造一个新的 Fields 对象。

Source:
  - Fields.js, line 21

##### Returns:

Type
  Promise.<Fields>

#### (async, static) deleteFieldByIndex(index) → {Promise}

根据字段序号删除字段

##### Parameters:

Name | Type | Description
--- | --- | ---
`index` |  | 字段序号

Source:
  - Fields.js, line 117

##### Returns:

大于0成功，否则失败

Type
  Promise

#### (async, static) deleteFieldByName(fldName) → {Promise}

根据字段名删除字段

##### Parameters:

Name | Type | Description
--- | --- | ---
`fldName` |  | 字段名

Source:
  - Fields.js, line 103

##### Returns:

大于0成功，否则失败

Type
  Promise

#### (async, static) getField(index) → {Promise.<Field>}

根据索引取字段

##### Parameters:

Name | Type | Description
--- | --- | ---
`index` |  | 索引

Source:
  - Fields.js, line 38

##### Returns:

字段对象

Type
  Promise.<Field>

#### (async, static) getFieldCount() → {Promise}

取字段数目

Source:
  - Fields.js, line 130

##### Returns:

字段数目

Type
  Promise

#### (async, static) insertField(position, field) → {Promise}

插入字段

##### Parameters:

Name | Type | Description
--- | --- | ---
`position` |  | 位置
`field` |  | 字段对象

Source:
  - Fields.js, line 85

##### Returns:

大于0成功，否则失败

Type
  Promise

#### (async, static) setField(index, field) → {Promise.<void>}

设置索引处的字段

##### Parameters:

Name | Type | Description
--- | --- | ---
`index` |  | 索引
`field` |  | 字段对象

Source:
  - Fields.js, line 56

##### Returns:

大于0成功，否则失败

Type
  Promise.<void>