提交 7eafa641 编写于 作者: W wusongqing

update docs against 5768

Signed-off-by: Nwusongqing <wusongqing@huawei.com>
上级 d35878b6
# URL String Parsing # URL String Parsing
> **NOTE**<br> > **NOTE**
>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...@@ -25,16 +26,16 @@ Creates a **URLSearchParams** instance. ...@@ -25,16 +26,16 @@ Creates a **URLSearchParams** instance.
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| init | string[][]&nbsp;\|&nbsp;Record&lt;string,&nbsp;string&gt;&nbsp;\|&nbsp;string&nbsp;\|&nbsp;URLSearchParams | No| Input parameter objects, which include the following:<br>- **string[][]**: two-dimensional string array<br>-&nbsp;**Record&lt;string,&nbsp;string&gt;**: list of objects<br>- **string**: string<br>- **URLSearchParams**: object | | init | string[][] \| Record&lt;string, string&gt; \| string \| URLSearchParams | No| Input parameter objects, which include the following:<br>- **string[][]**: two-dimensional string array<br>- **Record&lt;string, string&gt;**: list of objects<br>- **string**: string<br>- **URLSearchParams**: object |
**Example** **Example**
```js ```js
var objectParams = new URLSearchParams([ ['user1', 'abc1'], ['query2', 'first2'], ['query3', 'second3'] ]); var objectParams = new Url.URLSearchParams([ ['user1', 'abc1'], ['query2', 'first2'], ['query3', 'second3'] ]);
var objectParams1 = new URLSearchParams({"fod" : 1 , "bard" : 2}); var objectParams1 = new Url.URLSearchParams({"fod" : 1 , "bard" : 2});
var objectParams2 = new URLSearchParams('?fod=1&bard=2'); var objectParams2 = new Url.URLSearchParams('?fod=1&bard=2');
var urlObject = new URL('https://developer.mozilla.org/?fod=1&bard=2'); var urlObject = new Url.URL('https://developer.mozilla.org/?fod=1&bard=2');
var params = new URLSearchParams(urlObject.search); var params = new Url.URLSearchParams(urlObject.search);
``` ```
...@@ -48,16 +49,16 @@ Appends a key-value pair into the query string. ...@@ -48,16 +49,16 @@ Appends a key-value pair into the query string.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| name | string | Yes | Key of the key-value pair to append. | | name | string | Yes | Key of the key-value pair to append. |
| value | string | Yes | Value of the key-value pair to append. | | value | string | Yes | Value of the key-value pair to append. |
**Example** **Example**
```js ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new URLSearchParams(urlObject.search.slice(1)); let paramsObject = new Url.URLSearchParams(urlObject.search.slice(1));
paramsObject.append('fod', 3); paramsObject.append('fod', 3);
``` ```
...@@ -72,15 +73,15 @@ Deletes key-value pairs of the specified key. ...@@ -72,15 +73,15 @@ Deletes key-value pairs of the specified key.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| name | string | Yes | Key of the key-value pairs to delete. | | name | string | Yes | Key of the key-value pairs to delete. |
**Example** **Example**
```js ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsobject = new URLSearchParams(urlObject.search.slice(1)); let paramsobject = new Url.URLSearchParams(urlObject.search.slice(1));
paramsobject.delete('fod'); paramsobject.delete('fod');
``` ```
...@@ -95,21 +96,21 @@ Obtains all the key-value pairs based on the specified key. ...@@ -95,21 +96,21 @@ Obtains all the key-value pairs based on the specified key.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| name | string | Yes | Key specified to obtain all key-value pairs. | | name | string | Yes | Key specified to obtain all key-value pairs. |
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------- | -------- | | -------- | -------- |
| string[] | All key-value pairs matching the specified key. | | string[] | All key-value pairs matching the specified key. |
**Example** **Example**
```js ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new URLSearchParams(urlObject.search.slice(1)); let paramsObject = new Url.URLSearchParams(urlObject.search.slice(1));
paramsObject.append('fod', 3); // Add a second value for the fod parameter. paramsObject.append('fod', 3); // Add a second value for the fod parameter.
console.log(params.getAll('fod')) // Output ["1","3"]. console.log(params.getAll('fod')) // Output ["1","3"].
``` ```
...@@ -125,14 +126,14 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th ...@@ -125,14 +126,14 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------- | -------- | | -------- | -------- |
| IterableIterator&lt;[string,&nbsp;string]&gt; | ES6 iterator. | | IterableIterator&lt;[string, string]&gt; | ES6 iterator. |
**Example** **Example**
```js ```js
var searchParamsObject = new URLSearchParams("keyName1=valueName1&keyName2=valueName2"); var searchParamsObject = new Url.URLSearchParams("keyName1=valueName1&keyName2=valueName2");
for (var pair of searchParamsObject .entries()) { // Show keyName/valueName pairs for (var pair of searchParamsObject .entries()) { // Show keyName/valueName pairs
console.log(pair[0]+ ', '+ pair[1]); console.log(pair[0]+ ', '+ pair[1]);
} }
...@@ -149,23 +150,23 @@ Traverses the key-value pairs in the **URLSearchParams** instance by using a cal ...@@ -149,23 +150,23 @@ Traverses the key-value pairs in the **URLSearchParams** instance by using a cal
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callbackfn | function | Yes | Callback invoked to traverse the key-value pairs in the **URLSearchParams** instance. | | callbackfn | function | Yes | Callback invoked to traverse the key-value pairs in the **URLSearchParams** instance. |
| thisArg | Object | No | Value to use when the callback is invoked. | | thisArg | Object | No | Value to use when the callback is invoked. |
**Table 1** callbackfn parameter description **Table 1** callbackfn parameter description
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | string | Yes | Value that is currently traversed. | | value | string | Yes | Value that is currently traversed. |
| key | string | Yes | Key that is currently traversed. | | key | string | Yes | Key that is currently traversed. |
| searchParams | Object | Yes | Instance that invokes the **forEach** method. | | searchParams | Object | Yes | Instance that invokes the **forEach** method. |
**Example** **Example**
```js ```js
const myURLObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); const myURLObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2');
myURLObject.searchParams.forEach((value, name, searchParams) => { myURLObject.searchParams.forEach((value, name, searchParams) => {
console.log(name, value, myURLObject.searchParams === searchParams); console.log(name, value, myURLObject.searchParams === searchParams);
}); });
...@@ -182,21 +183,21 @@ Obtains the value of the first key-value pair based on the specified key. ...@@ -182,21 +183,21 @@ Obtains the value of the first key-value pair based on the specified key.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| name | string | Yes | Key specified to obtain the value. | | name | string | Yes | Key specified to obtain the value. |
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------- | -------- | | -------- | -------- |
| string | Returns the value of the first key-value pair if obtained. | | string | Returns the value of the first key-value pair if obtained. |
| null | Returns null if no value is obtained. | | null | Returns null if no value is obtained. |
**Example** **Example**
```js ```js
var paramsOject = new URLSearchParams(document.location.search.substring(1)); var paramsOject = new Url.URLSearchParams(document.location.search.substring(1));
var name = paramsOject.get("name"); // is the string "Jonathan" var name = paramsOject.get("name"); // is the string "Jonathan"
var age = parseInt(paramsOject.get("age"), 10); // is the number 18 var age = parseInt(paramsOject.get("age"), 10); // is the number 18
var address = paramsOject.get("address"); // null var address = paramsOject.get("address"); // null
...@@ -213,21 +214,21 @@ Checks whether a key has a value. ...@@ -213,21 +214,21 @@ Checks whether a key has a value.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| name | string | Yes | Key specified to search for its value. | | name | string | Yes | Key specified to search for its value. |
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the value exists; returns **false** otherwise. | | boolean | Returns **true** if the value exists; returns **false** otherwise. |
**Example** **Example**
```js ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new URLSearchParams(urlObject.search.slice(1)); let paramsObject = new Url.URLSearchParams(urlObject.search.slice(1));
paramsObject.has('bard') === true; paramsObject.has('bard') === true;
``` ```
...@@ -242,16 +243,16 @@ Sets the value for a key. If key-value pairs matching the specified key exist, t ...@@ -242,16 +243,16 @@ Sets the value for a key. If key-value pairs matching the specified key exist, t
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| name | string | Yes | Key of the value to set. | | name | string | Yes | Key of the value to set. |
| value | string | Yes | Value to set. | | value | string | Yes | Value to set. |
**Example** **Example**
```js ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new URLSearchParams(urlObject.search.slice(1)); let paramsObject = new Url.URLSearchParams(urlObject.search.slice(1));
paramsObject.set('baz', 3); // Add a third parameter. paramsObject.set('baz', 3); // Add a third parameter.
``` ```
...@@ -267,7 +268,7 @@ Sorts all key-value pairs contained in this object based on the Unicode code poi ...@@ -267,7 +268,7 @@ Sorts all key-value pairs contained in this object based on the Unicode code poi
**Example** **Example**
```js ```js
var searchParamsObject = new URLSearchParams("c=3&a=9&b=4&d=2"); // Create a test URLSearchParams object var searchParamsObject = new Url.URLSearchParams("c=3&a=9&b=4&d=2"); // Create a test URLSearchParams object
searchParamsObject.sort(); // Sort the key/value pairs searchParamsObject.sort(); // Sort the key/value pairs
console.log(searchParamsObject.toString()); // Display the sorted query string // Output a=9&b=2&c=3&d=4 console.log(searchParamsObject.toString()); // Display the sorted query string // Output a=9&b=2&c=3&d=4
``` ```
...@@ -283,14 +284,14 @@ Obtains an ES6 iterator that contains the keys of all the key-value pairs. ...@@ -283,14 +284,14 @@ Obtains an ES6 iterator that contains the keys of all the key-value pairs.
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------- | -------- | | -------- | -------- |
| IterableIterator&lt;string&gt; | ES6 iterator that contains the keys of all the key-value pairs. | | IterableIterator&lt;string&gt; | ES6 iterator that contains the keys of all the key-value pairs. |
**Example** **Example**
```js ```js
var searchParamsObject = new URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing var searchParamsObject = new Url.URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing
for (var key of searchParamsObject .keys()) { // Output key-value pairs for (var key of searchParamsObject .keys()) { // Output key-value pairs
console.log(key); console.log(key);
} }
...@@ -307,14 +308,14 @@ Obtains an ES6 iterator that contains the values of all the key-value pairs. ...@@ -307,14 +308,14 @@ Obtains an ES6 iterator that contains the values of all the key-value pairs.
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------- | -------- | | -------- | -------- |
| IterableIterator&lt;string&gt; | ES6 iterator that contains the values of all the key-value pairs. | | IterableIterator&lt;string&gt; | ES6 iterator that contains the values of all the key-value pairs. |
**Example** **Example**
```js ```js
var searchParams = new URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing var searchParams = new Url.URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing
for (var value of searchParams.values()) { for (var value of searchParams.values()) {
console.log(value); console.log(value);
} }
...@@ -331,14 +332,14 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th ...@@ -331,14 +332,14 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------- | -------- | | -------- | -------- |
| IterableIterator&lt;[string,&nbsp;string]&gt; | ES6 iterator. | | IterableIterator&lt;[string, string]&gt; | ES6 iterator. |
**Example** **Example**
```js ```js
const paramsObject = new URLSearchParams('fod=bay&edg=bap'); const paramsObject = new Url.URLSearchParams('fod=bay&edg=bap');
for (const [name, value] of paramsObject) { for (const [name, value] of paramsObject) {
console.log(name, value); console.log(name, value);
} }
...@@ -355,15 +356,15 @@ Obtains search parameters that are serialized as a string and, if necessary, per ...@@ -355,15 +356,15 @@ Obtains search parameters that are serialized as a string and, if necessary, per
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------- | -------- | | -------- | -------- |
| string | String of serialized search parameters, which is percent-encoded if necessary. | | string | String of serialized search parameters, which is percent-encoded if necessary. |
**Example** **Example**
```js ```js
let url = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let url = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2');
let params = new URLSearchParams(url.search.slice(1)); let params = new Url.URLSearchParams(url.search.slice(1));
params.append('fod', 3); params.append('fod', 3);
console.log(params.toString()); console.log(params.toString());
``` ```
...@@ -401,26 +402,26 @@ Creates a URL. ...@@ -401,26 +402,26 @@ Creates a URL.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| url | string | Yes | Input object. | | url | string | Yes | Input object. |
| base | string&nbsp;\ |&nbsp;URL | No | Input parameter, which can be any of the following:<br>- **string**: string<br>- **URL**: string or object | | base | string \ |& URL | No | Input parameter, which can be any of the following:<br>- **string**: string<br>- **URL**: string or object |
**Example** **Example**
```js ```js
var mm = 'http://username:password@host:8080'; var mm = 'http://username:password@host:8080';
var a = new URL("/", mm); // Output 'http://username:password@host:8080/'; var a = new Url.URL("/", mm); // Output 'http://username:password@host:8080/';
var b = new URL(mm); // Output 'http://username:password@host:8080/'; var b = new Url.URL(mm); // Output 'http://username:password@host:8080/';
new URL('path/path1', b); // Output 'http://username:password@host:8080/path/path1'; new Url.URL('path/path1', b); // Output 'http://username:password@host:8080/path/path1';
var c = new URL('/path/path1', b); // Output 'http://username:password@host:8080/path/path1'; var c = new Url.URL('/path/path1', b); // Output 'http://username:password@host:8080/path/path1';
new URL('/path/path1', c); // Output 'http://username:password@host:8080/path/path1'; new Url.URL('/path/path1', c); // Output 'http://username:password@host:8080/path/path1';
new URL('/path/path1', a); // Output 'http://username:password@host:8080/path/path1'; new Url.URL('/path/path1', a); // Output 'http://username:password@host:8080/path/path1';
new URL('/path/path1', "https://www.exampleUrl/fr-FR/toto"); // Output https://www.exampleUrl/path/path1 new Url.URL('/path/path1', "https://www.exampleUrl/fr-FR/toto"); // Output https://www.exampleUrl/path/path1
new URL('/path/path1', ''); // Raises a TypeError exception as '' is not a valid URL new Url.URL('/path/path1', ''); // Raises a TypeError exception as '' is not a valid URL
new URL('/path/path1'); // Raises a TypeError exception as '/path/path1' is not a valid URL new Url.URL('/path/path1'); // Raises a TypeError exception as '/path/path1' is not a valid URL
new URL('http://www.shanxi.com', ); // Output http://www.shanxi.com/ new Url.URL('http://www.shanxi.com', ); // Output http://www.shanxi.com/
new URL('http://www.shanxi.com', b); // Output http://www.shanxi.com/ new Url.URL('http://www.shanxi.com', b); // Output http://www.shanxi.com/
``` ```
...@@ -434,14 +435,14 @@ Converts the parsed URL into a string. ...@@ -434,14 +435,14 @@ Converts the parsed URL into a string.
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------- | -------- | | -------- | -------- |
| string | Website address in a serialized string. | | string | Website address in a serialized string. |
**Example** **Example**
```js ```js
const url = new URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const url = new Url.URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da');
url.toString() url.toString()
``` ```
...@@ -456,12 +457,12 @@ Converts the parsed URL into a JSON string. ...@@ -456,12 +457,12 @@ Converts the parsed URL into a JSON string.
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------- | -------- | | -------- | -------- |
| string | Website address in a serialized string. | | string | Website address in a serialized string. |
**Example** **Example**
```js ```js
const url = new URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const url = new Url.URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da');
url.toJSON() url.toJSON()
``` ```
\ No newline at end of file
# util # util
> **NOTE**<br> > **NOTE**
>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
This module provides common utility functions, such as **TextEncoder** and **TextDecoder** for string encoding and decoding, **RationalNumber** for rational number operations, **LruBuffer** for buffer management, **Scope** for range determination, **Base64** for Base64 encoding and decoding, and **types** for checks of built-in object types. This module provides common utility functions, such as **TextEncoder** and **TextDecoder** for string encoding and decoding, **RationalNumber** for rational number operations, **LruBuffer** for buffer management, **Scope** for range determination, **Base64** for Base64 encoding and decoding, and **Types** for checks of built-in object types.
## Modules to Import ## Modules to Import
...@@ -23,15 +24,15 @@ Prints the input content in a formatted string. ...@@ -23,15 +24,15 @@ Prints the input content in a formatted string.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| format | string | Yes | Format of the string to print. | | format | string | Yes| Format of the string to print.|
| ...args | Object[] | No | Data to format. | | ...args | Object[] | No| Data to format.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| string | String in the specified format. | | string | String in the specified format.|
**Example** **Example**
```js ```js
...@@ -49,14 +50,14 @@ Obtains detailed information about a system error code. ...@@ -49,14 +50,14 @@ Obtains detailed information about a system error code.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| errno | number | Yes | Error code generated. | | errno | number | Yes| Error code generated.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| string | Detailed information about the error code. | | string | Detailed information about the error code.|
**Example** **Example**
```js ```js
...@@ -76,14 +77,14 @@ Calls back an asynchronous function. In the callback, the first parameter indica ...@@ -76,14 +77,14 @@ Calls back an asynchronous function. In the callback, the first parameter indica
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| original | Function | Yes | Asynchronous function. | | original | Function | Yes| Asynchronous function.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| Function | Callback, in which the first parameter indicates the cause of the rejection (the value is **null** if the promise has been resolved) and the second parameter indicates the resolved value. | | Function | Callback, in which the first parameter indicates the cause of the rejection (the value is **null** if the promise has been resolved) and the second parameter indicates the resolved value.|
**Example** **Example**
```js ```js
...@@ -107,14 +108,14 @@ Processes an asynchronous function and returns a promise version. ...@@ -107,14 +108,14 @@ Processes an asynchronous function and returns a promise version.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| original | Function | Yes | Asynchronous function. | | original | Function | Yes| Asynchronous function.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| Function | Function in the error-first style (that is, **(err, value) =>...** is called as the last parameter) and the promise version. | | Function | Function in the error-first style (that is, **(err, value) =>...** is called as the last parameter) and the promise version.|
**Example** **Example**
```js ```js
...@@ -138,11 +139,11 @@ Processes an asynchronous function and returns a promise version. ...@@ -138,11 +139,11 @@ Processes an asynchronous function and returns a promise version.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
| Name | Type | Readable | Writable | Description | | Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| encoding | string | Yes | No | Encoding format.<br>-&nbsp;Supported formats: utf-8, ibm866, iso-8859-2, iso-8859-3, iso-8859-4, iso-8859-5, iso-8859-6, iso-8859-7, iso-8859-8, iso-8859-8-i, iso-8859-10, iso-8859-13, iso-8859-14, iso-8859-15, koi8-r, koi8-u, macintosh, windows-874, windows-1250, windows-1251, windows-1252, windows-1253, windows-1254, windows-1255, windows-1256, windows-1257, windows-1258, x-mac-cyrilli, gbk, gb18030, big5, euc-jp, iso-2022-jp, shift_jis, euc-kr, utf-16be, utf-16le | | encoding | string | Yes| No| Encoding format.<br>- Supported formats: utf-8, ibm866, iso-8859-2, iso-8859-3, iso-8859-4, iso-8859-5, iso-8859-6, iso-8859-7, iso-8859-8, iso-8859-8-i, iso-8859-10, iso-8859-13, iso-8859-14, iso-8859-15, koi8-r, koi8-u, macintosh, windows-874, windows-1250, windows-1251, windows-1252, windows-1253, windows-1254, windows-1255, windows-1256, windows-1257, windows-1258, x-mac-cyrilli, gbk, gb18030, big5, euc-jp, iso-2022-jp, shift_jis, euc-kr, utf-16be, utf-16le|
| fatal | boolean | Yes | No | Whether to display fatal errors. | | fatal | boolean | Yes| No| Whether to display fatal errors.|
| ignoreBOM | boolean | Yes | No | Whether to ignore the byte order marker (BOM). The default value is **false**, which indicates that the result contains the BOM. | | ignoreBOM | boolean | Yes| No| Whether to ignore the byte order marker (BOM). The default value is **false**, which indicates that the result contains the BOM.|
### constructor ### constructor
...@@ -154,17 +155,17 @@ A constructor used to create a **TextDecoder** object. ...@@ -154,17 +155,17 @@ A constructor used to create a **TextDecoder** object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| encoding | string | No | Encoding format. | | encoding | string | No| Encoding format.|
| options | Object | No | Encoding-related options, which include **fatal** and **ignoreBOM**. | | options | Object | No| Encoding-related options, which include **fatal** and **ignoreBOM**.|
**Table 1** options **Table 1** options
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| fatal | boolean | No | Whether to display fatal errors. | | fatal | boolean | No| Whether to display fatal errors.|
| ignoreBOM | boolean | No | Whether to ignore the BOM. | | ignoreBOM | boolean | No| Whether to ignore the BOM.|
**Example** **Example**
```js ```js
...@@ -181,21 +182,21 @@ Decodes the input content. ...@@ -181,21 +182,21 @@ Decodes the input content.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| input | Unit8Array | Yes | Uint8Array to decode. | | input | Unit8Array | Yes| Uint8Array to decode.|
| options | Object | No | Options related to decoding. | | options | Object | No| Options related to decoding.|
**Table 2** options **Table 2** options
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| stream | boolean | No | Whether to allow data blocks in subsequent **decode()**. If data is processed in blocks, set this parameter to **true**. If this is the last data block to process or data is not divided into blocks, set this parameter to **false**. The default value is **false**. | | stream | boolean | No| Whether to allow data blocks in subsequent **decode()**. If data is processed in blocks, set this parameter to **true**. If this is the last data block to process or data is not divided into blocks, set this parameter to **false**. The default value is **false**.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| string | Data decoded. | | string | Data decoded.|
**Example** **Example**
```js ```js
...@@ -208,9 +209,6 @@ Decodes the input content. ...@@ -208,9 +209,6 @@ Decodes the input content.
result[4] = 0x62; result[4] = 0x62;
result[5] = 0x63; result[5] = 0x63;
console.log("input num:"); console.log("input num:");
for(var j= 0; j < 6; j++) {
console.log(result[j]);
}
var retStr = textDecoder.decode( result , {stream: false}); var retStr = textDecoder.decode( result , {stream: false});
console.log("retStr = " + retStr); console.log("retStr = " + retStr);
``` ```
...@@ -222,9 +220,9 @@ Decodes the input content. ...@@ -222,9 +220,9 @@ Decodes the input content.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
| Name | Type | Readable | Writable | Description | | Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| encoding | string | Yes | No | Encoding format. The default format is **utf-8**. | | encoding | string | Yes| No| Encoding format. The default format is **utf-8**.|
### constructor ### constructor
...@@ -250,18 +248,19 @@ Encodes the input content. ...@@ -250,18 +248,19 @@ Encodes the input content.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| input | string | Yes | String to encode. | | input | string | Yes| String to encode.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| Uint8Array | Encoded text. | | Uint8Array | Encoded text.|
**Example** **Example**
```js ```js
var textEncoder = new util.TextEncoder(); var textEncoder = new util.TextEncoder();
var buffer = new ArrayBuffer(20);
var result = new Uint8Array(buffer); var result = new Uint8Array(buffer);
result = textEncoder.encode("\uD800¥¥"); result = textEncoder.encode("\uD800¥¥");
``` ```
...@@ -276,15 +275,15 @@ Stores the UTF-8 encoded text. ...@@ -276,15 +275,15 @@ Stores the UTF-8 encoded text.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| input | string | Yes | String to encode. | | input | string | Yes| String to encode.|
| dest | Uint8Array | Yes | **Uint8Array** instance used to store the UTF-8 encoded text. | | dest | Uint8Array | Yes| **Uint8Array** instance used to store the UTF-8 encoded text.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| Uint8Array | Encoded text. | | Uint8Array | Encoded text.|
**Example** **Example**
```js ```js
...@@ -306,10 +305,10 @@ A constructor used to create a **RationalNumber** object. ...@@ -306,10 +305,10 @@ A constructor used to create a **RationalNumber** object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| numerator | number | Yes | Numerator, which is an integer. | | numerator | number | Yes| Numerator, which is an integer.|
| denominator | number | Yes | Denominator, which is an integer. | | denominator | number | Yes| Denominator, which is an integer.|
**Example** **Example**
```js ```js
...@@ -326,14 +325,14 @@ Creates a **RationalNumber** object based on the given string. ...@@ -326,14 +325,14 @@ Creates a **RationalNumber** object based on the given string.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| rationalString | string | Yes | String used to create the **RationalNumber** object. | | rationalString | string | Yes| String used to create the **RationalNumber** object.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| object | **RationalNumber** object created. | | object | **RationalNumber** object created.|
**Example** **Example**
```js ```js
...@@ -351,17 +350,16 @@ Compares this **RationalNumber** object with a given object. ...@@ -351,17 +350,16 @@ Compares this **RationalNumber** object with a given object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| another | RationalNumber | Yes | Object used to compare with this **RationalNumber** object. | | another | RationalNumber | Yes| Object used to compare with this **RationalNumber** object.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Returns **0** if the two objects are equal; returns **1** if the given object is less than this object; return **-1** if the given object is greater than this object. | | number | Returns **0** if the two objects are equal; returns **1** if the given object is less than this object; return **-1** if the given object is greater than this object.|
**Example** **Example**
```js ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var rational = rationalNumer.creatRationalFromString("3/4"); var rational = rationalNumer.creatRationalFromString("3/4");
...@@ -378,9 +376,9 @@ Obtains the value of this **RationalNumber** object as an integer or a floating- ...@@ -378,9 +376,9 @@ Obtains the value of this **RationalNumber** object as an integer or a floating-
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | An integer or a floating-point number. | | number | An integer or a floating-point number.|
**Example** **Example**
```js ```js
...@@ -398,14 +396,14 @@ Checks whether this **RationalNumber** object equals the given object. ...@@ -398,14 +396,14 @@ Checks whether this **RationalNumber** object equals the given object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| object | Object | Yes | Object used to compare with this **RationalNumber** object. | | object | Object | Yes| Object used to compare with this **RationalNumber** object.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the two objects are equal; returns **false** otherwise. | | boolean | Returns **true** if the two objects are equal; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -424,15 +422,15 @@ Obtains the greatest common divisor of two specified integers. ...@@ -424,15 +422,15 @@ Obtains the greatest common divisor of two specified integers.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| number1 | number | Yes | The first integer used to get the greatest common divisor. | | number1 | number | Yes| The first integer used to get the greatest common divisor.|
| number2 | number | Yes | The second integer used to get the greatest common divisor. | | number2 | number | Yes| The second integer used to get the greatest common divisor.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Greatest common divisor obtained. | | number | Greatest common divisor obtained.|
**Example** **Example**
```js ```js
...@@ -451,9 +449,9 @@ Obtains the numerator of this **RationalNumber** object. ...@@ -451,9 +449,9 @@ Obtains the numerator of this **RationalNumber** object.
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Numerator of this **RationalNumber** object. | | number | Numerator of this **RationalNumber** object.|
**Example** **Example**
```js ```js
...@@ -471,9 +469,9 @@ Obtains the denominator of this **RationalNumber** object. ...@@ -471,9 +469,9 @@ Obtains the denominator of this **RationalNumber** object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Denominator of this **RationalNumber** object. | | number | Denominator of this **RationalNumber** object.|
**Example** **Example**
```js ```js
...@@ -484,16 +482,16 @@ Obtains the denominator of this **RationalNumber** object. ...@@ -484,16 +482,16 @@ Obtains the denominator of this **RationalNumber** object.
### isZero<sup>8+</sup> ### isZero<sup>8+</sup>
isZero​(): boolean isZero​():boolean
Checks whether this **RationalNumber** object is **0**. Checks whether this **RationalNumber** object is **0**.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the value of this **RationalNumber** object is **0**; returns **false** otherwise. | | boolean | Returns **true** if the value of this **RationalNumber** object is **0**; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -511,9 +509,9 @@ Checks whether this **RationalNumber** object is a Not a Number (NaN). ...@@ -511,9 +509,9 @@ Checks whether this **RationalNumber** object is a Not a Number (NaN).
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if this **RationalNumber** object is a NaN (the denominator and numerator are both **0**); returns **false** otherwise. | | boolean | Returns **true** if this **RationalNumber** object is a NaN (the denominator and numerator are both **0**); returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -524,16 +522,16 @@ Checks whether this **RationalNumber** object is a Not a Number (NaN). ...@@ -524,16 +522,16 @@ Checks whether this **RationalNumber** object is a Not a Number (NaN).
### isFinite<sup>8+</sup> ### isFinite<sup>8+</sup>
isFinite​(): boolean isFinite​():boolean
Checks whether this **RationalNumber** object represents a finite value. Checks whether this **RationalNumber** object represents a finite value.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if this **RationalNumber** object represents a finite value (the denominator is not **0**); returns **false** otherwise. | | boolean | Returns **true** if this **RationalNumber** object represents a finite value (the denominator is not **0**); returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -551,9 +549,9 @@ Obtains the string representation of this **RationalNumber** object. ...@@ -551,9 +549,9 @@ Obtains the string representation of this **RationalNumber** object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| string | Returns **NaN** if the numerator and denominator of this object are both **0**; returns a string in Numerator/Denominator format otherwise, for example, **3/5**. | | string | Returns **NaN** if the numerator and denominator of this object are both **0**; returns a string in Numerator/Denominator format otherwise, for example, **3/5**.|
**Example** **Example**
```js ```js
...@@ -567,9 +565,9 @@ Obtains the string representation of this **RationalNumber** object. ...@@ -567,9 +565,9 @@ Obtains the string representation of this **RationalNumber** object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
| Name | Type | Readable | Writable | Description | | Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| length | number | Yes | No | Total number of values in this buffer. | | length | number | Yes| No| Total number of values in this buffer.|
**Example** **Example**
```js ```js
...@@ -589,9 +587,9 @@ A constructor used to create an **LruBuffer** instance. The default capacity of ...@@ -589,9 +587,9 @@ A constructor used to create an **LruBuffer** instance. The default capacity of
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| capacity | number | No | Capacity of the **LruBuffer** to create. | | capacity | number | No| Capacity of the **LruBuffer** to create.|
**Example** **Example**
```js ```js
...@@ -608,9 +606,9 @@ Changes the **LruBuffer** capacity. If the new capacity is less than or equal to ...@@ -608,9 +606,9 @@ Changes the **LruBuffer** capacity. If the new capacity is less than or equal to
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| newCapacity | number | Yes | New capacity of the **LruBuffer**. | | newCapacity | number | Yes| New capacity of the **LruBuffer**.|
**Example** **Example**
```js ```js
...@@ -628,9 +626,9 @@ Obtains the string representation of this **LruBuffer** object. ...@@ -628,9 +626,9 @@ Obtains the string representation of this **LruBuffer** object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| string | String representation of this **LruBuffer** object. | | string | String representation of this **LruBuffer** object.|
**Example** **Example**
```js ```js
...@@ -651,9 +649,9 @@ Obtains the capacity of this buffer. ...@@ -651,9 +649,9 @@ Obtains the capacity of this buffer.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Capacity of this buffer. | | number | Capacity of this buffer.|
**Example** **Example**
```js ```js
...@@ -688,9 +686,9 @@ Obtains the number of return values for **createDefault()**. ...@@ -688,9 +686,9 @@ Obtains the number of return values for **createDefault()**.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Number of return values for **createDefault()**. | | number | Number of return values for **createDefault()**.|
**Example** **Example**
```js ```js
...@@ -709,9 +707,9 @@ Obtains the number of times that the queried values are mismatched. ...@@ -709,9 +707,9 @@ Obtains the number of times that the queried values are mismatched.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Number of times that the queried values are mismatched. | | number | Number of times that the queried values are mismatched.|
**Example** **Example**
```js ```js
...@@ -731,9 +729,9 @@ Obtains the number of removals from this buffer. ...@@ -731,9 +729,9 @@ Obtains the number of removals from this buffer.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Number of removals from the buffer. | | number | Number of removals from the buffer.|
**Example** **Example**
```js ```js
...@@ -754,9 +752,9 @@ Obtains the number of times that the queried values are matched. ...@@ -754,9 +752,9 @@ Obtains the number of times that the queried values are matched.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Number of times that the queried values are matched. | | number | Number of times that the queried values are matched.|
**Example** **Example**
```js ```js
...@@ -776,9 +774,9 @@ Obtains the number of additions to this buffer. ...@@ -776,9 +774,9 @@ Obtains the number of additions to this buffer.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Number of additions to the buffer. | | number | Number of additions to the buffer.|
**Example** **Example**
```js ```js
...@@ -797,9 +795,9 @@ Checks whether this buffer is empty. ...@@ -797,9 +795,9 @@ Checks whether this buffer is empty.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the buffer does not contain any value. | | boolean | Returns **true** if the buffer does not contain any value.|
**Example** **Example**
```js ```js
...@@ -811,21 +809,21 @@ Checks whether this buffer is empty. ...@@ -811,21 +809,21 @@ Checks whether this buffer is empty.
### get<sup>8+</sup> ### get<sup>8+</sup>
get(key: K): V | undefined get(key: K): V | undefined
Obtains the value of the specified key. Obtains the value of the specified key.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| key | K | Yes | Key based on which the value is queried. | | key | K | Yes| Key based on which the value is queried.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| V&nbsp;\ |&nbsp;undefind | Returns the value of the key if a match is found in the buffer; returns **undefined** otherwise. | | V \| undefind | Returns the value of the key if a match is found in the buffer; returns **undefined** otherwise.|
**Example** **Example**
```js ```js
...@@ -844,15 +842,15 @@ Adds a key-value pair to this buffer. ...@@ -844,15 +842,15 @@ Adds a key-value pair to this buffer.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| key | K | Yes | Key of the key-value pair to add. | | key | K | Yes| Key of the key-value pair to add.|
| value | V | Yes | Value of the key-value pair to add. | | value | V | Yes| Value of the key-value pair to add.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| V | Returns the existing value if the key already exists; returns the value added otherwise. If the key or value is null, an exception will be thrown. | | V | Returns the existing value if the key already exists; returns the value added otherwise. If the key or value is null, an exception will be thrown. |
**Example** **Example**
```js ```js
...@@ -870,9 +868,9 @@ Obtains all values in this buffer, listed from the most to the least recently ac ...@@ -870,9 +868,9 @@ Obtains all values in this buffer, listed from the most to the least recently ac
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| V&nbsp;[] | All values in the buffer, listed from the most to the least recently accessed. | | V [] | All values in the buffer, listed from the most to the least recently accessed.|
**Example** **Example**
```js ```js
...@@ -893,9 +891,9 @@ Obtains all keys in this buffer, listed from the most to the least recently acce ...@@ -893,9 +891,9 @@ Obtains all keys in this buffer, listed from the most to the least recently acce
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| K&nbsp;[] | All keys in the buffer, listed from the most to the least recently accessed. | | K [] | All keys in the buffer, listed from the most to the least recently accessed.|
**Example** **Example**
```js ```js
...@@ -907,21 +905,21 @@ Obtains all keys in this buffer, listed from the most to the least recently acce ...@@ -907,21 +905,21 @@ Obtains all keys in this buffer, listed from the most to the least recently acce
### remove<sup>8+</sup> ### remove<sup>8+</sup>
remove(key: K): V | undefined remove(key: K): V | undefined
Removes the specified key and its value from this buffer. Removes the specified key and its value from this buffer.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| key | K | Yes | Key to remove. | | key | K | Yes| Key to remove.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| V&nbsp;\ |&nbsp;undefind | Returns an **Optional** object containing the removed key-value pair if the key exists in the buffer; returns an empty **Optional** object otherwise. If the key is null, an exception will be thrown. | | V \| undefind | Returns an **Optional** object containing the removed key-value pair if the key exists in the buffer; returns an empty **Optional** object otherwise. If the key is null, an exception will be thrown.|
**Example** **Example**
```js ```js
...@@ -940,12 +938,12 @@ Performs subsequent operations after a value is removed. ...@@ -940,12 +938,12 @@ Performs subsequent operations after a value is removed.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| isEvict | boolean | No | Whether the buffer capacity is insufficient. If the value is **true**, this method is called due to insufficient capacity. | | isEvict | boolean | No| Whether the buffer capacity is insufficient. If the value is **true**, this method is called due to insufficient capacity.|
| key | K | Yes | Key removed. | | key | K | Yes| Key removed.|
| value | V | Yes | Value removed. | | value | V | Yes| Value removed.|
| newValue | V | No | New value for the key if the **put()** method is called and the key to be added already exists. In other cases, this parameter is left blank. | | newValue | V | No| New value for the key if the **put()** method is called and the key to be added already exists. In other cases, this parameter is left blank.|
**Example** **Example**
```js ```js
...@@ -985,14 +983,14 @@ Checks whether this buffer contains the specified key. ...@@ -985,14 +983,14 @@ Checks whether this buffer contains the specified key.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| key | K | Yes | Key to check. | | key | K | Yes| Key to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the buffer contains the specified key; returns **false** otherwise. | | boolean | Returns **true** if the buffer contains the specified key; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -1011,14 +1009,14 @@ Creates a value if the value of the specified key is not available. ...@@ -1011,14 +1009,14 @@ Creates a value if the value of the specified key is not available.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| key | K | Yes | Key of which the value is missing. | | key | K | Yes| Key of which the value is missing.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| V | Value of the key. | | V | Value of the key.|
**Example** **Example**
```js ```js
...@@ -1036,9 +1034,9 @@ Obtains a new iterator object that contains all key-value pairs in this object. ...@@ -1036,9 +1034,9 @@ Obtains a new iterator object that contains all key-value pairs in this object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| [K,&nbsp;V] | Iterable array. | | [K, V] | Iterable array.|
**Example** **Example**
```js ```js
...@@ -1057,9 +1055,9 @@ Obtains a two-dimensional array in key-value pairs. ...@@ -1057,9 +1055,9 @@ Obtains a two-dimensional array in key-value pairs.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| [K,&nbsp;V] | Two-dimensional array in key-value pairs. | | [K, V] | Two-dimensional array in key-value pairs.|
**Example** **Example**
```js ```js
...@@ -1081,7 +1079,7 @@ The values of the **ScopeComparable** type are used to implement the **compareTo ...@@ -1081,7 +1079,7 @@ The values of the **ScopeComparable** type are used to implement the **compareTo
interface ScopeComparable{ interface ScopeComparable{
compareTo(other: ScopeComparable): boolean; compareTo(other: ScopeComparable): boolean;
} }
type ScopeType = ScopeComparable | number; type ScopeType = ScopeComparable | number;
``` ```
...@@ -1092,6 +1090,8 @@ Example ...@@ -1092,6 +1090,8 @@ Example
```js ```js
class Temperature{ class Temperature{
constructor(value){ constructor(value){
// If TS is used for development, add the following code:
// private readonly _temp: Temperature;
this._temp = value; this._temp = value;
} }
comapreTo(value){ comapreTo(value){
...@@ -1116,10 +1116,10 @@ A constructor used to create a **Scope** object with the specified upper and low ...@@ -1116,10 +1116,10 @@ A constructor used to create a **Scope** object with the specified upper and low
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| lowerObj | [ScopeType](#scopetype8) | Yes | Lower limit of the **Scope** object. | | lowerObj | [ScopeType](#scopetype8) | Yes| Lower limit of the **Scope** object.|
| upperObj | [ScopeType](#scopetype8) | Yes | Upper limit of the **Scope** object. | | upperObj | [ScopeType](#scopetype8) | Yes| Upper limit of the **Scope** object.|
**Example** **Example**
```js ```js
...@@ -1138,9 +1138,9 @@ Obtains a string representation that contains this **Scope**. ...@@ -1138,9 +1138,9 @@ Obtains a string representation that contains this **Scope**.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| string | String representation containing the **Scope**. | | string | String representation containing the **Scope**.|
**Example** **Example**
```js ```js
...@@ -1160,14 +1160,14 @@ Obtains the intersection of this **Scope** and the given **Scope**. ...@@ -1160,14 +1160,14 @@ Obtains the intersection of this **Scope** and the given **Scope**.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| range | [Scope](#scope8) | Yes | **Scope** specified. | | range | [Scope](#scope8) | Yes| **Scope** specified.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| [Scope](#scope8) | Intersection of this **Scope** and the given **Scope**. | | [Scope](#scope8) | Intersection of this **Scope** and the given **Scope**.|
**Example** **Example**
```js ```js
...@@ -1183,22 +1183,22 @@ Obtains the intersection of this **Scope** and the given **Scope**. ...@@ -1183,22 +1183,22 @@ Obtains the intersection of this **Scope** and the given **Scope**.
### intersect<sup>8+</sup> ### intersect<sup>8+</sup>
intersect(lowerObj: ScopeType,upperObj: ScopeType): Scope intersect(lowerObj:ScopeType,upperObj:ScopeType):Scope
Obtains the intersection of this **Scope** and the given lower and upper limits. Obtains the intersection of this **Scope** and the given lower and upper limits.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| lowerObj | [ScopeType](#scopetype8) | Yes | Lower limit. | | lowerObj | [ScopeType](#scopetype8) | Yes| Lower limit.|
| upperObj | [ScopeType](#scopetype8) | Yes | Upper limit. | | upperObj | [ScopeType](#scopetype8) | Yes| Upper limit.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| [Scope](#scope8) | Intersection of this **Scope** and the given lower and upper limits. | | [Scope](#scope8) | Intersection of this **Scope** and the given lower and upper limits.|
**Example** **Example**
```js ```js
...@@ -1221,9 +1221,9 @@ Obtains the upper limit of this **Scope**. ...@@ -1221,9 +1221,9 @@ Obtains the upper limit of this **Scope**.
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| [ScopeType](#scopetype8) | Upper limit of this **Scope**. | | [ScopeType](#scopetype8) | Upper limit of this **Scope**.|
**Example** **Example**
```js ```js
...@@ -1243,9 +1243,9 @@ Obtains the lower limit of this **Scope**. ...@@ -1243,9 +1243,9 @@ Obtains the lower limit of this **Scope**.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| [ScopeType](#scopetype8) | Lower limit of this **Scope**. | | [ScopeType](#scopetype8) | Lower limit of this **Scope**.|
**Example** **Example**
```js ```js
...@@ -1265,17 +1265,18 @@ Obtains the union set of this **Scope** and the given lower and upper limits. ...@@ -1265,17 +1265,18 @@ Obtains the union set of this **Scope** and the given lower and upper limits.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| lowerObj | [ScopeType](#scopetype8) | Yes | Lower limit. | | lowerObj | [ScopeType](#scopetype8) | Yes| Lower limit.|
| upperObj | [ScopeType](#scopetype8) | Yes | Upper limit. | | upperObj | [ScopeType](#scopetype8) | Yes| Upper limit.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| [Scope](#scope8) | Union set of this **Scope** and the given lower and upper limits. | | [Scope](#scope8) | Union set of this **Scope** and the given lower and upper limits.|
**Example** **Example**
```js ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
...@@ -1288,21 +1289,21 @@ Obtains the union set of this **Scope** and the given lower and upper limits. ...@@ -1288,21 +1289,21 @@ Obtains the union set of this **Scope** and the given lower and upper limits.
### expand<sup>8+</sup> ### expand<sup>8+</sup>
expand(range:Scope):Scope expand(range: Scope): Scope
Obtains the union set of this **Scope** and the given **Scope**. Obtains the union set of this **Scope** and the given **Scope**.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| range | [Scope](#scope8) | Yes | **Scope** specified. | | range | [Scope](#scope8) | Yes| **Scope** specified.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| [Scope](#scope8) | Union set of this **Scope** and the given **Scope**. | | [Scope](#scope8) | Union set of this **Scope** and the given **Scope**.|
**Example** **Example**
```js ```js
...@@ -1325,14 +1326,14 @@ Obtains the union set of this **Scope** and the given value. ...@@ -1325,14 +1326,14 @@ Obtains the union set of this **Scope** and the given value.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | [ScopeType](#scopetype8) | Yes | Value specified. | | value | [ScopeType](#scopetype8) | Yes| Value specified.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| [Scope](#scope8) | Union set of this **Scope** and the given value. | | [Scope](#scope8) | Union set of this **Scope** and the given value.|
**Example** **Example**
```js ```js
...@@ -1353,14 +1354,14 @@ Checks whether a value is within this **Scope**. ...@@ -1353,14 +1354,14 @@ Checks whether a value is within this **Scope**.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | [ScopeType](#scopetype8) | Yes | Value specified. | | value | [ScopeType](#scopetype8) | Yes| Value specified.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the value is within this **Scope**; returns **false** otherwise. | | boolean | Returns **true** if the value is within this **Scope**; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -1381,14 +1382,14 @@ Checks whether a range is within this **Scope**. ...@@ -1381,14 +1382,14 @@ Checks whether a range is within this **Scope**.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| range | [Scope](#scope8) | Yes | **Scope** specified. | | range | [Scope](#scope8) | Yes| **Scope** specified.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the range is within this **Scope**; returns **false** otherwise. | | boolean | Returns **true** if the range is within this **Scope**; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -1411,14 +1412,14 @@ Limits a value to this **Scope**. ...@@ -1411,14 +1412,14 @@ Limits a value to this **Scope**.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | [ScopeType](#scopetype8) | Yes | Value specified. | | value | [ScopeType](#scopetype8) | Yes| Value specified.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| [ScopeType](#scopetype8) | Returns **lowerObj** if the specified value is less than the lower limit; returns **upperObj** if the specified value is greater than the upper limit; returns the specified value if it is within this **Scope**. | | [ScopeType](#scopetype8) | Returns **lowerObj** if the specified value is less than the lower limit; returns **upperObj** if the specified value is greater than the upper limit; returns the specified value if it is within this **Scope**.|
**Example** **Example**
```js ```js
...@@ -1456,14 +1457,14 @@ Encodes the input content. ...@@ -1456,14 +1457,14 @@ Encodes the input content.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| src | Uint8Array | Yes | Uint8Array to encode. | | src | Uint8Array | Yes| Uint8Array to encode.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| Uint8Array | Uint8Array encoded. | | Uint8Array | Uint8Array encoded.|
**Example** **Example**
```js ```js
...@@ -1482,14 +1483,14 @@ Encodes the input content. ...@@ -1482,14 +1483,14 @@ Encodes the input content.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| src | Uint8Array | Yes | Uint8Array to encode. | | src | Uint8Array | Yes| Uint8Array to encode.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| string | String encoded from the Uint8Array. | | string | String encoded from the Uint8Array.|
**Example** **Example**
```js ```js
...@@ -1501,21 +1502,21 @@ Encodes the input content. ...@@ -1501,21 +1502,21 @@ Encodes the input content.
### decodeSync<sup>8+</sup> ### decodeSync<sup>8+</sup>
decodeSync(src: Uint8Array | string): Uint8Array decodeSync(src: Uint8Array | string): Uint8Array
Decodes the input content. Decodes the input content.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| src | Uint8Array&nbsp;\ |&nbsp;string | Yes | Uint8Array or string to decode. | | src | Uint8Array \| string | Yes| Uint8Array or string to decode.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| Uint8Array | Uint8Array decoded. | | Uint8Array | Uint8Array decoded.|
**Example** **Example**
```js ```js
...@@ -1534,14 +1535,14 @@ Encodes the input content asynchronously. ...@@ -1534,14 +1535,14 @@ Encodes the input content asynchronously.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| src | Uint8Array | Yes | Uint8Array to encode asynchronously. | | src | Uint8Array | Yes| Uint8Array to encode asynchronously.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;Uint8Array&gt; | Uint8Array obtained after asynchronous encoding. | | Promise&lt;Uint8Array&gt; | Uint8Array obtained after asynchronous encoding.|
**Example** **Example**
```js ```js
...@@ -1565,14 +1566,14 @@ Encodes the input content asynchronously. ...@@ -1565,14 +1566,14 @@ Encodes the input content asynchronously.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| src | Uint8Array | Yes | Uint8Array to encode asynchronously. | | src | Uint8Array | Yes| Uint8Array to encode asynchronously.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;string&gt; | String obtained after asynchronous encoding. | | Promise&lt;string&gt; | String obtained after asynchronous encoding.|
**Example** **Example**
```js ```js
...@@ -1586,21 +1587,21 @@ Encodes the input content asynchronously. ...@@ -1586,21 +1587,21 @@ Encodes the input content asynchronously.
### decode<sup>8+</sup> ### decode<sup>8+</sup>
decode(src: Uint8Array | string): Promise&lt;Uint8Array&gt; decode(src: Uint8Array | string): Promise&lt;Uint8Array&gt;
Decodes the input content asynchronously. Decodes the input content asynchronously.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| src | Uint8Array&nbsp;\ |&nbsp;string | Yes | Uint8Array or string to decode asynchronously. | | src | Uint8Array \| string | Yes| Uint8Array or string to decode asynchronously.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;Uint8Array&gt; | Uint8Array obtained after asynchronous decoding. | | Promise&lt;Uint8Array&gt; | Uint8Array obtained after asynchronous decoding.|
**Example** **Example**
```js ```js
...@@ -1622,7 +1623,7 @@ Decodes the input content asynchronously. ...@@ -1622,7 +1623,7 @@ Decodes the input content asynchronously.
constructor() constructor()
A constructor used to create a **types** object. A constructor used to create a **Types** object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
...@@ -1641,14 +1642,14 @@ Checks whether the input value is of the **ArrayBuffer** type. ...@@ -1641,14 +1642,14 @@ Checks whether the input value is of the **ArrayBuffer** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **ArrayBuffer** type; returns **false** otherwise. | | boolean | Returns **true** if the input value is of the **ArrayBuffer** type; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -1668,14 +1669,14 @@ Checks whether the input value is of the **ArrayBufferView** type. ...@@ -1668,14 +1669,14 @@ Checks whether the input value is of the **ArrayBufferView** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **ArrayBufferView** type; returns **false** otherwise. | | boolean | Returns **true** if the input value is of the **ArrayBufferView** type; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -1693,14 +1694,14 @@ Checks whether the input value is of the **arguments** type. ...@@ -1693,14 +1694,14 @@ Checks whether the input value is of the **arguments** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **arguments** type; returns **false** otherwise. | | boolean | Returns **true** if the input value is of the **arguments** type; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -1721,14 +1722,14 @@ Checks whether the input value is of the **ArrayBuffer** type. ...@@ -1721,14 +1722,14 @@ Checks whether the input value is of the **ArrayBuffer** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **ArrayBuffer** type; returns **false** otherwise. | | boolean | Returns **true** if the input value is of the **ArrayBuffer** type; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -1746,14 +1747,14 @@ Checks whether the input value is an asynchronous function. ...@@ -1746,14 +1747,14 @@ Checks whether the input value is an asynchronous function.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is an asynchronous function; returns **false** otherwise. | | boolean | Returns **true** if the input value is an asynchronous function; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -1771,14 +1772,14 @@ Checks whether the input value is of the **Boolean** type. ...@@ -1771,14 +1772,14 @@ Checks whether the input value is of the **Boolean** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Boolean** type; returns **false** otherwise. | | boolean | Returns **true** if the input value is of the **Boolean** type; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -1796,14 +1797,14 @@ Checks whether the input value is of the **Boolean**, **Number**, **String**, or ...@@ -1796,14 +1797,14 @@ Checks whether the input value is of the **Boolean**, **Number**, **String**, or
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Boolean**, **Number**, **String**, or **Symbol** type; returns **false** otherwise. | | boolean | Returns **true** if the input value is of the **Boolean**, **Number**, **String**, or **Symbol** type; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -1821,14 +1822,14 @@ Checks whether the input value is of the **DataView** type. ...@@ -1821,14 +1822,14 @@ Checks whether the input value is of the **DataView** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **DataView** type; returns **false** otherwise. | | boolean | Returns **true** if the input value is of the **DataView** type; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -1847,14 +1848,14 @@ Checks whether the input value is of the **Date** type. ...@@ -1847,14 +1848,14 @@ Checks whether the input value is of the **Date** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Date** type; returns **false** otherwise. | | boolean | Returns **true** if the input value is of the **Date** type; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -1872,14 +1873,14 @@ Checks whether the input value is of the **native external** type. ...@@ -1872,14 +1873,14 @@ Checks whether the input value is of the **native external** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **native external** type; returns **false** otherwise. | | boolean | Returns **true** if the input value is of the **native external** type; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -1898,14 +1899,14 @@ Checks whether the input value is of the **Float32Array** type. ...@@ -1898,14 +1899,14 @@ Checks whether the input value is of the **Float32Array** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Float32Array** type; returns **false** otherwise. | | boolean | Returns **true** if the input value is of the **Float32Array** type; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -1923,14 +1924,14 @@ Checks whether the input value is of the **Float64Array** type. ...@@ -1923,14 +1924,14 @@ Checks whether the input value is of the **Float64Array** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Float64Array** type; returns **false** otherwise. | | boolean | Returns **true** if the input value is of the **Float64Array** type; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -1948,14 +1949,14 @@ Checks whether the input value is a generator function. ...@@ -1948,14 +1949,14 @@ Checks whether the input value is a generator function.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is a generator function; returns **false** otherwise. | | boolean | Returns **true** if the input value is a generator function; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -1973,14 +1974,14 @@ Checks whether the input value is a generator object. ...@@ -1973,14 +1974,14 @@ Checks whether the input value is a generator object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is a generator object; returns **false** otherwise. | | boolean | Returns **true** if the input value is a generator object; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -2000,14 +2001,14 @@ Checks whether the input value is of the **Int8Array** type. ...@@ -2000,14 +2001,14 @@ Checks whether the input value is of the **Int8Array** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Int8Array** type; returns **false** otherwise. | | boolean | Returns **true** if the input value is of the **Int8Array** type; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -2025,14 +2026,14 @@ Checks whether the input value is of the **Int16Array** type. ...@@ -2025,14 +2026,14 @@ Checks whether the input value is of the **Int16Array** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Int16Array** type; returns **false** otherwise. | | boolean | Returns **true** if the input value is of the **Int16Array** type; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -2050,14 +2051,14 @@ Checks whether the input value is of the **Int32Array** type. ...@@ -2050,14 +2051,14 @@ Checks whether the input value is of the **Int32Array** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Int32Array** type; returns **false** otherwise. | | boolean | Returns **true** if the input value is of the **Int32Array** type; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -2075,14 +2076,14 @@ Checks whether the input value is of the **Map** type. ...@@ -2075,14 +2076,14 @@ Checks whether the input value is of the **Map** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Map** type; returns **false** otherwise. | | boolean | Returns **true** if the input value is of the **Map** type; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -2100,14 +2101,14 @@ Checks whether the input value is of the **MapIterator** type. ...@@ -2100,14 +2101,14 @@ Checks whether the input value is of the **MapIterator** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **MapIterator** type; returns **false** otherwise. | | boolean | Returns **true** if the input value is of the **MapIterator** type; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -2126,14 +2127,14 @@ Checks whether the input value is of the **Error** type. ...@@ -2126,14 +2127,14 @@ Checks whether the input value is of the **Error** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Error** type; returns **false** otherwise. | | boolean | Returns **true** if the input value is of the **Error** type; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -2151,14 +2152,14 @@ Checks whether the input value is a number object. ...@@ -2151,14 +2152,14 @@ Checks whether the input value is a number object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is a number object; returns **false** otherwise. | | boolean | Returns **true** if the input value is a number object; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -2176,14 +2177,14 @@ Checks whether the input value is a promise. ...@@ -2176,14 +2177,14 @@ Checks whether the input value is a promise.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is a promise; returns **false** otherwise. | | boolean | Returns **true** if the input value is a promise; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -2201,14 +2202,14 @@ Checks whether the input value is a proxy. ...@@ -2201,14 +2202,14 @@ Checks whether the input value is a proxy.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is a proxy; returns **false** otherwise. | | boolean | Returns **true** if the input value is a proxy; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -2228,14 +2229,14 @@ Checks whether the input value is of the **RegExp** type. ...@@ -2228,14 +2229,14 @@ Checks whether the input value is of the **RegExp** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **RegExp** type; returns **false** otherwise. | | boolean | Returns **true** if the input value is of the **RegExp** type; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -2253,14 +2254,14 @@ Checks whether the input value is of the **Set** type. ...@@ -2253,14 +2254,14 @@ Checks whether the input value is of the **Set** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Set** type; returns **false** otherwise. | | boolean | Returns **true** if the input value is of the **Set** type; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -2278,14 +2279,14 @@ Checks whether the input value is of the **SetIterator** type. ...@@ -2278,14 +2279,14 @@ Checks whether the input value is of the **SetIterator** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **SetIterator** type; returns **false** otherwise. | | boolean | Returns **true** if the input value is of the **SetIterator** type; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -2304,14 +2305,14 @@ Checks whether the input value is a string object. ...@@ -2304,14 +2305,14 @@ Checks whether the input value is a string object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is a string object; returns **false** otherwise. | | boolean | Returns **true** if the input value is a string object; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -2329,14 +2330,14 @@ Checks whether the input value is a symbol object. ...@@ -2329,14 +2330,14 @@ Checks whether the input value is a symbol object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is a symbol object; returns **false** otherwise. | | boolean | Returns **true** if the input value is a symbol object; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -2357,14 +2358,14 @@ Checks whether the input value is of the **TypedArray** type. ...@@ -2357,14 +2358,14 @@ Checks whether the input value is of the **TypedArray** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **TypedArray** type; returns **false** otherwise. | | boolean | Returns **true** if the input value is of the **TypedArray** type; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -2382,14 +2383,14 @@ Checks whether the input value is of the **Uint8Array** type. ...@@ -2382,14 +2383,14 @@ Checks whether the input value is of the **Uint8Array** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Uint8Array** type; returns **false** otherwise. | | boolean | Returns **true** if the input value is of the **Uint8Array** type; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -2407,14 +2408,14 @@ Checks whether the input value is of the **Uint8ClampedArray** type. ...@@ -2407,14 +2408,14 @@ Checks whether the input value is of the **Uint8ClampedArray** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Uint8ClampedArray** type; returns **false** otherwise. | | boolean | Returns **true** if the input value is of the **Uint8ClampedArray** type; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -2432,14 +2433,14 @@ Checks whether the input value is of the **Uint16Array** type. ...@@ -2432,14 +2433,14 @@ Checks whether the input value is of the **Uint16Array** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Uint16Array** type; returns **false** otherwise. | | boolean | Returns **true** if the input value is of the **Uint16Array** type; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -2457,14 +2458,14 @@ Checks whether the input value is of the **Uint32Array** type. ...@@ -2457,14 +2458,14 @@ Checks whether the input value is of the **Uint32Array** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Uint32Array** type; returns **false** otherwise. | | boolean | Returns **true** if the input value is of the **Uint32Array** type; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -2482,14 +2483,14 @@ Checks whether the input value is of the **WeakMap** type. ...@@ -2482,14 +2483,14 @@ Checks whether the input value is of the **WeakMap** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **WeakMap** type; returns **false** otherwise. | | boolean | Returns **true** if the input value is of the **WeakMap** type; returns **false** otherwise.|
**Example** **Example**
```js ```js
...@@ -2507,17 +2508,17 @@ Checks whether the input value is of the **WeakSet** type. ...@@ -2507,17 +2508,17 @@ Checks whether the input value is of the **WeakSet** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes | Object to check. | | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **WeakSet** type; returns **false** otherwise. | | boolean | Returns **true** if the input value is of the **WeakSet** type; returns **false** otherwise.|
**Example** **Example**
```js ```js
var that = new util.types(); var that = new util.types();
var result = that.isWeakSet(new WeakSet()); var result = that.isWeakSet(new WeakSet());
``` ```
\ No newline at end of file
# XML Parsing and Generation # XML Parsing and Generation
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br> > **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...@@ -25,7 +26,7 @@ A constructor used to create an **XmlSerializer** instance. ...@@ -25,7 +26,7 @@ A constructor used to create an **XmlSerializer** instance.
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| buffer | ArrayBuffer&nbsp;\|&nbsp;DataView | Yes| **ArrayBuffer** or **DataView** for storing the XML information to write.| | buffer | ArrayBuffer \| DataView | Yes| **ArrayBuffer** or **DataView** for storing the XML information to write.|
| encoding | string | No| Encoding format.| | encoding | string | No| Encoding format.|
**Example** **Example**
...@@ -55,6 +56,8 @@ Sets an attribute. ...@@ -55,6 +56,8 @@ Sets an attribute.
**Example** **Example**
```js ```js
var arrayBuffer = new ArrayBuffer(1024);
var bufView = new DataView(arrayBuffer);
var thatSer = new xml.XmlSerializer(bufView); var thatSer = new xml.XmlSerializer(bufView);
thatSer.setAttributes("importance", "high"); thatSer.setAttributes("importance", "high");
``` ```
...@@ -77,6 +80,8 @@ Adds an empty element. ...@@ -77,6 +80,8 @@ Adds an empty element.
**Example** **Example**
```js ```js
var arrayBuffer = new ArrayBuffer(1024);
var bufView = new DataView(arrayBuffer);
var thatSer = new xml.XmlSerializer(bufView); var thatSer = new xml.XmlSerializer(bufView);
thatSer.addEmptyElement("b"); // => <b/> thatSer.addEmptyElement("b"); // => <b/>
``` ```
...@@ -93,6 +98,8 @@ Sets a declaration. ...@@ -93,6 +98,8 @@ Sets a declaration.
**Example** **Example**
```js ```js
var arrayBuffer = new ArrayBuffer(1024);
var bufView = new DataView(arrayBuffer);
var thatSer = new xml.XmlSerializer(bufView); var thatSer = new xml.XmlSerializer(bufView);
thatSer.setDeclaration() // => <?xml version="1.0" encoding="utf-8"?>; thatSer.setDeclaration() // => <?xml version="1.0" encoding="utf-8"?>;
``` ```
...@@ -133,6 +140,8 @@ Writes the end tag of the element. ...@@ -133,6 +140,8 @@ Writes the end tag of the element.
**Example** **Example**
```js ```js
var arrayBuffer = new ArrayBuffer(1024);
var bufView = new DataView(arrayBuffer);
var thatSer = new xml.XmlSerializer(bufView); var thatSer = new xml.XmlSerializer(bufView);
thatSer.setNamespace("h", "http://www.w3.org/TR/html4/"); thatSer.setNamespace("h", "http://www.w3.org/TR/html4/");
thatSer.startElement("table"); thatSer.startElement("table");
...@@ -280,7 +289,7 @@ Creates and returns an **XmlPullParser** object. The **XmlPullParser** object pa ...@@ -280,7 +289,7 @@ Creates and returns an **XmlPullParser** object. The **XmlPullParser** object pa
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| buffer | ArrayBuffer&nbsp;\|&nbsp;DataView | Yes| **ArrayBuffer** or **DataView** that contains XML text information.| | buffer | ArrayBuffer \| DataView | Yes| **ArrayBuffer** or **DataView** that contains XML text information.|
| encoding | string | No| Encoding format. Only UTF-8 is supported.| | encoding | string | No| Encoding format. Only UTF-8 is supported.|
**Example** **Example**
...@@ -358,9 +367,9 @@ Defines the XML parsing options. ...@@ -358,9 +367,9 @@ Defines the XML parsing options.
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| supportDoctype | boolean | No| Whether to ignore **Doctype**. The default value is **false**.| | supportDoctype | boolean | No| Whether to ignore **Doctype**. The default value is **false**.|
| ignoreNameSpace | boolean | No| Whether to ignore **Namespace**. The default value is **false**.| | ignoreNameSpace | boolean | No| Whether to ignore **Namespace**. The default value is **false**.|
| tagValueCallbackFunction | (name:&nbsp;string,&nbsp;value:&nbsp;string)=&gt;&nbsp;boolean | No| Callback used to return **tagValue**.| | tagValueCallbackFunction | (name: string, value: string)=&gt; boolean | No| Callback used to return **tagValue**.|
| attributeValueCallbackFunction | (name:&nbsp;string,&nbsp;value:&nbsp;string)=&gt;&nbsp;boolean | No| Callback used to return **attributeValue**.| | attributeValueCallbackFunction | (name: string, value: string)=&gt; boolean | No| Callback used to return **attributeValue**.|
| tokenValueCallbackFunction | (eventType:&nbsp;[EventType](#eventtype),&nbsp;value:&nbsp;[ParseInfo](#parseinfo))=&gt;&nbsp;boolean | No| Callback used to return **tokenValue**.| | tokenValueCallbackFunction | (eventType: [EventType](#eventtype), value: [ParseInfo](#parseinfo))=&gt; boolean | No| Callback used to return **tokenValue**.|
## ParseInfo ## ParseInfo
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册