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

!20264 翻译完成:19678 补充util模块部分接口可选参数默认值说明,xml模块示例代码修改

Merge pull request !20264 from wusongqing/TR19678
......@@ -379,15 +379,15 @@ Replaces all elements in this container with new elements, and returns the new o
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callbackFn | function | Yes| Callback invoked for the replacement.|
| thisArg | Object | No| Value to use when the callback is invoked.|
| thisArg | Object | No| Value of **this** to use when **callbackFn** is invoked. The default value is this instance.|
callbackfn
callbackFn
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| value | T | Yes| Value of the element that is currently traversed.|
| index | number | No| Position index of the element that is currently traversed.|
| arrlist | ArrayList<T> | No| Instance that invokes the **replaceAllElements** method.|
| index | number | No| Position index of the element that is currently traversed. The default value is **0**.|
| arrlist | ArrayList<T> | No| Instance that calls the **replaceAllElements** API. The default value is this instance.|
**Error codes**
......@@ -425,15 +425,15 @@ Uses a callback to traverse the elements in this container and obtain their posi
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callbackFn | function | Yes| Callback invoked for the replacement.|
| thisArg | Object | No| Value to use when the callback is invoked.|
| thisArg | Object | No| Value of **this** to use when **callbackFn** is invoked. The default value is this instance.|
callbackfn
callbackFn
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| value | T | Yes| Value of the element that is currently traversed.|
| index | number | No| Position index of the element that is currently traversed.|
| arrlist | ArrayList<T> | No| Instance that invokes the **forEach** method.|
| index | number | No| Position index of the element that is currently traversed. The default value is 0.|
| arrlist | ArrayList<T> | No| Instance that calls the **forEach** API. The default value is this instance.|
**Error codes**
......@@ -468,7 +468,7 @@ Sorts elements in this container.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| comparator | function | No| Callback invoked for sorting.|
| comparator | function | No| Callback invoked for sorting. The default value is the callback function for sorting elements in ascending order.|
comparator
......
......@@ -204,7 +204,7 @@ Concatenates an array of **Buffer** instances of the specified length into a new
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| list | Buffer[] \| Uint8Array[] | Yes| Array of instances to concatenate.|
| totalLength | number | No| Total length of bytes to be copied.|
| totalLength | number | No| Total length of bytes to be copied. The default value is **0**.|
**Return value**
......@@ -1915,7 +1915,7 @@ Converts the data at the specified position in this **Buffer** instance into a s
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| encoding | string | No| Encoding format of the string. The default value is **utf-8**.|
| encoding | string | No| Encoding format (valid only when **value** is a string). The default value is **utf-8**.|
| start | number | No| Offset to the start position of the data to convert. The default value is **0**.|
| end | number | No| Offset to the end position of the data to convert. The default value is the length of this **Buffer** instance.|
......
......@@ -242,15 +242,15 @@ Uses a callback to traverse the elements in this container and obtain their posi
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callbackFn | function | Yes| Callback invoked to traverse the elements in the container.|
| thisArg | Object | No| Value to use when the callback is invoked.|
| thisArg | Object | No| Value of **this** to use when **callbackFn** is invoked. The default value is this instance.|
callbackfn
callbackFn
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| value | T | Yes| Value of the element that is currently traversed.|
| index | number | No| Position index of the element that is currently traversed.|
| deque | Deque<T> | No| Instance that invokes the **forEach** method.|
| index | number | No| Position index of the element that is currently traversed. The default value is **0**.|
| deque | Deque<T> | No| Instance that calls the **forEach** API. The default value is this instance.|
**Error codes**
......
......@@ -459,14 +459,14 @@ Uses a callback to traverse the elements in this container and obtain their posi
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callbackFn | function | Yes| Callback invoked to traverse the elements in the container.|
| thisArg | Object | No| Value to use when the callback is invoked.|
| thisArg | Object | No| Value of **this** to use when **callbackFn** is invoked. The default value is this instance.|
callbackfn
callbackFn
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| value | V | No| Value of the element that is currently traversed.|
| key | K | No| Key of the element that is currently traversed.|
| map | HashMap<K, V> | No| Instance that invokes the **forEach** method.|
| value | V | No| Value of the element that is currently traversed. The default value is the value of the first key-value pair.|
| key | K | No| Key of the element that is currently traversed. The default value is the key of the first key-value pair.|
| map | HashMap<K, V> | No| Instance that calls the **forEach** API. The default value is this instance.|
**Error codes**
......
......@@ -282,14 +282,14 @@ Uses a callback to traverse the elements in this container and obtain their posi
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callbackFn | function | Yes| Callback invoked to traverse the elements in the container.|
| thisArg | Object | No| Value to use when the callback is invoked.|
| thisArg | Object | No| Value of **this** to use when **callbackFn** is invoked. The default value is this instance.|
callbackfn
callbackFn
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| value | T | No| Value of the element that is currently traversed.|
| key | T | No| Key of the element that is currently traversed (same as **value**).|
| set | HashSet&lt;T&gt; | No| Instance that invokes the **forEach** API.|
| value | T | No| Value of the element that is currently traversed. The default value is the value of the first key-value pair.|
| key | T | No| Key of the element that is currently traversed (same as **value**). The default value is the key of the first key-value pair.|
| set | HashSet&lt;T&gt; | No| Instance that calls the **forEach** API. The default value is this instance.|
**Error codes**
......
......@@ -724,14 +724,14 @@ Uses a callback to traverse the elements in this container and obtain their posi
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callbackFn | function | Yes| Callback invoked to traverse the elements in the container.|
| thisArg | Object | No| Value to use when the callback is invoked.|
| thisArg | Object | No| Value of **this** to use when **callbackFn** is invoked. The default value is this instance.|
callbackfn
callbackFn
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| value | V | No| Value of the element that is currently traversed.|
| key | K | No| Key of the element that is currently traversed.|
| map | LightWeightMap<K, V> | No| Instance that invokes the **forEach** method.|
| value | V | No| Value of the element that is currently traversed. The default value is the value of the first key-value pair.|
| key | K | No| Key of the element that is currently traversed. The default value is the key of the first key-value pair.|
| map | LightWeightMap<K, V> | No| Instance that calls the **forEach** API. The default value is this instance.|
**Error codes**
......
......@@ -588,14 +588,14 @@ Uses a callback to traverse the elements in this container and obtain their posi
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callbackFn | function | Yes| Callback invoked to traverse the elements in the container.|
| thisArg | Object | No| Value to use when the callback is invoked.|
| thisArg | Object | No| Value of **this** to use when **callbackFn** is invoked. The default value is this instance.|
callbackfn
callbackFn
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| value | T | No| Value of the element that is currently traversed.|
| key| T | No| Key of the element that is currently traversed (same as **value**).|
| set | LightWeightSet&lt;T&gt; | No| Instance that invokes the **forEach** method.|
| value | T | No| Value of the element that is currently traversed. The default value is the value of the first key-value pair.|
| key| T | No| Key of the element that is currently traversed (same as **value**). The default value is the key of the first key-value pair.|
| set | LightWeightSet&lt;T&gt; | No| Instance that calls the **forEach** API. The default value is this instance.|
**Error codes**
......
......@@ -607,15 +607,15 @@ Uses a callback to traverse the elements in this container and obtain their posi
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callbackFn | function | Yes| Callback invoked to traverse the elements in the container.|
| thisArg | Object | No| Value to use when the callback is invoked.|
| thisArg | Object | No| Value of **this** to use when **callbackFn** is invoked. The default value is this instance.|
callbackfn
callbackFn
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| value | T | Yes| Value of the element that is currently traversed.|
| index | number | No| Position index of the element that is currently traversed.|
| LinkedList | LinkedList&lt;T&gt; | No| Instance that invokes the **forEach** API.|
| index | number | No| Position index of the element that is currently traversed. The default value is **0**.|
| LinkedList | LinkedList&lt;T&gt; | No| Instance that calls the **forEach** API. The default value is this instance.|
**Error codes**
......
......@@ -427,15 +427,15 @@ Replaces all elements in this container with new elements, and returns the new o
| Name| Value Type | Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callbackFn | function | Yes| Callback invoked for the replacement.|
| thisArg | Object | No| Value to use when the callback is invoked.|
| thisArg | Object | No| Value of **this** to use when **callbackFn** is invoked. The default value is this instance.|
callbackfn
callbackFn
| Name| Value Type | Mandatory| Description|
| -------- | -------- | -------- | -------- |
| value | T | Yes| Value of the element that is currently traversed.|
| index | number | No| Position index of the element that is currently traversed.|
| list | List&lt;T&gt; | No| Instance that invokes the **replaceAllElements** method.|
| index | number | No| Position index of the element that is currently traversed. The default value is **0**.|
| list | List&lt;T&gt; | No| Instance that calls the **replaceAllElements** API. The default value is this instance.|
**Error codes**
......@@ -473,15 +473,15 @@ Uses a callback to traverse the elements in this container and obtain their posi
| Name| Value Type | Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callbackFn | function | Yes| Callback invoked for the replacement.|
| thisArg | Object | No| Value to use when the callback is invoked.|
| thisArg | Object | No| Value of **this** to use when **callbackFn** is invoked. The default value is this instance.|
callbackfn
callbackFn
| Name| Value Type | Mandatory| Description|
| -------- | -------- | -------- | -------- |
| value | T | Yes| Value of the element that is currently traversed.|
| index | number | No| Position index of the element that is currently traversed.|
| List | List&lt;T&gt; | No| Instance that invokes the **forEach** method.|
| index | number | No| Position index of the element that is currently traversed. The default value is **0**.|
| List | List&lt;T&gt; | No| Instance that calls the **forEach** API. The default value is this instance.|
**Error codes**
......
......@@ -597,14 +597,14 @@ Uses a callback to traverse the elements in this container and obtain their posi
| Name| Type | Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callbackFn | function | Yes| Callback invoked to traverse the elements in the container.|
| thisArg | Object | No| Value to use when the callback is invoked.|
| thisArg | Object | No| Value of **this** to use when **callbackFn** is invoked. The default value is this instance.|
callbackfn
callbackFn
| Name| Type | Mandatory| Description|
| -------- | -------- | -------- | -------- |
| value | T | Yes| Value of the element that is currently traversed.|
| index | number | No| Key of the element that is currently traversed.|
| PlainArray | PlainArray&lt;T&gt;| No| Instance that invokes the **forEach** API.|
| index | number | No| Position index of the element that is currently traversed. The default value is **0**.|
| PlainArray | PlainArray&lt;T&gt;| No| Instance that calls the **forEach** API. The default value is this instance.|
**Error codes**
......
......@@ -176,15 +176,15 @@ Uses a callback to traverse the elements in this container and obtain their posi
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callbackFn | function | Yes| Callback invoked to traverse the elements in the container.|
| thisArg | Object | No| Value to use when the callback is invoked.|
| thisArg | Object | No| Value of **this** to use when **callbackFn** is invoked. The default value is this instance.|
callbackfn
callbackFn
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| value | T | Yes| Value of the element that is currently traversed.|
| index | number | No| Position index of the element that is currently traversed.|
| Queue | Queue&lt;T&gt; | No| Instance that invokes the **forEach** method.|
| index | number | No| Position index of the element that is currently traversed. The default value is **0**.|
| Queue | Queue&lt;T&gt; | No| Instance that calls the **forEach** API. The default value is this instance.|
**Error codes**
......
......@@ -214,15 +214,15 @@ Uses a callback to traverse the elements in this container and obtain their posi
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callbackFn | function | Yes| Callback invoked to traverse the elements in the container.|
| thisArg | Object | No| Value to use when the callback is invoked.|
| thisArg | Object | No| Value of **this** to use when **callbackFn** is invoked. The default value is this instance.|
callbackfn
callbackFn
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| value | T | Yes| Value of the element that is currently traversed.|
| index | number | No| Position index of the element that is currently traversed.|
| stack | Stack&lt;T&gt; | No| Instance that invokes the **forEach** method.|
| index | number | No| Position index of the element that is currently traversed. The default value is **0**.|
| stack | Stack&lt;T&gt; | No| Instance that calls the **forEach** API. The default value is this instance.|
**Error codes**
......
......@@ -48,7 +48,7 @@ A constructor used to create a **TreeMap** instance.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| comparator | function | No| Custom comparator.|
| comparator | function | No| Custom comparator. The default value is **hole** (a blank placeholder), indicating that no comparator. is provided.|
**Error codes**
......@@ -611,14 +611,14 @@ Uses a callback to traverse the elements in this container and obtain their posi
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callbackFn | function | Yes| Callback invoked to traverse the elements in the container.|
| thisArg | Object | No| Value of **this** to use when **callbackFn** is invoked.|
| thisArg | Object | No| Value of **this** to use when **callbackFn** is invoked. The default value is this instance.|
callbackfn
callbackFn
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| value | V | No| Value of the element that is currently traversed.|
| key | K | No| Key of the element that is currently traversed.|
| map | TreeMap<K, V> | No| Instance that invokes the **forEach** method.|
| value | V | No| Value of the element that is currently traversed. The default value is the value of the first key-value pair.|
| key | K | No| Key of the element that is currently traversed. The default value is the key of the first key-value pair.|
| map | TreeMap<K, V> | No| Instance that calls the **forEach** API. The default value is this instance.|
**Error codes**
......
......@@ -44,7 +44,7 @@ A constructor used to create a **TreeSet** instance.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| comparator | function | No| Custom comparator.|
| comparator | function | No| Custom comparator. The default value is **hole** (a blank placeholder), indicating that no comparator. is provided.|
**Error codes**
......@@ -484,14 +484,14 @@ Uses a callback to traverse the elements in this container and obtain their posi
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callbackFn | function | Yes| Callback invoked to traverse the elements in the container.|
| thisArg | Object | No| Value of **this** to use when **callbackFn** is invoked.|
| thisArg | Object | No| Value of **this** to use when **callbackFn** is invoked. The default value is this instance.|
callbackfn
callbackFn
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| value | T | No| Value of the element that is currently traversed.|
| key | T | No| Key of the element that is currently traversed.|
| set | TreeSet&lt;T&gt; | No| Instance that invokes the **forEach** method.|
| value | T | No| Value of the element that is currently traversed. The default value is the value of the first key-value pair.|
| key | T | No| Key of the element that is currently traversed. The default value is the key of the first key-value pair.|
| set | TreeSet&lt;T&gt; | No| Instance that calls the **forEach** API. The default value is this instance.|
**Error codes**
......
......@@ -586,7 +586,7 @@ result = textEncoder.encodeInto("\uD800¥¥");
### encodeIntoUint8Array<sup>9+</sup>
encodeIntoUint8Array(input: string, dest: Uint8Array, ): { read: number; written: number }
encodeIntoUint8Array(input: string, dest: Uint8Array): { read: number; written: number }
Stores the UTF-8 encoded text.
......@@ -617,7 +617,7 @@ result = that.encodeIntoUint8Array('abcd', dest)
### encodeInto<sup>(deprecated)</sup>
encodeInto(input: string, dest: Uint8Array, ): { read: number; written: number }
encodeInto(input: string, dest: Uint8Array): { read: number; written: number }
Stores the UTF-8 encoded text.
......@@ -1100,7 +1100,7 @@ A constructor used to create a **LruCache** instance. The default capacity of th
| Name | Type | Mandatory| Description |
| -------- | ------ | ---- | ---------------------------- |
| capacity | number | No | Capacity of the **LruCache** to create.|
| capacity | number | No | Capacity of the **LruCache** to create. The default value is **64**.|
**Example**
......@@ -3400,7 +3400,7 @@ A constructor used to create a **LruBuffer** instance. The default capacity of t
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| capacity | number | No| Capacity of the **LruBuffer** to create.|
| capacity | number | No| Capacity of the **LruBuffer** to create. The default value is **64**.|
**Example**
......
......@@ -304,15 +304,15 @@ Replaces all elements in this container with new elements, and returns the new o
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callbackFn | function | Yes| Callback invoked for replacement.|
| thisArg | Object | No| Value to use when the callback is invoked.|
| thisArg | Object | No| Value of **this** to use when **callbackFn** is invoked. The default value is this instance.|
callbackfn
callbackFn
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| value | T | Yes| Value of the element that is currently traversed.|
| index | number | No| Position index of the element that is currently traversed.|
| vector | Vector&lt;T&gt; | No| Instance that invokes the **replaceAllElements** API.|
| index | number | No| Position index of the element that is currently traversed. The default value is **0**.|
| vector | Vector&lt;T&gt; | No| Instance that calls the **replaceAllElements** API. The default value is this instance.|
**Example**
......@@ -342,15 +342,15 @@ Uses a callback to traverse the elements in this container and obtain their posi
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callbackFn | function | Yes| Callback invoked for replacement.|
| thisArg | Object | No| Value to use when the callback is invoked.|
| thisArg | Object | No| Value of **this** to use when **callbackFn** is invoked. The default value is this instance.|
callbackfn
callbackFn
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| value | T | Yes| Value of the element that is currently traversed.|
| index | number | No| Position index of the element that is currently traversed.|
| vector | Vector&lt;T&gt; | No| Instance that invokes the **forEach** API.|
| index | number | No| Position index of the element that is currently traversed. The default value is **0**.|
| vector | Vector&lt;T&gt; | No| Instance that calls the **forEach** API. The default value is this instance.|
**Example**
......@@ -378,7 +378,7 @@ Sorts elements in this container.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| comparator | function | No| Callback invoked for sorting.|
| comparator | function | No| Callback invoked for sorting. The default value is this instance.|
comparator
......
......@@ -381,6 +381,7 @@ Creates and returns an **XmlPullParser** object.
**Example**
```js
import util from '@ohos.util';
let strXml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<!DOCTYPE note [\n<!ENTITY foo "baa">]>' +
......@@ -432,6 +433,7 @@ Parses XML information.
**Example**
```js
import util from '@ohos.util';
let strXml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
......@@ -499,6 +501,7 @@ Obtains the column line number, starting from 1.
**Example**
```js
import util from '@ohos.util';
let strXml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
......@@ -542,6 +545,7 @@ Obtains the depth of this element.
**Example**
```js
import util from '@ohos.util';
let strXml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
......@@ -588,6 +592,7 @@ Obtains the current line number, starting from 1.
**Example**
```js
import util from '@ohos.util';
let strXml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
......@@ -631,6 +636,7 @@ Obtains the name of this element.
**Example**
```js
import util from '@ohos.util';
let strXml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
......@@ -673,6 +679,7 @@ Obtains the namespace of this element.
**Example**
```js
import util from '@ohos.util';
let strXml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
......@@ -715,6 +722,7 @@ Obtains the prefix of this element.
**Example**
```js
import util from '@ohos.util';
let strXml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
......@@ -758,6 +766,7 @@ Obtains the text of the current event.
**Example**
```js
import util from '@ohos.util';
let strXml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
......@@ -800,6 +809,7 @@ Checks whether the current element is empty.
**Example**
```js
import util from '@ohos.util';
let strXml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
......@@ -842,6 +852,7 @@ Checks whether the current text event contains only whitespace characters.
**Example**
```js
import util from '@ohos.util';
let strXml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
......@@ -883,6 +894,7 @@ Obtains the number of attributes for the current start tag.
**Example**
```js
import util from '@ohos.util';
let strXml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册