未验证 提交 d2f3d3ee 编写于 作者: O openharmony_ci 提交者: Gitee

!8786 Supplement the remaining interface data of types in util

Merge pull request !8786 from 王景悟/master
......@@ -323,6 +323,47 @@ decode(input: Uint8Array, options?: { stream?: false }): string
```
### decodeWithStream<sup>9+</sup>
decodeWithStream(input: Uint8Array, options?: { stream?: boolean }): string
通过输入参数解码后输出对应文本。
**系统能力:** SystemCapability.Utils.Lang
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| input | Uint8Array | 是 | 符合格式需要解码的数组。 |
| options | Object | 否 | 解码相关选项参数。 |
**表2** options
| 名称 | 参数类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| stream | boolean | 否 | 在随后的decodeWithStream()调用中是否跟随附加数据块。如果以块的形式处理数据,则设置为true;如果处理最后的数据块或数据未分块,则设置为false。默认为false。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| string | 解码后的数据。 |
**示例:**
```js
var textDecoder = new util.TextDecoder("utf-8",{ignoreBOM: true});
var result = new Uint8Array(6);
result[0] = 0xEF;
result[1] = 0xBB;
result[2] = 0xBF;
result[3] = 0x61;
result[4] = 0x62;
result[5] = 0x63;
console.log("input num:");
var retStr = textDecoder.decodeWithStream( result , {stream: false});
console.log("retStr = " + retStr);
```
## TextEncoder
### 属性
......@@ -2624,3 +2665,104 @@ isWeakSet(value: Object): boolean
var that = new util.types();
var result = that.isWeakSet(new WeakSet());
```
### isBigInt64Array<sup>8+</sup>
isBigInt64Array(value: Object): boolean
检查输入的value是否是BigInt64Array类型。
**系统能力:** SystemCapability.Utils.Lang
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| boolean | 判断的结果,如果是内置包含的BigInt64Array类型为true,反之为false。 |
**示例:**
```js
var that = new util.types();
var result = that.isBigInt64Array(new BigInt64Array([]));
```
### isBigUint64Array<sup>8+</sup>
isBigUint64Array(value: Object): boolean
检查输入的value是否是BigUint64Array类型。
**系统能力:** SystemCapability.Utils.Lang
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| boolean | 判断的结果,如果是内置包含的BigUint64Array类型为true,反之为false。 |
**示例:**
```js
var that = new util.types();
var result = that.isBigUint64Array(new BigUint64Array([]));
```
### isModuleNamespaceObject<sup>8+</sup>
isModuleNamespaceObject(value: Object): boolean
检查输入的value是否是Module Namespace Object类型。
**系统能力:** SystemCapability.Utils.Lang
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Module Namespace Object类型为true,反之为false。 |
**示例:**
```js
import url from '@ohos.url'
var that = new util.types();
var result = that.isModuleNamespaceObject(url);
```
### isSharedArrayBuffer<sup>8+</sup>
isSharedArrayBuffer(value: Object): boolean
检查输入的value是否是SharedArrayBuffer类型。
**系统能力:** SystemCapability.Utils.Lang
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| boolean | 判断的结果,如果是内置包含的SharedArrayBuffer类型为true,反之为false。 |
**示例:**
```js
var that = new util.types();
var result = that.isSharedArrayBuffer(new SharedArrayBuffer([]));
```
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册