From 0e0988c6f881c9dd247221d25ffc9f1324294e97 Mon Sep 17 00:00:00 2001 From: Orange_66 Date: Fri, 5 Sep 2025 16:10:10 +0800 Subject: [PATCH] Cherry pick from 0728 to master Issue: https://gitee.com/openharmony/interface_sdk-js/issues/ICWLSU Signed-off-by: Orange_66 --- api/@ohos.buffer.d.ts | 646 ++++++++------ api/@ohos.uri.d.ts | 70 +- api/@ohos.url.d.ts | 16 +- api/@ohos.util.ArrayList.d.ts | 176 ++-- api/@ohos.util.Deque.d.ts | 62 +- api/@ohos.util.HashMap.d.ts | 6 +- api/@ohos.util.HashSet.d.ts | 6 +- api/@ohos.util.LightWeightMap.d.ts | 71 +- api/@ohos.util.LightWeightSet.d.ts | 22 +- api/@ohos.util.LinkedList.d.ts | 32 +- api/@ohos.util.List.d.ts | 135 ++- api/@ohos.util.PlainArray.d.ts | 58 +- api/@ohos.util.Queue.d.ts | 8 +- api/@ohos.util.Stack.d.ts | 12 +- api/@ohos.util.TreeMap.d.ts | 10 +- api/@ohos.util.TreeSet.d.ts | 10 +- api/@ohos.util.json.d.ts | 59 +- ...hos.util.d.ets => @ohos.util.static.d.ets} | 601 ++++++------- api/@ohos.util.stream.d.ts | 654 ++++++-------- api/@ohos.xml.d.ts | 41 +- arkts/@arkts.collections.d.ets | 306 +------ arkts/@arkts.collections.static.d.ets | 256 ++++++ arkts/@arkts.math.Decimal.d.ets | 841 ++++++++++++------ 23 files changed, 2116 insertions(+), 1982 deletions(-) rename api/{@ohos.util.d.ets => @ohos.util.static.d.ets} (76%) create mode 100644 arkts/@arkts.collections.static.d.ets diff --git a/api/@ohos.buffer.d.ts b/api/@ohos.buffer.d.ts index 38dc61329d..0a089c4166 100644 --- a/api/@ohos.buffer.d.ts +++ b/api/@ohos.buffer.d.ts @@ -126,6 +126,34 @@ declare namespace buffer { | Float64Array | BigInt64Array | BigUint64Array; + /** + * ArrayUnionType features and methods + * + * @typedef { Array | Array | Array | Array | Array | Array | + * Array | Array | Array | Array | Array | Array | + * Array | Array | Array} + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + type ArrayUnionType = Array + | Array + | Array + | Array + | Array + | Array + | Array + | Array + | Array + | Array + | Array + | Array + | Array + | Array + | Array; + /** * Allocates a new Buffer for a fixed size bytes. If fill is undefined, the Buffer will be zero-filled. * @@ -158,8 +186,8 @@ declare namespace buffer { /** * Creates and initializes a Buffer instance of the specified length. * - * @param { number } size - Size of the Buffer instance to create, in bytes. - * @param { string | Buffer | number } [fill] - Value to be filled in the buffer. The default value is 0. + * @param { int } size - Size of the Buffer instance to create, in bytes. + * @param { string | Buffer | int | double | long } [fill] - Value to be filled in the buffer. The default value is 0. * @param { BufferEncoding } [encoding] - Encoding format (valid only when fill is a string). The default value is 'utf8'. * @returns { Buffer } Return a new allocated Buffer * @throws { BusinessError } 401 - Parameter error. Possible causes: @@ -172,7 +200,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - function alloc(size: number, fill?: string | Buffer | number, encoding?: BufferEncoding): Buffer; + function alloc(size: int, fill?: string | Buffer | int | double | long, encoding?: BufferEncoding): Buffer; /** * Allocates a new Buffer for a fixed size bytes. The Buffer will not be initially filled. @@ -204,7 +232,7 @@ declare namespace buffer { * Creates a Buffer instance of the specified size from the buffer pool, without initializing it. * You need to use fill() to initialize the Buffer instance created. * - * @param { number } size - Size of the Buffer instance to create, in bytes. + * @param { int } size - Size of the Buffer instance to create, in bytes. * @returns { Buffer } Return a new allocated Buffer * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; @@ -216,7 +244,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - function allocUninitializedFromPool(size: number): Buffer; + function allocUninitializedFromPool(size: int): Buffer; /** * Allocates a new un-pooled Buffer for a fixed size bytes. The Buffer will not be initially filled. @@ -246,7 +274,7 @@ declare namespace buffer { /** * Creates a Buffer instance of the specified size, without initializing it. * - * @param { number } size - Size of the Buffer instance to create, in bytes. + * @param { int } size - Size of the Buffer instance to create, in bytes. * @returns { Buffer } Return a new allocated Buffer * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; @@ -258,7 +286,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - function allocUninitialized(size: number): Buffer; + function allocUninitialized(size: int): Buffer; /** * Returns the byte length of a string when encoded using `encoding`. @@ -313,7 +341,7 @@ declare namespace buffer { * * @param { string | Buffer | TypedArray | DataView | ArrayBuffer } doc - Target string. * @param { BufferEncoding } [encoding] - Encoding format of the string. The default value is 'utf8'. - * @returns { number } The number of bytes contained within `string` + * @returns { int } The number of bytes contained within `string` * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice @@ -323,7 +351,7 @@ declare namespace buffer { function byteLength( doc: string | Buffer | TypedArray | DataView | ArrayBuffer, encoding?: BufferEncoding - ): number; + ): int; /** * Returns a new `Buffer` which is the result of concatenating all the `Buffer`instances in the `list` together. @@ -358,7 +386,7 @@ declare namespace buffer { * Concatenates an array of Buffer instances of the specified length into a new instance. * * @param { Buffer[] | Uint8Array[] } list - Array of instances to concatenate. - * @param { number } [totalLength] - Total length of bytes to be copied. The default value is 0. + * @param { int } [totalLength] - Total length of bytes to be copied. The default value is 0. * @returns { Buffer } Return a new allocated Buffer * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; @@ -371,7 +399,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - function concat(list: Buffer[] | Uint8Array[], totalLength?: number): Buffer; + function concat(list: Buffer[] | Uint8Array[], totalLength?: int): Buffer; /** * Allocates a new Buffer using an array of bytes in the range 0 – 255. Array entries outside that range will be truncated to fit into it. @@ -399,7 +427,7 @@ declare namespace buffer { /** * Creates a Buffer instance with the specified array. * - * @param { number[] } array - Array to create a Buffer instance. + * @param { double[] } array - Array to create a Buffer instance. * @returns { Buffer } Return a new allocated Buffer * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; @@ -407,10 +435,9 @@ declare namespace buffer { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ - function from(array: number[]): Buffer; + function from(array: double[]): Buffer; /** * This creates a view of the ArrayBuffer without copying the underlying memory. @@ -465,23 +492,6 @@ declare namespace buffer { */ function from(arrayBuffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): Buffer; - /** - * This creates a view of the ArrayBuffer without copying the underlying memory. - * - * @param { ArrayBuffer } arrayBuffer - arrayBuffer arrayBuffer An ArrayBuffer, - * @param { number } [byteOffset] - byteOffset [byteOffset = 0] Index of first byte to expose - * @param { number } [length] - length [length = arrayBuffer.byteLength - byteOffset] Number of bytes to expose - * @returns { Buffer } Return a view of the ArrayBuffer - * @throws { BusinessError } 10200001 - The value of "[byteOffset/length]" is out of range. - * It must be >= [left range] and <= [right range]. Received value is: [byteOffset/length] - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - function from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer; - /** * Copies the passed buffer data onto a new Buffer instance. * @@ -516,8 +526,7 @@ declare namespace buffer { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ function from(buffer: Buffer | Uint8Array): Buffer; @@ -553,8 +562,8 @@ declare namespace buffer { * Creates a Buffer instance based on the specified object. * * @param { Object } object - Object that supports Symbol.toPrimitive or valueOf(). - * @param { number | string } offsetOrEncoding - Byte offset or encoding format. - * @param { number } length - Length of the Buffer instance to create, in bytes. + * @param { int | string } offsetOrEncoding - Byte offset or encoding format. + * @param { int } length - Length of the Buffer instance to create, in bytes. * @returns { Buffer } Return a new allocated Buffer * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; @@ -562,10 +571,9 @@ declare namespace buffer { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ - function from(object: Object, offsetOrEncoding: number | string, length: number): Buffer; + function from(object: Object, offsetOrEncoding: int | string, length: int): Buffer; /** * Creates a new Buffer containing string. The encoding parameter identifies the character encoding @@ -605,11 +613,96 @@ declare namespace buffer { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ function from(string: String, encoding?: BufferEncoding): Buffer; + /** + * Creates a Buffer instance with the specified array. + * + * @param { double[] } array - Array to create a Buffer instance. + * @returns { Buffer } Return a new allocated Buffer + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function fromWithArray(array: double[]): Buffer; + + /** + * This creates a view of the ArrayBuffer without copying the underlying memory. + * + * @param { ArrayBuffer } arrayBuffer - arrayBuffer arrayBuffer An ArrayBuffer, + * @param { int } [byteOffset] - byteOffset [byteOffset = 0] Index of first byte to expose + * @param { int } [length] - length [length = arrayBuffer.byteLength - byteOffset] Number of bytes to expose + * @returns { Buffer } Return a view of the ArrayBuffer + * @throws { BusinessError } 10200001 - The value of "[byteOffset/length]" is out of range. + * It must be >= [left range] and <= [right range]. Received value is: [byteOffset/length] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function fromWithArrayBufferByteOffsetLength(arrayBuffer: ArrayBuffer, byteOffset?: int, length?: int): Buffer; + + /** + * Copies the data of a passed Buffer instance to create a new Buffer instance and returns the new one. + * + * @param { Buffer | Uint8Array } buffer - Buffer or Uint8Array instance. + * @returns { Buffer } Return a new allocated Buffer + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function fromWithBuffer(buffer: Buffer | Uint8Array): Buffer; + + /** + * Creates a Buffer instance based on the specified object. + * + * @param { Object } input - Object that supports Symbol.toPrimitive or valueOf(). + * @param { int | string } offsetOrEncoding - Byte offset or encoding format. + * @param { int } length - Length of the Buffer instance to create, in bytes. + * @returns { Buffer } Return a new allocated Buffer + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function fromWithObjectTypedInputOffsetOrEncodingLength(input: Object, offsetOrEncoding: int | string, length: int): Buffer; + + /** + * Creates a Buffer instance based on various types. + * + * @param { string } input - string. + * @param { BufferEncoding } [encoding] - Encoding format of the string. The default value is 'utf8'. + * @returns { Buffer } Return a new Buffer containing string + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function fromWithStringTypedInputEncoding(input: string, encoding?: BufferEncoding): Buffer; + + /** + * Creates a Buffer instance based on a string in the given encoding format. + * + * @overload { fromWithArray, fromWithArrayBufferByteOffsetLength, fromWithBuffer, + fromWithObjectTypedInputOffsetOrEncodingLength, fromWithStringTypedInputEncoding } + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + export overload from { fromWithArray, fromWithArrayBufferByteOffsetLength, fromWithBuffer, + fromWithObjectTypedInputOffsetOrEncodingLength, fromWithStringTypedInputEncoding } + /** * Returns true if obj is a Buffer, false otherwise * @@ -722,7 +815,7 @@ declare namespace buffer { * * @param { Buffer | Uint8Array } buf1 - buf1 buf1 A Buffer or Uint8Array instance. * @param { Buffer | Uint8Array } buf2 - buf2 buf2 A Buffer or Uint8Array instance. - * @returns { number } 0 is returned if target is the same as buf + * @returns { int } 0 is returned if target is the same as buf * 1 is returned if target should come before buf when sorted. * -1 is returned if target should come after buf when sorted. * @syscap SystemCapability.Utils.Lang @@ -731,7 +824,7 @@ declare namespace buffer { * @since 20 * @arkts 1.2 */ - function compare(buf1: Buffer | Uint8Array, buf2: Buffer | Uint8Array): number; + function compare(buf1: Buffer | Uint8Array, buf2: Buffer | Uint8Array): int; /** * Re-encodes the given Buffer or Uint8Array instance from one character encoding to another. @@ -834,14 +927,14 @@ declare namespace buffer { /** * Gets the element number of the buffer. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * The underlying ArrayBuffer object based on which this Buffer object is created. @@ -917,7 +1010,7 @@ declare namespace buffer { /** * The byteOffset of the Buffers underlying ArrayBuffer object * - * @type { number } + * @type { int } * @throws { BusinessError } 10200013 - ByteOffset cannot be set for the buffer that has only a getter. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -925,7 +1018,7 @@ declare namespace buffer { * @since 20 * @arkts 1.2 */ - get byteOffset(): number; + get byteOffset(): int; /** * Fills buf with the specified value. If the offset and end are not given, the entire buf will be filled. @@ -961,9 +1054,9 @@ declare namespace buffer { /** * Fills this Buffer instance at the specified position. By default, data is filled cyclically. * - * @param { string | Buffer | Uint8Array | number } value - Value to fill. - * @param { number } [offset] - Offset to the start position in this Buffer instance where data is filled. The default value is 0. - * @param { number } [end] - Offset to the end position in this Buffer instance (not inclusive). The default value is the length of this Buffer instance. + * @param { string | Buffer | Uint8Array | int | double | long } value - Value to fill. + * @param { int } [offset] - Offset to the start position in this Buffer instance where data is filled. The default value is 0. + * @param { int } [end] - Offset to the end position in this Buffer instance (not inclusive). The default value is the length of this Buffer instance. * @param { BufferEncoding } [encoding] - Encoding format (valid only when value is a string). The default value is 'utf8'. * @returns { Buffer } A reference to buf * @throws { BusinessError } 10200001 - The value of "[offset/end]" is out of range. It must be >= 0 and <= [right range]. Received value is: [offset/end] @@ -977,9 +1070,9 @@ declare namespace buffer { * @arkts 1.1&1.2 */ fill( - value: string | Buffer | Uint8Array | number, - offset?: number, - end?: number, + value: string | Buffer | Uint8Array | int | double | long, + offset?: int, + end?: int, encoding?: BufferEncoding ): Buffer; @@ -1059,11 +1152,11 @@ declare namespace buffer { * or is the same as target in sort order. Comparison is based on the actual sequence of bytes in each Buffer. * * @param { Buffer | Uint8Array } target - target target A Buffer or Uint8Array with which to compare buf - * @param { number } [targetStart] - targetStart [targetStart = 0] The offset within target at which to begin comparison - * @param { number } [targetEnd] - targetEnd [targetEnd = target.length] The offset within target at which to end comparison (not inclusive) - * @param { number } [sourceStart] - sourceStart [sourceStart = 0] The offset within buf at which to begin comparison - * @param { number } [sourceEnd] - sourceEnd [sourceEnd = buf.length] The offset within buf at which to end comparison (not inclusive) - * @returns { number } number is returned if target is the same as buf + * @param { int } [targetStart] - targetStart [targetStart = 0] The offset within target at which to begin comparison + * @param { int } [targetEnd] - targetEnd [targetEnd = target.length] The offset within target at which to end comparison (not inclusive) + * @param { int } [sourceStart] - sourceStart [sourceStart = 0] The offset within buf at which to begin comparison + * @param { int } [sourceEnd] - sourceEnd [sourceEnd = buf.length] The offset within buf at which to end comparison (not inclusive) + * @returns { int } number is returned if target is the same as buf * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types. @@ -1077,11 +1170,11 @@ declare namespace buffer { */ compare( target: Buffer | Uint8Array, - targetStart?: number, - targetEnd?: number, - sourceStart?: number, - sourceEnd?: number - ): number; + targetStart?: int, + targetEnd?: int, + sourceStart?: int, + sourceEnd?: int + ): int; /** * Copies data from a region of buf to a region in target, even if the target memory region overlaps with buf. @@ -1122,11 +1215,11 @@ declare namespace buffer { * Copies data at the specified position in this Buffer instance to the specified position in another Buffer instance. * * @param { Buffer | Uint8Array } target - Instance to which data is copied. - * @param { number } [targetStart] - Offset to the start position in the target instance where data is copied. The default value is 0. - * @param { number } [sourceStart] - Offset to the start position in this Buffer instance where data is copied. The default value is 0. - * @param { number } [sourceEnd] - Offset to the end position in this Buffer instance (not inclusive). + * @param { int } [targetStart] - Offset to the start position in the target instance where data is copied. The default value is 0. + * @param { int } [sourceStart] - Offset to the start position in this Buffer instance where data is copied. The default value is 0. + * @param { int } [sourceEnd] - Offset to the end position in this Buffer instance (not inclusive). * The default value is the length of this Buffer instance. - * @returns { number } The number of bytes copied + * @returns { int } The number of bytes copied * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types. @@ -1138,7 +1231,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - copy(target: Buffer | Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; + copy(target: Buffer | Uint8Array, targetStart?: int, sourceStart?: int, sourceEnd?: int): int; /** * Returns true if both buf and otherBuffer have exactly the same bytes, false otherwise @@ -1205,8 +1298,8 @@ declare namespace buffer { /** * Checks whether this Buffer instance contains the specified value. * - * @param { string | number | Buffer | Uint8Array } value - Value to match. - * @param { number } [byteOffset] - Number of bytes to skip before starting to check data. + * @param { string | int | double | long | Buffer | Uint8Array } value - Value to match. + * @param { int } [byteOffset] - Number of bytes to skip before starting to check data. * Number of bytes to skip before starting to check data. If the offset is a negative number, * data is checked from the end of the Buffer instance. The default value is 0. * @param { BufferEncoding } [encoding] - Encoding format (valid only when value is a string). The default value is 'utf8'. @@ -1220,7 +1313,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - includes(value: string | number | Buffer | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): boolean; + includes(value: string | int | double | long | Buffer | Uint8Array, byteOffset?: int, encoding?: BufferEncoding): boolean; /** * The index of the first occurrence of value in buf @@ -1254,11 +1347,11 @@ declare namespace buffer { /** * Obtains the index of the first occurrence of the specified value in this Buffer instance. * - * @param { string | number | Buffer | Uint8Array } value - Value to match. - * @param { number } [byteOffset] - Number of bytes to skip before starting to check data. + * @param { string | int | double | long | Buffer | Uint8Array } value - Value to match. + * @param { int } [byteOffset] - Number of bytes to skip before starting to check data. * If the offset is a negative number, data is checked from the end of the Buffer instance. The default value is 0. * @param { BufferEncoding } [encoding] - Encoding format (valid only when value is a string). The default value is 'utf8'. - * @returns { number } The index of the first occurrence of value in buf, or -1 if buf does not contain value + * @returns { int } The index of the first occurrence of value in buf, or -1 if buf does not contain value * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types. @@ -1268,7 +1361,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - indexOf(value: string | number | Buffer | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number; + indexOf(value: string | int | double | long | Buffer | Uint8Array, byteOffset?: int, encoding?: BufferEncoding): int; /** * Creates and returns an iterator of buf keys (indices). @@ -1288,14 +1381,14 @@ declare namespace buffer { /** * Creates and returns an iterator that contains the keys of this Buffer instance. * - * @returns { IterableIterator } + * @returns { IterableIterator } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - keys(): IterableIterator; + keys(): IterableIterator; /** * Creates and returns an iterator for buf values (bytes). @@ -1315,14 +1408,14 @@ declare namespace buffer { /** * Creates and returns an iterator that contains the values of this Buffer instance. * - * @returns { IterableIterator } + * @returns { IterableIterator } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - values(): IterableIterator; + values(): IterableIterator; /** * Creates and returns an iterator of [index, byte] pairs from the contents of buf. @@ -1342,14 +1435,14 @@ declare namespace buffer { /** * Creates and returns an iterator that contains key-value pairs of this Buffer instance. * - * @returns { IterableIterator<[number, number]> } + * @returns { IterableIterator<[int, long]> } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - entries(): IterableIterator<[number, number]>; + entries(): IterableIterator<[int, long]>; /** * The index of the last occurrence of value in buf @@ -1385,12 +1478,12 @@ declare namespace buffer { /** * Obtains the index of the last occurrence of the specified value in this Buffer instance. * - * @param { string | number | Buffer | Uint8Array } value - Value to match. - * @param { number } [byteOffset] - Number of bytes to skip before starting to check data. + * @param { string | int | double | long | Buffer | Uint8Array } value - Value to match. + * @param { int } [byteOffset] - Number of bytes to skip before starting to check data. * If the offset is a negative number, data is checked from the end of the Buffer instance. * The default value is the length of this Buffer instance. * @param { BufferEncoding } [encoding] - Encoding format (valid only when value is a string). The default value is 'utf8'. - * @returns { number } The index of the last occurrence of value in buf, or -1 if buf does not contain value + * @returns { int } The index of the last occurrence of value in buf, or -1 if buf does not contain value * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types. @@ -1400,7 +1493,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - lastIndexOf(value: string | number | Buffer | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number; + lastIndexOf(value: string | int | double | long | Buffer | Uint8Array, byteOffset?: int, encoding?: BufferEncoding): int; /** * Reads a signed, big-endian 64-bit integer from buf at the specified offset @@ -1426,7 +1519,7 @@ declare namespace buffer { /** * Reads a 64-bit, big-endian, signed big integer from this Buffer instance at the specified offset. * - * @param { number } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 8]. + * @param { int } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 8]. * @returns { bigint } Return a signed, big-endian 64-bit integer * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] @@ -1436,7 +1529,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - readBigInt64BE(offset?: number): bigint; + readBigInt64BE(offset?: int): bigint; /** * Reads a signed, little-endian 64-bit integer from buf at the specified offset @@ -1462,7 +1555,7 @@ declare namespace buffer { /** * Reads a 64-bit, little-endian, signed big integer from this Buffer instance at the specified offset. * - * @param { number } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 8]. + * @param { int } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 8]. * @returns { bigint } Return a signed, little-endian 64-bit integer * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] @@ -1472,7 +1565,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - readBigInt64LE(offset?: number): bigint; + readBigInt64LE(offset?: int): bigint; /** * Reads a unsigned, big-endian 64-bit integer from buf at the specified offset @@ -1498,7 +1591,7 @@ declare namespace buffer { /** * Reads a 64-bit, big-endian, unsigned big integer from this Buffer instance at the specified offset. * - * @param { number } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 8]. + * @param { int } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 8]. * @returns { bigint } Return a unsigned, big-endian 64-bit integer * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] @@ -1508,7 +1601,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - readBigUInt64BE(offset?: number): bigint; + readBigUInt64BE(offset?: int): bigint; /** * Reads a unsigned, little-endian 64-bit integer from buf at the specified offset @@ -1534,7 +1627,7 @@ declare namespace buffer { /** * Reads a 64-bit, little-endian, unsigned big integer from this Buffer instance at the specified offset. * - * @param { number } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 8]. + * @param { int } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 8]. * @returns { bigint } Return a unsigned, little-endian 64-bit integer * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] @@ -1544,7 +1637,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - readBigUInt64LE(offset?: number): bigint; + readBigUInt64LE(offset?: int): bigint; /** * Reads a 64-bit, big-endian double from buf at the specified offset @@ -1570,8 +1663,8 @@ declare namespace buffer { /** * Reads a 64-bit, big-endian, double-precision floating-point number from this Buffer instance at the specified offset. * - * @param { number } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 8]. - * @returns { number } Return a 64-bit, big-endian double + * @param { int } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 8]. + * @returns { double } Return a 64-bit, big-endian double * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] * @syscap SystemCapability.Utils.Lang @@ -1580,7 +1673,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - readDoubleBE(offset?: number): number; + readDoubleBE(offset?: int): double; /** * Reads a 64-bit, little-endian double from buf at the specified offset @@ -1606,8 +1699,8 @@ declare namespace buffer { /** * Reads a 64-bit, little-endian, double-precision floating-point number from this Buffer instance at the specified offset. * - * @param { number } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 8]. - * @returns { number } Return a 64-bit, little-endian double + * @param { int } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 8]. + * @returns { double } Return a 64-bit, little-endian double * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] * @syscap SystemCapability.Utils.Lang @@ -1616,7 +1709,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - readDoubleLE(offset?: number): number; + readDoubleLE(offset?: int): double; /** * Reads a 32-bit, big-endian float from buf at the specified offset @@ -1642,8 +1735,8 @@ declare namespace buffer { /** * Reads a 32-bit, big-endian, single-precision floating-point number from this Buffer instance at the specified offset. * - * @param { number } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 4]. - * @returns { number } Return a 32-bit, big-endian float + * @param { int } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 4]. + * @returns { double } Return a 32-bit, big-endian float * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] * @syscap SystemCapability.Utils.Lang @@ -1652,7 +1745,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - readFloatBE(offset?: number): number; + readFloatBE(offset?: int): double; /** * Reads a 32-bit, little-endian float from buf at the specified offset @@ -1678,8 +1771,8 @@ declare namespace buffer { /** * Reads a 32-bit, little-endian, single-precision floating-point number from this Buffer instance at the specified offset. * - * @param { number } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 4]. - * @returns { number } Return a 32-bit, little-endian float + * @param { int } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 4]. + * @returns { double } Return a 32-bit, little-endian float * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] * @syscap SystemCapability.Utils.Lang @@ -1688,7 +1781,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - readFloatLE(offset?: number): number; + readFloatLE(offset?: int): double; /** * Reads a signed 8-bit integer from buf at the specified offset @@ -1714,8 +1807,8 @@ declare namespace buffer { /** * Reads an 8-bit signed integer from this Buffer instance at the specified offset. * - * @param { number } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 1]. - * @returns { number } Return a signed 8-bit integer + * @param { int } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 1]. + * @returns { long } Return a signed 8-bit integer * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 1. Received value is: [offset] * @syscap SystemCapability.Utils.Lang @@ -1724,7 +1817,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - readInt8(offset?: number): number; + readInt8(offset?: int): long; /** * Reads a signed, big-endian 16-bit integer from buf at the specified offset @@ -1750,8 +1843,8 @@ declare namespace buffer { /** * Reads a 16-bit, big-endian, signed integer from this Buffer instance at the specified offset. * - * @param { number } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 2]. - * @returns { number } Return a signed, big-endian 16-bit integer + * @param { int } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 2]. + * @returns { long } Return a signed, big-endian 16-bit integer * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] * @syscap SystemCapability.Utils.Lang @@ -1760,7 +1853,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - readInt16BE(offset?: number): number; + readInt16BE(offset?: int): long; /** * Reads a signed, little-endian 16-bit integer from buf at the specified offset @@ -1786,8 +1879,8 @@ declare namespace buffer { /** * Reads a 16-bit, little-endian, signed integer from this Buffer instance at the specified offset. * - * @param { number } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 2]. - * @returns { number } Return a signed, little-endian 16-bit integer + * @param { int } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 2]. + * @returns { long } Return a signed, little-endian 16-bit integer * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] * @syscap SystemCapability.Utils.Lang @@ -1796,7 +1889,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - readInt16LE(offset?: number): number; + readInt16LE(offset?: int): long; /** * Reads a signed, big-endian 32-bit integer from buf at the specified offset @@ -1822,8 +1915,8 @@ declare namespace buffer { /** * Reads a 32-bit, big-endian, signed integer from this Buffer instance at the specified offset. * - * @param { number } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 4]. - * @returns { number } Return a signed, big-endian 32-bit integer + * @param { int } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 4]. + * @returns { long } Return a signed, big-endian 32-bit integer * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] * @syscap SystemCapability.Utils.Lang @@ -1832,7 +1925,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - readInt32BE(offset?: number): number; + readInt32BE(offset?: int): long; /** * Reads a signed, little-endian 32-bit integer from buf at the specified offset @@ -1858,8 +1951,8 @@ declare namespace buffer { /** * Reads a 32-bit, little-endian, signed integer from this Buffer instance at the specified offset. * - * @param { number } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 4]. - * @returns { number } Return a signed, little-endian 32-bit integer + * @param { int } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 4]. + * @returns { long } Return a signed, little-endian 32-bit integer * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] * @syscap SystemCapability.Utils.Lang @@ -1868,7 +1961,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - readInt32LE(offset?: number): number; + readInt32LE(offset?: int): long; /** * Reads byteLength number of bytes from buf at the specified offset and interprets the result as a big-endian, @@ -1904,10 +1997,10 @@ declare namespace buffer { * Reads the specified number of bytes from this Buffer instance at the specified offset, and interprets the result as a big-endian, * two's complement signed value that supports up to 48 bits of precision. * - * @param { number } offset - Number of bytes to skip before starting to read data. + * @param { int } offset - Number of bytes to skip before starting to read data. * The default value is 0. The value range is [0, Buffer.length - byteLength]. - * @param { number } byteLength - Number of bytes to read. The value range is [1, 6]. - * @returns { number } + * @param { int } byteLength - Number of bytes to read. The value range is [1, 6]. + * @returns { long } * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types. @@ -1918,7 +2011,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - readIntBE(offset: number, byteLength: number): number; + readIntBE(offset: int, byteLength: int): long; /** * Reads byteLength number of bytes from buf at the specified offset and interprets the result as a little-endian, @@ -1954,10 +2047,10 @@ declare namespace buffer { * Reads the specified number of bytes from this Buffer instance at the specified offset and interprets the result as a little-endian, * two's complement signed value that supports up to 48 bits of precision. * - * @param { number } offset - Number of bytes to skip before starting to read data. + * @param { int } offset - Number of bytes to skip before starting to read data. * The default value is 0. The value range is [0, Buffer.length - byteLength]. - * @param { number } byteLength - Number of bytes to read. The value range is [1, 6]. - * @returns { number } + * @param { int } byteLength - Number of bytes to read. The value range is [1, 6]. + * @returns { long } * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types. @@ -1968,7 +2061,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - readIntLE(offset: number, byteLength: number): number; + readIntLE(offset: int, byteLength: int): long; /** * Reads an unsigned 8-bit integer from buf at the specified offset @@ -1994,8 +2087,8 @@ declare namespace buffer { /** * Reads an 8-bit unsigned integer from this Buffer instance at the specified offset. * - * @param { number } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 1]. - * @returns { number } Reads an unsigned 8-bit integer + * @param { int } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 1]. + * @returns { long } Reads an unsigned 8-bit integer * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 1. Received value is: [offset] * @syscap SystemCapability.Utils.Lang @@ -2004,7 +2097,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - readUInt8(offset?: number): number; + readUInt8(offset?: int): long; /** * Reads an unsigned, big-endian 16-bit integer from buf at the specified offset @@ -2030,8 +2123,8 @@ declare namespace buffer { /** * Reads a 16-bit, big-endian, unsigned integer from this Buffer instance at the specified offset. * - * @param { number } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 2]. - * @returns { number } Reads an unsigned, big-endian 16-bit integer + * @param { int } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 2]. + * @returns { long } Reads an unsigned, big-endian 16-bit integer * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] * @syscap SystemCapability.Utils.Lang @@ -2040,7 +2133,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - readUInt16BE(offset?: number): number; + readUInt16BE(offset?: int): long; /** * Reads an unsigned, little-endian 16-bit integer from buf at the specified offset @@ -2066,8 +2159,8 @@ declare namespace buffer { /** * Reads a 16-bit, little-endian, unsigned integer from this Buffer instance at the specified offset. * - * @param { number } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 2]. - * @returns { number } Reads an unsigned, little-endian 16-bit integer + * @param { int } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 2]. + * @returns { long } Reads an unsigned, little-endian 16-bit integer * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] * @syscap SystemCapability.Utils.Lang @@ -2076,7 +2169,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - readUInt16LE(offset?: number): number; + readUInt16LE(offset?: int): long; /** * Reads an unsigned, big-endian 32-bit integer from buf at the specified offset @@ -2102,8 +2195,8 @@ declare namespace buffer { /** * Reads a 32-bit, big-endian, unsigned integer from this Buffer instance at the specified offset. * - * @param { number } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 4]. - * @returns { number } Reads an unsigned, big-endian 32-bit integer + * @param { int } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 4]. + * @returns { long } Reads an unsigned, big-endian 32-bit integer * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] * @syscap SystemCapability.Utils.Lang @@ -2112,7 +2205,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - readUInt32BE(offset?: number): number; + readUInt32BE(offset?: int): long; /** * Reads an unsigned, little-endian 32-bit integer from buf at the specified offset @@ -2138,8 +2231,8 @@ declare namespace buffer { /** * Reads a 32-bit, little-endian, unsigned integer from this Buffer instance at the specified offset. * - * @param { number } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 4]. - * @returns { number } Reads an unsigned, little-endian 32-bit integer + * @param { int } [offset] - Number of bytes to skip before starting to read data. The default value is 0. The value range is [0, Buffer.length - 4]. + * @returns { long } Reads an unsigned, little-endian 32-bit integer * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] * @syscap SystemCapability.Utils.Lang @@ -2148,7 +2241,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - readUInt32LE(offset?: number): number; + readUInt32LE(offset?: int): long; /** * Reads byteLength number of bytes from buf at the specified offset and interprets the result as @@ -2184,10 +2277,10 @@ declare namespace buffer { * Reads the specified number of bytes from this Buffer instance at the specified offset, and interprets the result as an unsigned, * big-endian integer that supports up to 48 bits of precision. * - * @param { number } offset - Number of bytes to skip before starting to read data. + * @param { int } offset - Number of bytes to skip before starting to read data. * The default value is 0. The value range is [0, Buffer.length - byteLength]. - * @param { number } byteLength - Number of bytes to read. The value range is [1, 6]. - * @returns { number } + * @param { int } byteLength - Number of bytes to read. The value range is [1, 6]. + * @returns { long } * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types. @@ -2198,7 +2291,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - readUIntBE(offset: number, byteLength: number): number; + readUIntBE(offset: int, byteLength: int): long; /** * Reads byteLength number of bytes from buf at the specified offset and interprets the result as an unsigned, @@ -2234,10 +2327,10 @@ declare namespace buffer { * Reads the specified number of bytes from this Buffer instance at the specified offset, and interprets the result as an unsigned, * little-endian integer that supports up to 48 bits of precision. * - * @param { number } offset - Number of bytes to skip before starting to read data. + * @param { int } offset - Number of bytes to skip before starting to read data. * The default value is 0. The value range is [0, Buffer.length - byteLength]. - * @param { number } byteLength - Number of bytes to read. The value range is [1, 6]. - * @returns { number } + * @param { int } byteLength - Number of bytes to read. The value range is [1, 6]. + * @returns { long } * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types. @@ -2248,7 +2341,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - readUIntLE(offset: number, byteLength: number): number; + readUIntLE(offset: int, byteLength: int): long; /** * Returns a new Buffer that references the same memory as the original, but offset and cropped by the start and end indices. @@ -2272,8 +2365,8 @@ declare namespace buffer { /** * Truncates this Buffer instance from the specified position to create a new Buffer instance. * - * @param { number } [start] - Offset to the start position in this Buffer instance where data is truncated. The default value is 0. - * @param { number } [end] - Offset to the end position in this Buffer instance (not inclusive). The default value is the length of this Buffer instance. + * @param { int } [start] - Offset to the start position in this Buffer instance where data is truncated. The default value is 0. + * @param { int } [end] - Offset to the end position in this Buffer instance (not inclusive). The default value is the length of this Buffer instance. * @returns { Buffer } Returns a new Buffer that references the same memory as the original * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -2281,7 +2374,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - subarray(start?: number, end?: number): Buffer; + subarray(start?: int, end?: int): Buffer; /** * Interprets buf as an array of unsigned 16-bit integers and swaps the byte order in-place. @@ -2398,6 +2491,18 @@ declare namespace buffer { * @since 11 */ toJSON(): Object; + + /** + * Converts this Buffer instance into a JsonElement. + * + * @returns { jsonx.JsonElement } A new JsonElement containing the Buffer + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + toJSON(): jsonx.JsonElement; /** * Decodes buf to a string according to the specified character encoding in encoding @@ -2441,8 +2546,8 @@ declare namespace buffer { * Decodes buf to a string according to the specified character encoding in encoding * * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] The character encoding to use - * @param { number } [start] - start [start = 0] The byte offset to start decoding at - * @param { number } [end] - end [end = buf.length] The byte offset to stop decoding at (not inclusive) + * @param { int } [start] - start [start = 0] The byte offset to start decoding at + * @param { int } [end] - end [end = buf.length] The byte offset to stop decoding at (not inclusive) * @returns { string } * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -2450,7 +2555,7 @@ declare namespace buffer { * @since 20 * @arkts 1.2 */ - toString(encoding?: BufferEncoding, start?: number, end?: number): string; + toString(encoding?: BufferEncoding, start?: int, end?: int): string; /** * Writes string to buf at offset according to the character encoding in encoding @@ -2487,10 +2592,10 @@ declare namespace buffer { * Writes a string of the specified length to this Buffer instance at the specified position in the given encoding format. * * @param { string } str - String to write. - * @param { number } [offset] - Number of bytes to skip before starting to write data. The default value is 0. - * @param { number } [length] - Maximum number of bytes to write. The default value is Buffer.length minus offset. + * @param { int } [offset] - Number of bytes to skip before starting to write data. The default value is 0. + * @param { int } [length] - Maximum number of bytes to write. The default value is Buffer.length minus offset. * @param { string } [encoding] - Encoding format of the string. The default value is 'utf8'. - * @returns { number } Number of bytes written. + * @returns { int } Number of bytes written. * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types. @@ -2501,7 +2606,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - write(str: string, offset?: number, length?: number, encoding?: string): number; + write(str: string, offset?: int, length?: int, encoding?: string): int; /** * Writes value to buf at the specified offset as big-endian. @@ -2535,8 +2640,8 @@ declare namespace buffer { * Writes a 64-bit, big-endian, signed big integer to this Buffer instance at the specified offset. * * @param { bigint } value - Data to write. - * @param { number } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 8]. - * @returns { number } offset plus the number of bytes written + * @param { int } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 8]. + * @returns { int } offset plus the number of bytes written * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types; @@ -2548,7 +2653,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - writeBigInt64BE(value: bigint, offset?: number): number; + writeBigInt64BE(value: bigint, offset?: int): int; /** * Writes value to buf at the specified offset as little-endian. @@ -2583,8 +2688,8 @@ declare namespace buffer { * Writes a 64-bit, little-endian, signed big integer to this Buffer instance at the specified offset. * * @param { bigint } value - Data to write. - * @param { number } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 8]. - * @returns { number } offset plus the number of bytes written + * @param { int } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 8]. + * @returns { int } offset plus the number of bytes written * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types; @@ -2596,7 +2701,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - writeBigInt64LE(value: bigint, offset?: number): number; + writeBigInt64LE(value: bigint, offset?: int): int; /** * Writes value to buf at the specified offset as big-endian. @@ -2631,8 +2736,8 @@ declare namespace buffer { * Writes a 64-bit, big-endian, unsigned big integer to this Buffer instance at the specified offset. * * @param { bigint } value - Data to write. - * @param { number } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 8]. - * @returns { number } offset plus the number of bytes written + * @param { int } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 8]. + * @returns { int } offset plus the number of bytes written * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types; @@ -2644,7 +2749,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - writeBigUInt64BE(value: bigint, offset?: number): number; + writeBigUInt64BE(value: bigint, offset?: int): int; /** * Writes value to buf at the specified offset as little-endian. @@ -2679,8 +2784,8 @@ declare namespace buffer { * Writes a 64-bit, little-endian, unsigned big integer to this Buffer instance at the specified offset. * * @param { bigint } value - Data to write. - * @param { number } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 8]. - * @returns { number } offset plus the number of bytes written + * @param { int } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 8]. + * @returns { int } offset plus the number of bytes written * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types; @@ -2692,7 +2797,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - writeBigUInt64LE(value: bigint, offset?: number): number; + writeBigUInt64LE(value: bigint, offset?: int): int; /** * Writes value to buf at the specified offset as big-endian. @@ -2724,9 +2829,9 @@ declare namespace buffer { /** * Writes a 64-bit, big-endian, double-precision floating-point number to this Buffer instance at the specified offset. * - * @param { number } value - Data to write. - * @param { number } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 8]. - * @returns { number } offset plus the number of bytes written + * @param { double } value - Data to write. + * @param { int } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 8]. + * @returns { int } offset plus the number of bytes written * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types. @@ -2737,7 +2842,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - writeDoubleBE(value: number, offset?: number): number; + writeDoubleBE(value: double, offset?: int): int; /** * Writes value to buf at the specified offset as little-endian. @@ -2769,9 +2874,9 @@ declare namespace buffer { /** * Writes a 64-bit, little-endian, double-precision floating-point number to this Buffer instance at the specified offset. * - * @param { number } value - Data to write. - * @param { number } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 8]. - * @returns { number } offset plus the number of bytes written + * @param { double } value - Data to write. + * @param { int } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 8]. + * @returns { int } offset plus the number of bytes written * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types. @@ -2782,7 +2887,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - writeDoubleLE(value: number, offset?: number): number; + writeDoubleLE(value: double, offset?: int): int; /** * Writes value to buf at the specified offset as big-endian. @@ -2814,9 +2919,9 @@ declare namespace buffer { /** * Writes a 32-bit, big-endian, single-precision floating-point number to this Buffer instance at the specified offset. * - * @param { number } value - Data to write. - * @param { number } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 4]. - * @returns { number } offset plus the number of bytes written + * @param { double } value - Data to write. + * @param { int } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 4]. + * @returns { int } offset plus the number of bytes written * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types. @@ -2827,7 +2932,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - writeFloatBE(value: number, offset?: number): number; + writeFloatBE(value: double, offset?: int): int; /** * Writes value to buf at the specified offset as little-endian. @@ -2859,9 +2964,9 @@ declare namespace buffer { /** * Writes a 32-bit, little-endian, single-precision floating-point number to this Buffer instance at the specified offset. * - * @param { number } value - Data to write. - * @param { number } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 4]. - * @returns { number } offset plus the number of bytes written + * @param { double } value - Data to write. + * @param { int } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 4]. + * @returns { int } offset plus the number of bytes written * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types. @@ -2872,7 +2977,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - writeFloatLE(value: number, offset?: number): number; + writeFloatLE(value: double, offset?: int): int; /** * Writes value to buf at the specified offset. value must be a valid signed 8-bit integer. @@ -2906,9 +3011,9 @@ declare namespace buffer { /** * Writes an 8-bit signed integer to this Buffer instance at the specified offset. * - * @param { number } value - Data to write. - * @param { number } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 1]. - * @returns { number } offset plus the number of bytes written + * @param { long } value - Data to write. + * @param { int } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 1]. + * @returns { int } offset plus the number of bytes written * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types; @@ -2920,7 +3025,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - writeInt8(value: number, offset?: number): number; + writeInt8(value: long, offset?: int): int; /** * Writes value to buf at the specified offset as big-endian. The value must be a valid signed 16-bit integer @@ -2954,9 +3059,9 @@ declare namespace buffer { /** * Writes a 16-bit, big-endian, signed integer to this Buffer instance at the specified offset. * - * @param { number } value - Data to write. - * @param { number } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 2]. - * @returns { number } offset plus the number of bytes written + * @param { long } value - Data to write. + * @param { int } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 2]. + * @returns { int } offset plus the number of bytes written * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types; @@ -2968,7 +3073,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - writeInt16BE(value: number, offset?: number): number; + writeInt16BE(value: long, offset?: int): int; /** * Writes value to buf at the specified offset as little-endian. The value must be a valid signed 16-bit integer @@ -3002,9 +3107,9 @@ declare namespace buffer { /** * Writes a 16-bit, little-endian, signed integer to this Buffer instance at the specified offset. * - * @param { number } value - Data to write. - * @param { number } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 2]. - * @returns { number } offset plus the number of bytes written + * @param { long } value - Data to write. + * @param { int } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 2]. + * @returns { int } offset plus the number of bytes written * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types; @@ -3016,7 +3121,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - writeInt16LE(value: number, offset?: number): number; + writeInt16LE(value: long, offset?: int): int; /** * Writes value to buf at the specified offset as big-endian. The value must be a valid signed 32-bit integer. @@ -3050,9 +3155,9 @@ declare namespace buffer { /** * Writes a 32-bit, big-endian, signed integer to this Buffer instance at the specified offset. * - * @param { number } value - Data to write. - * @param { number } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 4]. - * @returns { number } offset plus the number of bytes written + * @param { long } value - Data to write. + * @param { int } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 4]. + * @returns { int } offset plus the number of bytes written * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types; @@ -3064,7 +3169,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - writeInt32BE(value: number, offset?: number): number; + writeInt32BE(value: long, offset?: int): int; /** * Writes value to buf at the specified offset as little-endian. The value must be a valid signed 32-bit integer. @@ -3098,9 +3203,9 @@ declare namespace buffer { /** * Writes a 32-bit, little-endian, signed integer to this Buffer instance at the specified offset. * - * @param { number } value - Data to write. - * @param { number } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 4]. - * @returns { number } offset plus the number of bytes written + * @param { long } value - Data to write. + * @param { int } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 4]. + * @returns { int } offset plus the number of bytes written * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types; @@ -3112,7 +3217,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - writeInt32LE(value: number, offset?: number): number; + writeInt32LE(value: long, offset?: int): int; /** * Writes byteLength bytes of value to buf at the specified offset as big-endian @@ -3147,11 +3252,11 @@ declare namespace buffer { /** * Writes a big-endian signed value of the specified length to this Buffer instance at the specified offset. * - * @param { number } value - Data to write. - * @param { number } offset - Number of bytes to skip before starting to write data. + * @param { long } value - Data to write. + * @param { int } offset - Number of bytes to skip before starting to write data. * The default value is 0. The value range is [0, Buffer.length - byteLength]. - * @param { number } byteLength - Number of bytes to write. - * @returns { number } offset plus the number of bytes written + * @param { int } byteLength - Number of bytes to write. + * @returns { int } offset plus the number of bytes written * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types. @@ -3162,7 +3267,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - writeIntBE(value: number, offset: number, byteLength: number): number; + writeIntBE(value: long, offset: int, byteLength: int): int; /** * Writes byteLength bytes of value to buf at the specified offset as little-endian @@ -3197,11 +3302,11 @@ declare namespace buffer { /** * Writes a little-endian signed value of the specified length to this Buffer instance at the specified offset. * - * @param { number } value - Data to write. - * @param { number } offset - Number of bytes to skip before starting to write data. + * @param { long } value - Data to write. + * @param { int } offset - Number of bytes to skip before starting to write data. * The default value is 0. The value range is [0, Buffer.length - byteLength]. - * @param { number } byteLength - Number of bytes to write. - * @returns { number } offset plus the number of bytes written + * @param { int } byteLength - Number of bytes to write. + * @returns { int } offset plus the number of bytes written * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types. @@ -3212,7 +3317,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - writeIntLE(value: number, offset: number, byteLength: number): number; + writeIntLE(value: long, offset: int, byteLength: int): int; /** * Writes value to buf at the specified offset. value must be a valid unsigned 8-bit integer @@ -3246,9 +3351,9 @@ declare namespace buffer { /** * Writes an 8-bit unsigned integer to this Buffer instance at the specified offset. * - * @param { number } value - Data to write. - * @param { number } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 1]. - * @returns { number } offset plus the number of bytes written + * @param { long } value - Data to write. + * @param { int } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 1]. + * @returns { int } offset plus the number of bytes written * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types; @@ -3260,7 +3365,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - writeUInt8(value: number, offset?: number): number; + writeUInt8(value: long, offset?: int): int; /** * Writes value to buf at the specified offset as big-endian. The value must be a valid unsigned 16-bit integer. @@ -3294,9 +3399,9 @@ declare namespace buffer { /** * Writes a 16-bit, big-endian, unsigned integer to this Buffer instance at the specified offset. * - * @param { number } value - Data to write. - * @param { number } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 2]. - * @returns { number } offset plus the number of bytes written + * @param { long } value - Data to write. + * @param { int } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 2]. + * @returns { int } offset plus the number of bytes written * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types; @@ -3308,7 +3413,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - writeUInt16BE(value: number, offset?: number): number; + writeUInt16BE(value: long, offset?: int): int; /** * Writes value to buf at the specified offset as little-endian. The value must be a valid unsigned 16-bit integer. @@ -3342,9 +3447,9 @@ declare namespace buffer { /** * Writes a 16-bit, little-endian, unsigned integer to this Buffer instance at the specified offset. * - * @param { number } value - Data to write. - * @param { number } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 2]. - * @returns { number } offset plus the number of bytes written + * @param { long } value - Data to write. + * @param { int } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 2]. + * @returns { int } offset plus the number of bytes written * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types; @@ -3356,7 +3461,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - writeUInt16LE(value: number, offset?: number): number; + writeUInt16LE(value: long, offset?: int): int; /** * Writes value to buf at the specified offset as big-endian. The value must be a valid unsigned 32-bit integer. @@ -3390,9 +3495,9 @@ declare namespace buffer { /** * Writes a 32-bit, big-endian, unsigned integer to this Buffer instance at the specified offset. * - * @param { number } value - Data to write. - * @param { number } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 4]. - * @returns { number } offset plus the number of bytes written + * @param { long } value - Data to write. + * @param { int } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 4]. + * @returns { int } offset plus the number of bytes written * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types; @@ -3404,7 +3509,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - writeUInt32BE(value: number, offset?: number): number; + writeUInt32BE(value: long, offset?: int): int; /** * Writes value to buf at the specified offset as little-endian. The value must be a valid unsigned 32-bit integer. @@ -3438,9 +3543,9 @@ declare namespace buffer { /** * Writes a 32-bit, little-endian, unsigned integer to this Buffer instance at the specified offset. * - * @param { number } value - Data to write. - * @param { number } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 4]. - * @returns { number } offset plus the number of bytes written + * @param { long } value - Data to write. + * @param { int } [offset] - Number of bytes to skip before starting to write data. The default value is 0. The value range is [0, Buffer.length - 4]. + * @returns { int } offset plus the number of bytes written * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types; @@ -3452,7 +3557,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - writeUInt32LE(value: number, offset?: number): number; + writeUInt32LE(value: long, offset?: int): int; /** * Writes byteLength bytes of value to buf at the specified offset as big-endian @@ -3487,11 +3592,11 @@ declare namespace buffer { /** * Writes an unsigned big-endian value of the specified length to this Buffer instance at the specified offset. * - * @param { number } value - Data to write. - * @param { number } offset - Number of bytes to skip before starting to write data. + * @param { long } value - Data to write. + * @param { int } offset - Number of bytes to skip before starting to write data. * The default value is 0. The value range is [0, Buffer.length - byteLength]. - * @param { number } byteLength - Number of bytes to write. - * @returns { number } offset plus the number of bytes written + * @param { int } byteLength - Number of bytes to write. + * @returns { int } offset plus the number of bytes written * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types. @@ -3502,7 +3607,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - writeUIntBE(value: number, offset: number, byteLength: number): number; + writeUIntBE(value: long, offset: int, byteLength: int): int; /** * Writes byteLength bytes of value to buf at the specified offset as little-endian @@ -3537,11 +3642,11 @@ declare namespace buffer { /** * Writes an unsigned little-endian value of the specified length to this Buffer instance at the specified offset. * - * @param { number } value - Data to write. - * @param { number } offset - Number of bytes to skip before starting to write data. + * @param { long } value - Data to write. + * @param { int } offset - Number of bytes to skip before starting to write data. * The default value is 0. The value range is [0, Buffer.length - byteLength]. - * @param { number } byteLength - Number of bytes to write. - * @returns { number } offset plus the number of bytes written + * @param { int } byteLength - Number of bytes to write. + * @returns { int } offset plus the number of bytes written * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types. @@ -3552,33 +3657,22 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - writeUIntLE(value: number, offset: number, byteLength: number): number; + writeUIntLE(value: long, offset: int, byteLength: int): int; /** - * Returns the byte at the specified index. + * Returns the item at that index. * - * @param { number } index - byte index to read - * @returns { number | undefined } Returns the byte value at `index` + * @param { int } index - The zero-based index of the desired code unit. + * Throws error if index < 0 or index >= buffer.length. + * @returns { long } The element in the buffer matching the given index. + * @throws { BusinessError } 10200001 - The value of index is out of range. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - $_get(index: number): number | undefined; - - /** - * Sets the byte at the specified index. - * - * @param { number } index – byte index to write - * @param { number } value – byte value (0–255) - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - $_set(index: number, value: number): void; + [index: int]: long; } /** @@ -3688,21 +3782,17 @@ declare namespace buffer { /** * Creates a new Blob object containing a concatenation of the given sources. * - * @param { Array | Array | Array | Array | Array } sources - sources sources An array of string, , - * , , or objects, or any mix of such objects, that will be stored within the Blob + * @param { ArrayUnionType } sources - sources sources ArrayUnionType * @param { BlobOptions } [options] - options options {endings: string, type: string} * endings: One of either 'transparent' or 'native'. * type: The Blob content-type - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified; - * 2.Incorrect parameter types. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - constructor(sources: Array | Array | Array | Array | Array, options?: BlobOptions); + constructor(sources: ArrayUnionType, options?: BlobOptions); /** * The total size of the Blob in bytes @@ -3722,14 +3812,14 @@ declare namespace buffer { /** * Total size of the Blob instance, in bytes. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - size: number; + get size(): int; /** * The content-type of the Blob @@ -3756,7 +3846,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - type: string; + get type(): string; /** * Returns a promise that fulfills with an containing a copy of the Blob data. @@ -3809,8 +3899,8 @@ declare namespace buffer { /** * Creates a Blob instance by copying specified data from this Blob instance. * - * @param { number } [start] - Offset to the start position of the data to copy. The default value is 0. - * @param { number } [end] - Offset to the end position of the data to copy. The default value is the data length in the original Blob instance. + * @param { int } [start] - Offset to the start position of the data to copy. The default value is 0. + * @param { int } [end] - Offset to the end position of the data to copy. The default value is the data length in the original Blob instance. * @param { string } [type] - Type of the data in the new Blob instance. The default value is ''. * @returns { Blob } * @syscap SystemCapability.Utils.Lang @@ -3819,7 +3909,7 @@ declare namespace buffer { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - slice(start?: number, end?: number, type?: string): Blob; + slice(start?: int, end?: int, type?: string): Blob; /** * Returns a promise that fulfills with the contents of the Blob decoded as a UTF-8 string. diff --git a/api/@ohos.uri.d.ts b/api/@ohos.uri.d.ts index 3d5b20ed1f..c0f77d504c 100644 --- a/api/@ohos.uri.d.ts +++ b/api/@ohos.uri.d.ts @@ -301,20 +301,10 @@ declare namespace uri { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ getQueryNames(): string[]; - /** - * Obtains all non-repeated keys in the query component of this URI. - * - * @returns { Array } Return a set of decoded names. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - getQueryNames(): Array; /** * Obtains the values of a given key from the query component of this URI. * @@ -326,22 +316,10 @@ declare namespace uri { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ getQueryValues(key: string): string[]; - - /** - * Obtains the values of a given key from the query component of this URI. - * - * @param { string } key - Key of the URI query parameter. - * @returns { Array } Return a set of decoded values. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - getQueryValues(key: string): Array; /** * Obtains the value of the Boolean type of a query parameter in this URI. * @@ -387,20 +365,10 @@ declare namespace uri { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ getSegment(): string[]; - /** - * Obtains all segments of this URI. - * - * @returns { Array } Return decoded path segments, each without a leading or trailing "/". - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - getSegment(): Array; /** * Encodes a given field, appends it to the path component of this URI to create a new URI, and returns the new URI, * while keeping the existing URI unchanged. @@ -864,7 +832,7 @@ declare namespace uri { * @since 20 * @arkts 1.2 */ - set scheme(input: string | null); + set scheme(input: string); /** * Gets Obtains the user information part of the URI. @@ -888,7 +856,7 @@ declare namespace uri { * @since 20 * @arkts 1.2 */ - set userInfo(input: string | null); + set userInfo(input: string); /** * Gets the hostname portion of the URI without a port. @@ -932,7 +900,7 @@ declare namespace uri { * @since 20 * @arkts 1.2 */ - set path(input: string | null); + set path(input: string); /** * Gets the query portion of the URI @@ -956,7 +924,7 @@ declare namespace uri { * @since 20 * @arkts 1.2 */ - set query(input: string | null); + set query(input: string); /** * Gets the fragment part of the URI. @@ -980,7 +948,7 @@ declare namespace uri { * @since 20 * @arkts 1.2 */ - set fragment(input: string | null); + set fragment(input: string); /** * Gets the decoding permission component part of this URI. @@ -1004,7 +972,7 @@ declare namespace uri { * @since 20 * @arkts 1.2 */ - set authority(input: string | null); + set authority(input: string); /** * Gets the decoding scheme-specific part of the URI. @@ -1028,7 +996,7 @@ declare namespace uri { * @since 20 * @arkts 1.2 */ - set ssp(input: string | null); + set ssp(input: string); /** * Gets Obtains the encoded user information part of the URI. @@ -1051,7 +1019,7 @@ declare namespace uri { * @since 20 * @arkts 1.2 */ - set encodedUserInfo(input: string | null); + set encodedUserInfo(input: string); /** * Gets the encoded path portion of the URI. @@ -1074,7 +1042,7 @@ declare namespace uri { * @since 20 * @arkts 1.2 */ - set encodedPath(input: string | null); + set encodedPath(input: string); /** * Gets the encoded query component from this URI. @@ -1097,7 +1065,7 @@ declare namespace uri { * @since 20 * @arkts 1.2 */ - set encodedQuery(input: string | null); + set encodedQuery(input: string); /** * Gets the encoded fragment part of this URI, everything after the '#'. @@ -1120,7 +1088,7 @@ declare namespace uri { * @since 20 * @arkts 1.2 */ - set encodedFragment(input: string | null); + set encodedFragment(input: string); /** * Gets the encoded authority part of this URI. @@ -1143,7 +1111,7 @@ declare namespace uri { * @since 20 * @arkts 1.2 */ - set encodedAuthority(input: string | null); + set encodedAuthority(input: string); /** * Gets the scheme-specific part of this URI, i.e. everything between the scheme separator ':' and @@ -1169,7 +1137,7 @@ declare namespace uri { * @since 20 * @arkts 1.2 */ - set encodedSSP(input: string | null); + set encodedSSP(input: string); } } export default uri; diff --git a/api/@ohos.url.d.ts b/api/@ohos.url.d.ts index 5f182ed1f2..cf5f6ba71e 100644 --- a/api/@ohos.url.d.ts +++ b/api/@ohos.url.d.ts @@ -429,23 +429,11 @@ declare namespace url { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 11 + * @since arkts {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ getAll(name: string): string[]; - /** - * Obtains all the values based on the specified key. - * - * @param { string } name - Target key. - * @returns { Array } Array Returns all key-value pairs with the specified name. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - getAll(name: string): Array; - /** * Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. * The first item of Array is name, and the second item of Array is value. diff --git a/api/@ohos.util.ArrayList.d.ts b/api/@ohos.util.ArrayList.d.ts index 3ee27aaf42..2224bc38ec 100644 --- a/api/@ohos.util.ArrayList.d.ts +++ b/api/@ohos.util.ArrayList.d.ts @@ -98,14 +98,14 @@ declare class ArrayList { /** * Gets the number of elements in an array list. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Appends the specified element to the end of this arraylist. * @@ -175,7 +175,7 @@ declare class ArrayList { * Inserts an element at the specified position in this container. * * @param { T } element - Target element. - * @param { number } index - Index of the position where the element is to be inserted. + * @param { int } index - Index of the position where the element is to be inserted. * @throws { BusinessError } 10200001 - The value of index is out of range. * @throws { BusinessError } 10200011 - The insert method cannot be bound. * @throws { BusinessError } 401 - Parameter error. Possible causes: @@ -188,7 +188,7 @@ declare class ArrayList { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - insert(element: T, index: number): void; + insert(element: T, index: int): void; /** * Check if arraylist contains the specified element * @@ -246,7 +246,7 @@ declare class ArrayList { * Obtains the index of the first occurrence of the specified element in this container. * * @param { T } element - Target element. - * @returns { number } the number type ,returns the lowest index such that or -1 if there is no such index. + * @returns { int } the number type ,returns the lowest index such that or -1 if there is no such index. * @throws { BusinessError } 10200011 - The getIndexOf method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -254,7 +254,7 @@ declare class ArrayList { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getIndexOf(element: T): number; + getIndexOf(element: T): int; /** * Find the corresponding element according to the index, * delete the element, and move the index of all elements to the right of the element forward by one. @@ -289,7 +289,7 @@ declare class ArrayList { /** * Removes an element with the specified position from this container. * - * @param { number } index - Position index of the target element. + * @param { int } index - Position index of the target element. * @returns { T } the T type ,returns undefined if arraylist is empty,If the index is * @throws { BusinessError } 10200001 - The value of "index" is out of range. * @throws { BusinessError } 10200011 - The removeByIndex method cannot be bound. @@ -303,7 +303,7 @@ declare class ArrayList { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - removeByIndex(index: number): T; + removeByIndex(index: int): T; /** * Removes the first occurrence of the specified element from this arraylist, * if it is present. If the arraylist does not contain the element, it is @@ -365,7 +365,7 @@ declare class ArrayList { * Obtains the index of the last occurrence of the specified element in this container. * * @param { T } element - Target element. - * @returns { number } the number type + * @returns { int } the number type * @throws { BusinessError } 10200011 - The getLastIndexOf method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -373,7 +373,7 @@ declare class ArrayList { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getLastIndexOf(element: T): number; + getLastIndexOf(element: T): int; /** * Removes from this arraylist all of the elements whose index is between fromIndex,inclusive,and toIndex ,exclusive. * @@ -407,8 +407,8 @@ declare class ArrayList { * Removes from this container all of the elements within a range, including the element at the start position but * not that at the end position. * - * @param { number } fromIndex - Index of the start position. - * @param { number } toIndex - Index of the end position. + * @param { int } fromIndex - Index of the start position. + * @param { int } toIndex - Index of the end position. * @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range. * @throws { BusinessError } 10200011 - The removeByRange method cannot be bound. * @throws { BusinessError } 401 - Parameter error. Possible causes: @@ -421,7 +421,7 @@ declare class ArrayList { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - removeByRange(fromIndex: number, toIndex: number): void; + removeByRange(fromIndex: int, toIndex: int): void; /** * Replaces each element of this arraylist with the result of applying the operator to that element. * @@ -474,14 +474,14 @@ declare class ArrayList { /** * Replaces all elements in this container with new elements, and returns the new ones. * - * @param { ArrayListCbFn1 } callbackFn - Callback invoked for the replacement. + * @param { ArrayListReplaceCb } callbackFn - Callback invoked for the replacement. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - replaceAllElements(callbackFn: ArrayListCbFn1): void; + replaceAllElements(callbackFn: ArrayListReplaceCb): void; /** * Executes a provided function once for each value in the arraylist object. @@ -539,14 +539,14 @@ declare class ArrayList { /** * Iterates over elements in a generic ArrayList and executes a callback function for each element. * - * @param { ArrayListCbFn } callbackFn - A callback function to execute for each element. + * @param { ArrayListForEachCb } callbackFn - A callback function to execute for each element. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - forEach(callbackFn: ArrayListCbFn): void; + forEach(callbackFn: ArrayListForEachCb): void; /** * Sorts this arraylist according to the order induced by the specified comparator,without comparator this parameter, @@ -593,10 +593,29 @@ declare class ArrayList { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} + * @since 12 + */ + /** + * Sorts this arraylist according to the order induced by the specified comparator,without comparator this parameter, + * it will default to ASCII sorting + * + * Anonymous Object Rectification + * @param { ArrayListComparatorFn } [comparator] - comparator + * comparator (Optional) A function that accepts up to two arguments.Specifies the sort order. + * Must be a function,return number type,If it returns firstValue minus secondValue, it returns an arraylist + * sorted in ascending order;If it returns secondValue minus firstValue, it returns an arraylist sorted in descending order; + * If this parameter is empty, it will default to ASCII sorting + * @throws { BusinessError } 10200011 - The sort method cannot be bound. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Incorrect parameter types; + * 2.Parameter verification failed. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 * @arkts 1.1&1.2 */ - sort(comparator?: (firstValue: T, secondValue: T) => number): void; + sort(comparator?: ArrayListComparatorFn): void; /** * Returns a view of the portion of this arraylist between the specified fromIndex,inclusive,and toIndex,exclusive * @@ -632,8 +651,8 @@ declare class ArrayList { * Obtains elements within a range in this container, including the element at the start position but not that at the * end position, and returns these elements as a new ArrayList instance. * - * @param { number } fromIndex - Index of the start position. - * @param { number } toIndex - Index of the end position. + * @param { int } fromIndex - Index of the start position. + * @param { int } toIndex - Index of the end position. * @returns { ArrayList } * @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range. * @throws { BusinessError } 10200011 - The subArrayList method cannot be bound. @@ -647,7 +666,7 @@ declare class ArrayList { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - subArrayList(fromIndex: number, toIndex: number): ArrayList; + subArrayList(fromIndex: int, toIndex: int): ArrayList; /** * Removes all of the elements from this arraylist.The arraylist will * be empty after this call returns.length becomes 0 @@ -725,7 +744,7 @@ declare class ArrayList { /** * Obtains the capacity of this container. * - * @returns { number } the number type + * @returns { int } the number type * @throws { BusinessError } 10200011 - The getCapacity method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -733,7 +752,7 @@ declare class ArrayList { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getCapacity(): number; + getCapacity(): int; /** * convert arraylist to array * @@ -795,41 +814,17 @@ declare class ArrayList { /** * Returns the element at the given index. * - * @param { number } index - Index. The value must be less than or equal to int32_max, that is, 2147483647. + * @param { int } index - Index. The value must be less than or equal to int32_max, that is, 2147483647. * @returns { T } The element in the arraylist matching the given index. * @throws { BusinessError } 401 - Parameter error. * @throws { BusinessError } 10200001 - The value of index is out of range. * @syscap SystemCapability.Utils.Lang + * @crossplatform * @atomicservice - * @since 12 - */ - [index: number]: T; - - /** - * Returns the item at that index. - * - * @param { number } index - The zero-based index of the desired code unit. - * @returns { T } The element in the arrayList matching the given index. - * @throws { BusinessError } 10200001 - The value of index is out of range. - * @syscap SystemCapability.Utils.Lang - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - $_get(index: number): T; - - /** - * Set the value of item at that index. - * - * @param { number } index - The index of the element to set. - * @param { T } value - The value to set at the specified index. - * @throws { BusinessError } 10200001 - The value of index is out of range. - * @syscap SystemCapability.Utils.Lang - * @atomicservice - * @since 20 - * @arkts 1.2 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ - $_set(index: number, value: T): void; + [index: int]: T; /** * If the newCapacity provided by the user is greater than or equal to length, @@ -859,7 +854,7 @@ declare class ArrayList { /** * Increases the capacity of this container. * - * @param { number } newCapacity - New capacity. + * @param { int } newCapacity - New capacity. * @throws { BusinessError } 10200011 - The increaseCapacityTo method cannot be bound. * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; @@ -870,7 +865,7 @@ declare class ArrayList { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - increaseCapacityTo(newCapacity: number): void; + increaseCapacityTo(newCapacity: int): void; /** * Limit the capacity to the current length * @@ -940,34 +935,49 @@ declare class ArrayList { $_iterator(): IterableIterator; } - /** - * The type of ArrayList callback function. - * - * @typedef { function } ArrayListCbFn - * @param { T } value - The current element being processed - * @param { number } index - The index of the current element - * @param { ArrayList } arrlist - The ArrayList instance being traversed - * @returns { void } This callback does not return a value - * @syscap SystemCapability.Utils.Lang - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - type ArrayListCbFn = (value: T, index: number, arrlist: ArrayList) => void; +/** + * This type specifies the comparator of sort in comparation. + * + * @typedef { function } ArrayListComparatorFn + * @param { T } firstValue - firstValue (required) previous element. + * @param { T } secondValue - secondValue (required) next element. + * @returns { double } the number type + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.1&1.2 + */ +export type ArrayListComparatorFn = (firstValue: T, secondValue: T) => double; - /** - * The type of ArrayList callback function. - * - * @typedef { function } ArrayListCbFn - * @param { T } value - The current element being processed - * @param { number } [index] - The index of the current element - * @param { ArrayList } [arrlist] - The ArrayList instance being traversed - * @returns { T } This callback does not return a value - * @syscap SystemCapability.Utils.Lang - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - type ArrayListCbFn1 = (value: T, index?: number, arrlist?: ArrayList) => T; +/** + * The type of ArrayList callback function. + * + * @typedef { function } ArrayListForEachCb + * @param { T } value - The current element being processed + * @param { int } index - The index of the current element + * @param { ArrayList } arrlist - The ArrayList instance being traversed + * @returns { void } This callback does not return a value + * @syscap SystemCapability.Utils.Lang + * @atomicservice + * @since 20 + * @arkts 1.2 + */ +export type ArrayListForEachCb = (value: T, index: int, arrlist: ArrayList) => void; + +/** + * The type of ArrayList callback function. + * + * @typedef { function } ArrayListReplaceCb + * @param { T } value - The current element being processed + * @param { int } index - The index of the current element + * @param { ArrayList } arrlist - The ArrayList instance being traversed + * @returns { T } This callback does not return a value + * @syscap SystemCapability.Utils.Lang + * @atomicservice + * @since 20 + * @arkts 1.2 + */ +export type ArrayListReplaceCb = (value: T, index: int, arrlist: ArrayList) => T; export default ArrayList; diff --git a/api/@ohos.util.Deque.d.ts b/api/@ohos.util.Deque.d.ts index 8e4758b126..e09c64cf80 100644 --- a/api/@ohos.util.Deque.d.ts +++ b/api/@ohos.util.Deque.d.ts @@ -101,14 +101,14 @@ declare class Deque { /** * Gets the element number of the Deque. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Inserts an element into the deque header. * @@ -419,39 +419,29 @@ declare class Deque { /** * Iterates over elements in a generic Deque (double-ended queue) and executes a callback function for each element. * - * @param { DequeCbFnforEach } callbackFn - A callback function to execute for each element. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - forEach(callbackFn: DequeCbFnforEach): void; - /** - * Returns the byte at the specified index. - * - * @param { number } index - The zero-based index of the desired code unit. - * @returns { T } The element in the deque matching the given index. + * @param { DequeForEachCb } callbackFn - A callback function to execute for each element. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - $_get(index: number): T; + forEach(callbackFn: DequeForEachCb): void; - /** - * Sets the byte at the specified index. - * - * @param { number } index – The index of the element to set. - * @param { T } value – The value to set at the specified index. + /** + * Returns the item at that index. + * + * @param { int } index - The zero-based index of the desired code unit. + * Throws error if index < 0 or index >= deque.length. + * @returns { T } The element in the deque matching the given index. + * @throws { BusinessError } 10200001 - The value of index is out of range. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - $_set(index: number, value: T): void; + [index: int]: T; /** * returns an iterator.Each item of the iterator is a Javascript Object @@ -495,19 +485,19 @@ declare class Deque { $_iterator(): IterableIterator; } - /** - * The type of Deque forEach callback function. - * - * @typedef { function } DequeCbFnforEach - * @param { T } value - The current element being processed - * @param { number } index - The index of the current element - * @param { Deque } deque - The Deque instance being traversed - * @returns { void } This callback does not return a value - * @syscap SystemCapability.Utils.Lang - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - type DequeCbFnforEach = (value: T, index: number, deque: Deque) => void; +/** + * The type of Deque forEach callback function. + * + * @typedef { function } DequeForEachCb + * @param { T } value - The current element being processed + * @param { int } index - The index of the current element + * @param { Deque } deque - The Deque instance being traversed + * @returns { void } This callback does not return a value + * @syscap SystemCapability.Utils.Lang + * @atomicservice + * @since 20 + * @arkts 1.2 + */ +export type DequeForEachCb = (value: T, index: int, deque: Deque) => void; export default Deque; diff --git a/api/@ohos.util.HashMap.d.ts b/api/@ohos.util.HashMap.d.ts index d95f7ca2cb..60bd6a50ba 100644 --- a/api/@ohos.util.HashMap.d.ts +++ b/api/@ohos.util.HashMap.d.ts @@ -98,14 +98,14 @@ declare class HashMap { /** * Gets the number of elements in a hash map. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Returns whether the Map object contains elements * @@ -634,6 +634,6 @@ declare class HashMap { * @since 20 * @arkts 1.2 */ - type HashMapCbFn = (value: V, key: K, map: HashMap) => void; + export type HashMapCbFn = (value: V, key: K, map: HashMap) => void; export default HashMap; diff --git a/api/@ohos.util.HashSet.d.ts b/api/@ohos.util.HashSet.d.ts index 654a6e7c8f..c4746e0d9b 100644 --- a/api/@ohos.util.HashSet.d.ts +++ b/api/@ohos.util.HashSet.d.ts @@ -95,14 +95,14 @@ declare class HashSet { /** * Gets the element number of the HashSet. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Returns whether the Set object contains elements * @@ -468,6 +468,6 @@ declare class HashSet { * @since 20 * @arkts 1.2 */ -type HashSetCbFn = (value: T, key: T, set: HashSet) => void; +export type HashSetCbFn = (value: T, key: T, set: HashSet) => void; export default HashSet; diff --git a/api/@ohos.util.LightWeightMap.d.ts b/api/@ohos.util.LightWeightMap.d.ts index 4b64ae7b16..43a9f890ad 100644 --- a/api/@ohos.util.LightWeightMap.d.ts +++ b/api/@ohos.util.LightWeightMap.d.ts @@ -95,14 +95,14 @@ declare class LightWeightMap { /** * Gets the element number of the LightWeightMap. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Returns whether this map has all the object in a specified map * @@ -237,7 +237,7 @@ declare class LightWeightMap { * Ensures that the capacity of an LightWeightMap container is greater than or equal to a specified value, * and that the container has all the original objects after capacity expansion * - * @param { number } minimumCapacity - minimumCapacity minimumCapacity Minimum capacity to be reserved + * @param { int } minimumCapacity - minimumCapacity minimumCapacity Minimum capacity to be reserved * @throws { BusinessError } 10200011 - The increaseCapacityTo method cannot be bound. * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; @@ -248,7 +248,7 @@ declare class LightWeightMap { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - increaseCapacityTo(minimumCapacity: number): void; + increaseCapacityTo(minimumCapacity: int): void; /** * Returns a new Iterator object that contains the [key, value] pairs for each element in the Map object in insertion order * @@ -346,7 +346,7 @@ declare class LightWeightMap { * Obtains the index of the key equal to a specified key in an LightWeightMap container * * @param { K } key - key key Looking for goals - * @returns { number } Subscript corresponding to target + * @returns { int } Subscript corresponding to target * @throws { BusinessError } 10200011 - The getIndexOfKey method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -354,7 +354,7 @@ declare class LightWeightMap { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getIndexOfKey(key: K): number; + getIndexOfKey(key: K): int; /** * Obtains the index of the value equal to a specified value in an LightWeightMap container * @@ -378,7 +378,7 @@ declare class LightWeightMap { * Obtains the index of the value equal to a specified value in an LightWeightMap container * * @param { V } value - value value Looking for goals - * @returns { number } Subscript corresponding to target + * @returns { int } Subscript corresponding to target * @throws { BusinessError } 10200011 - The getIndexOfValue method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -386,7 +386,7 @@ declare class LightWeightMap { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getIndexOfValue(value: V): number; + getIndexOfValue(value: V): int; /** * Returns whether the Map object contains elements * @@ -462,25 +462,19 @@ declare class LightWeightMap { * @since 12 */ getKeyAt(index: number): K; - - /** - * Obtains the key at the location identified by index in an LightWeightMap container - * - * @param { number } index - index index Target subscript for search - * @returns { K | undefined } the key of key-value pairs - * @throws { BusinessError } 10200011 - The getKeyAt method cannot be bound. - * @throws { BusinessError } 10200001 - The value of index is out of range. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified; - * 2.Incorrect parameter types; - * 3.Parameter verification failed. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - getKeyAt(index: number): K | undefined; + /** + * Obtains the key at the location identified by index in an LightWeightMap container + * + * @param { int } index - index index Target subscript for search + * @returns { K | undefined } the key of key-value pairs or undefined + * @throws { BusinessError } 10200001 - The value of index is out of range. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + getKeyAt(index: int): K | undefined; /** @@ -658,7 +652,7 @@ declare class LightWeightMap { /** * Deletes a key-value pair at the location identified by index from an LightWeightMap container * - * @param { number } index - index index Target subscript for search + * @param { int } index - index index Target subscript for search * @returns { boolean } the boolean type(Is there a delete value) * @throws { BusinessError } 10200011 - The removeAt method cannot be bound. * @throws { BusinessError } 401 - Parameter error. Possible causes: @@ -670,7 +664,7 @@ declare class LightWeightMap { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - removeAt(index: number): boolean; + removeAt(index: int): boolean; /** * Removes all of the mapping from this map * The map will be empty after this call returns @@ -734,7 +728,7 @@ declare class LightWeightMap { /** * Sets the value identified by index in an LightWeightMap container to a specified value * - * @param { number } index - index index Target subscript for search + * @param { int } index - index index Target subscript for search * @param { V } newValue - newValue value Updated the target mapped value * @returns { boolean } the boolean type(Is there a value corresponding to the subscript) * @throws { BusinessError } 10200011 - The setValueAt method cannot be bound. @@ -749,7 +743,7 @@ declare class LightWeightMap { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - setValueAt(index: number, newValue: V): boolean; + setValueAt(index: int, newValue: V): boolean; /** * Executes the given callback function once for each real key in the map. * It does not perform functions on deleted keys. @@ -935,24 +929,19 @@ declare class LightWeightMap { */ getValueAt(index: number): V; - /** + /** * Obtains the value identified by index in an LightWeightMap container * - * @param { number } index - index index Target subscript for search - * @returns { V | undefined } the value of key-value pairs - * @throws { BusinessError } 10200011 - The getValueAt method cannot be bound. + * @param { int } index - index index Target subscript for search + * @returns { V | undefined } the value of key-value pairs or undefined * @throws { BusinessError } 10200001 - The value of index is out of range. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified; - * 2.Incorrect parameter types; - * 3.Parameter verification failed. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - getValueAt(index: number): V | undefined; + getValueAt(index: int): V | undefined; /** * Returns an iterator of the values contained in this map @@ -998,6 +987,6 @@ declare class LightWeightMap { * @since 20 * @arkts 1.2 */ - type LightWeightMapCbFn = (value: V, key: K, map: LightWeightMap) => void; + export type LightWeightMapCbFn = (value: V, key: K, map: LightWeightMap) => void; export default LightWeightMap; diff --git a/api/@ohos.util.LightWeightSet.d.ts b/api/@ohos.util.LightWeightSet.d.ts index 612b677db1..6e63cf0f9a 100644 --- a/api/@ohos.util.LightWeightSet.d.ts +++ b/api/@ohos.util.LightWeightSet.d.ts @@ -96,14 +96,14 @@ declare class LightWeightSet { /** * Gets the element number of the LightWeightSet. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * If the set does not contain the element, the specified element is added @@ -305,7 +305,7 @@ declare class LightWeightSet { * Ensures that the capacity of an LightWeightSet container is greater than or equal to a specified value, * and that the container has all the original objects after capacity expansion * - * @param { number } minimumCapacity Minimum capacity to be reserved + * @param { int } minimumCapacity Minimum capacity to be reserved * @throws { BusinessError } 10200011 - The increaseCapacityTo method cannot be bound. * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; @@ -318,7 +318,7 @@ declare class LightWeightSet { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - increaseCapacityTo(minimumCapacity: number): void; + increaseCapacityTo(minimumCapacity: int): void; /** * Obtains the index of s key of a specified Object type in an LightWeightSet container * @@ -342,7 +342,7 @@ declare class LightWeightSet { * Obtains the index of s key of a specified Object type in an LightWeightSet container * * @param { T } key - key key Looking for goals - * @returns { number } Subscript corresponding to target + * @returns { int } Subscript corresponding to target * @throws { BusinessError } 10200011 - The getIndexOf method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -350,7 +350,7 @@ declare class LightWeightSet { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getIndexOf(key: T): number; + getIndexOf(key: T): int; /** * Deletes an object of a specified Object type from an LightWeightSet container * @@ -424,7 +424,7 @@ declare class LightWeightSet { /** * Deletes an object at the location identified by index from an LightWeightSet container * - * @param { number } index - index index Target subscript for search + * @param { int } index - index index Target subscript for search * @returns { boolean } the boolean type(Is there a delete value) * @throws { BusinessError } 10200011 - The removeAt method cannot be bound. * @throws { BusinessError } 401 - Parameter error. Possible causes: @@ -436,7 +436,7 @@ declare class LightWeightSet { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - removeAt(index: number): boolean; + removeAt(index: int): boolean; /** * Removes all of the mapping from this map * The map will be empty after this call returns @@ -675,7 +675,7 @@ declare class LightWeightSet { /** * Obtains the object at the location identified by index in an LightWeightSet container * - * @param { number } index - index index Target subscript for search + * @param { int } index - index index Target subscript for search * @returns { T | undefined } the value at the specified index, or undefined if the index out of range * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -683,7 +683,7 @@ declare class LightWeightSet { * @since 20 * @arkts 1.2 */ - getValueAt(index: number): T | undefined; + getValueAt(index: int): T | undefined; /** * Returns a ES6 iterator of the values contained in this Set @@ -787,6 +787,6 @@ declare class LightWeightSet { * @since 20 * @arkts 1.2 */ -type LightWeightSetForEachCb = (value: T, key: T, set: LightWeightSet) => void +export type LightWeightSetForEachCb = (value: T, key: T, set: LightWeightSet) => void export default LightWeightSet; diff --git a/api/@ohos.util.LinkedList.d.ts b/api/@ohos.util.LinkedList.d.ts index 37160e6cf5..478e16a9fd 100644 --- a/api/@ohos.util.LinkedList.d.ts +++ b/api/@ohos.util.LinkedList.d.ts @@ -101,14 +101,14 @@ declare class LinkedList { /** * Gets the element number of the LinkedList. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Appends the specified element to the end of this linkedlist. @@ -173,7 +173,7 @@ declare class LinkedList { */ /** * Inserts an element at the specified position in this container. - * @param { number } index - Index of the position where the element is to be inserted. + * @param { int } index - Index of the position where the element is to be inserted. * @param { T } element - Target element. * @throws { BusinessError } 10200011 - The insert method cannot be bound. * @throws { BusinessError } 401 - Parameter error. Possible causes: @@ -187,7 +187,7 @@ declare class LinkedList { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - insert(index: number, element: T): void; + insert(index: int, element: T): void; /** * Returns the element at the specified position in this linkedlist, * or returns undefined if this linkedlist is empty @@ -234,7 +234,7 @@ declare class LinkedList { /** * Obtains an element at the specified position in this container. * - * @param { number } index - Position index of the target element. + * @param { int } index - specified position * @returns { T | undefined} the element at the specified index, or undefined if the index is out of range. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -242,7 +242,7 @@ declare class LinkedList { * @since 20 * @arkts 1.2 */ - get(index: number): T | undefined; + get(index: int): T | undefined; /** * Inserts the specified element at the beginning of this LinkedList. @@ -420,7 +420,7 @@ declare class LinkedList { * Obtains the index of the first occurrence of the specified element in this container. * * @param { T } element - Target element. - * @returns { number } the number type ,returns the lowest index such that or -1 if there is no such index. + * @returns { int } the int type ,returns the lowest index such that or -1 if there is no such index. * @throws { BusinessError } 10200011 - The getIndexOf method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -428,7 +428,7 @@ declare class LinkedList { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getIndexOf(element: T): number; + getIndexOf(element: T): int; /** * Find the corresponding element according to the index. * @@ -482,7 +482,7 @@ declare class LinkedList { /** * Find the corresponding element according to the index. * - * @param { number } index - the index in the linkedList + * @param { int } index - the index in the linkedList * @returns { T | undefined } the T type, if the index is * out of bounds (greater than or equal to length or less than 0), throw an exception * @throws { BusinessError } 10200001 - The value of "index" is out of range. It must be >= 0 && <= ${length}. @@ -493,7 +493,7 @@ declare class LinkedList { * @since 20 * @arkts 1.2 */ - removeByIndex(index: number): T | undefined; + removeByIndex(index: int): T | undefined; /** * Removes the first occurrence of the specified element from this linkedlist, @@ -640,7 +640,7 @@ declare class LinkedList { * Obtains the index of the last occurrence of the specified element in this container. * * @param { T } element - Target element. - * @returns { number } the number type + * @returns { int } the int type * @throws { BusinessError } 10200011 - The getLastIndexOf method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -648,7 +648,7 @@ declare class LinkedList { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getLastIndexOf(element: T): number; + getLastIndexOf(element: T): int; /** * Returns the first element (the item at index 0) of this linkedlist. * or returns undefined if linkedlist is empty @@ -788,7 +788,7 @@ declare class LinkedList { /** * Replaces an element at the specified position in this container with a given element. * - * @param { number } index - Position index of the target element. + * @param { int } index - Position index of the target element. * @param { T } element - Element to be used for replacement. * @returns { T | undefined } the T type ,returns undefined if linkedList is empty * @throws { BusinessError } 10200001 - The value of index is out of range. @@ -801,7 +801,7 @@ declare class LinkedList { * @since 20 * @arkts 1.2 */ - set(index: number, element: T): T | undefined; + set(index: int, element: T): T | undefined; /** * Replaces each element of this linkedlist with the result of applying the operator to that element. @@ -1004,7 +1004,7 @@ declare class LinkedList { * * @typedef { function } LinkedListForEachCb * @param { T } value - The value of current element - * @param { number } index - The index of current element + * @param { int } index - The index of current element * @param { LinkedList } linkedList - The LinkedList instance being traversed * @returns { void } This callback does not return a value * @syscap SystemCapability.Utils.Lang @@ -1012,6 +1012,6 @@ declare class LinkedList { * @since 20 * @arkts 1.2 */ -type LinkedListForEachCb = (value: T, index: number, linkedList: LinkedList) => void +export type LinkedListForEachCb = (value: T, index: int, linkedList: LinkedList) => void export default LinkedList; diff --git a/api/@ohos.util.List.d.ts b/api/@ohos.util.List.d.ts index b2fe9cc1e4..99d014d818 100644 --- a/api/@ohos.util.List.d.ts +++ b/api/@ohos.util.List.d.ts @@ -18,6 +18,18 @@ * @kit ArkTS */ +/** + * RecordData is used for input parameter obj of the equal function + * + * @typedef { undefined | null | Object | Record | Array } + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ +type RecordData = undefined | null | Object | Record | Array; + /** * List is implemented based on the singly linked list. Each node has a reference pointing to the next element. * When querying an element, the system traverses the list from the beginning. @@ -100,14 +112,14 @@ declare class List { /** * Gets the element number of the List. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Appends the specified element to the end of this list. @@ -174,7 +186,7 @@ declare class List { * Inserts an element at the specified position in this container. * * @param { T } element - Target element. - * @param { number } index - Index of the position where the element is to be inserted. + * @param { int } index - Index of the position where the element is to be inserted. * @throws { BusinessError } 10200011 - The insert method cannot be bound. * @throws { BusinessError } 10200001 - The value of index is out of range. * @throws { BusinessError } 401 - Parameter error. Possible causes: @@ -187,7 +199,7 @@ declare class List { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - insert(element: T, index: number): void; + insert(element: T, index: int): void; /** * Returns the element at the specified position in this list, * or returns undefined if this list is empty @@ -235,7 +247,7 @@ declare class List { * Returns the element at the specified position in this list, * or returns undefined if this list is empty * - * @param { number } index - specified position + * @param { int } index - specified position * @returns { T | undefined} the element at the specified index, or undefined if the index is out of range. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -243,7 +255,7 @@ declare class List { * @since 20 * @arkts 1.2 */ - get(index: number): T | undefined; + get(index: int): T | undefined; /** * Check if list contains the specified element @@ -302,7 +314,7 @@ declare class List { * Obtains the index of the last occurrence of the specified element in this container. * * @param { T } element - Target element. - * @returns { number } the number type ,returns the lowest index such that or -1 if there is no such index. + * @returns { int } the int type ,returns the lowest index such that or -1 if there is no such index. * @throws { BusinessError } 10200011 - The getIndexOf method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -310,7 +322,7 @@ declare class List { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getIndexOf(element: T): number; + getIndexOf(element: T): int; /** * Find the corresponding element according to the index. * @@ -361,7 +373,7 @@ declare class List { /** * Searches for an element based on its index and then removes it. * - * @param { number } index - Position index of the target element. + * @param { int } index - Position index of the target element. * @returns { T | undefined } the T type, if the index is * out of bounds (greater than or equal to length or less than 0), throw an exception * @throws { BusinessError } 10200001 - The value of "index" is out of range. It must be >= 0 && <= ${length - 1}. @@ -372,7 +384,7 @@ declare class List { * @since 20 * @arkts 1.2 */ - removeByIndex(index: number): T | undefined; + removeByIndex(index: int): T | undefined; /** * Removes the first occurrence of the specified element from this list, @@ -435,7 +447,7 @@ declare class List { * Obtains the index of the last occurrence of the specified element in this container. * * @param { T } element - Target element. - * @returns { number } the number type + * @returns { int } the number type * @throws { BusinessError } 10200011 - The getLastIndexOf method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -443,7 +455,7 @@ declare class List { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getLastIndexOf(element: T): number; + getLastIndexOf(element: T): int; /** * Returns the first element (the item at index 0) of this list. * or returns undefined if list is empty @@ -578,7 +590,7 @@ declare class List { /** * Replaces an element at the specified position in this container with a given element. * - * @param { number } index - Position index of the target element. + * @param { int } index - Position index of the target element. * @param { T } element - Element to be used for replacement. * @returns { T | undefined } the T type, returns undefined if linkedList is empty * @throws { BusinessError } 10200001 - The value of "index" is out of range. It must be >= 0 && <= ${length - 1}. @@ -589,7 +601,7 @@ declare class List { * @since 20 * @arkts 1.2 */ - set(index: number, element: T): T | undefined; + set(index: int, element: T): T | undefined; /** * Compares the specified object with this list for equality.if the object are the same as this list * return true, otherwise return false. @@ -620,10 +632,25 @@ declare class List { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ equal(obj: Object): boolean; + + /** + * Compares the specified object with this list for equality.if the object are the same as this list + * return true, otherwise return false. + * + * @param { RecordData } obj - obj obj Compare objects + * @returns { boolean } the boolean type + * @throws { BusinessError } 10200011 - The equal method cannot be bound. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + equal(obj: RecordData): boolean; + /** * Replaces each element of this list with the result of applying the operator to that element. * @@ -727,10 +754,28 @@ declare class List { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} + * @since 12 + */ + /** + * Sorts this list according to the order induced by the specified comparator + * + * Anonymous Object Rectification + * @param { ListComparatorFn } comparator - comparator + * comparator (required) A function that accepts up to two arguments. + * Specifies the sort order. Must be a function,return number type,If it returns firstValue + * minus secondValue, it returns an list sorted in ascending order;If it returns secondValue + * minus firstValue, it returns an list sorted in descending order; + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200011 - The sort method cannot be bound. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 * @arkts 1.1&1.2 */ - sort(comparator: (firstValue: T, secondValue: T) => number): void; + sort(comparator: ListComparatorFn): void; /** * Removes all of the elements from this list.The list will * be empty after this call returns.length becomes 0 @@ -792,8 +837,8 @@ declare class List { * Obtains elements within a range in this container, including the element at the start position but not that at the * end position, and returns these elements as a new List instance. * - * @param { number } fromIndex - Index of the start position. - * @param { number } toIndex - Index of the end position. + * @param { int } fromIndex - Index of the start position. + * @param { int } toIndex - Index of the end position. * @returns { List } * @throws { BusinessError } 10200011 - The getSubList method cannot be bound. * @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range. @@ -806,7 +851,7 @@ declare class List { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getSubList(fromIndex: number, toIndex: number): List; + getSubList(fromIndex: int, toIndex: int): List; /** * Replaces each element of this list with the result of applying the operator to that element. * @@ -926,31 +971,20 @@ declare class List { */ isEmpty(): boolean; /** - * Returns the item at that index - * - * @param { number } index - the zero-based index of the desired code unit. - * @returns { T | undefined } the element in the list matching the given index, - * or undefined if the index is out of range. + * Returns the item at that index. + * + * @param { int } index - The zero-based index of the desired code unit. + * Throws error if index < 0 or index >= list.length. + * @returns { T } The element in the list matching the given index. + * @throws { BusinessError } 10200001 - The value of index is out of range. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - $_get(index: number): T | undefined; + [index: int]: T; - /** - * Set the value of item at that index. - * - * @param { number } index – the index of the element to set. - * @param { T } value – the value to set at the specified index - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - $_set(index: number, value: T): void; /** * returns an iterator.Each item of the iterator is a Javascript Object * @@ -993,13 +1027,26 @@ declare class List { $_iterator(): IterableIterator; } - +/** + * This type specifies the comparator of sort in comparation. + * + * @typedef { function } ListComparatorFn + * @param { T } firstValue - firstValue (required) previous element. + * @param { T } secondValue - secondValue (required) next element. + * @returns { double } the number type + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.1&1.2 + */ +export type ListComparatorFn = (firstValue: T, secondValue: T) => double; /** * The type of List callback function. * * @typedef { function } ListForEachCb * @param { T } value - The value of current element - * @param { number } index - The index of current element + * @param { int } index - The index of current element * @param { List } list - The List instance being traversed * @returns { void } This callback does not return a value * @syscap SystemCapability.Utils.Lang @@ -1007,14 +1054,14 @@ declare class List { * @since 20 * @arkts 1.2 */ -type ListForEachCb = (value: T, index: number, list: List) => void +export type ListForEachCb = (value: T, index: int, list: List) => void /** * The type of List callback function. * * @typedef { function } LinkedListForEachCb * @param { T } value - The old value of current element - * @param { number } index - The index of current element + * @param { int } index - The index of current element * @param { List } list - The List instance being traversed * @returns { T } - The new value of current element * @syscap SystemCapability.Utils.Lang @@ -1022,6 +1069,6 @@ type ListForEachCb = (value: T, index: number, list: List) => void * @since 20 * @arkts 1.2 */ -type ListReplaceCb = (value: T, index: number, list: List) => T +export type ListReplaceCb = (value: T, index: int, list: List) => T export default List; diff --git a/api/@ohos.util.PlainArray.d.ts b/api/@ohos.util.PlainArray.d.ts index 6b28d6ba11..a4b5e2ede7 100644 --- a/api/@ohos.util.PlainArray.d.ts +++ b/api/@ohos.util.PlainArray.d.ts @@ -99,14 +99,14 @@ declare class PlainArray { /** * Gets the element number of the PlainArray. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Appends a key-value pair to PlainArray @@ -136,7 +136,7 @@ declare class PlainArray { /** * Appends a key-value pair to PlainArray * - * @param { number } key - key key Added the key of key-value + * @param { int } key - key key Added the key of key-value * @param { T } value - value value Added the value of key-value * @throws { BusinessError } 10200011 - The add method cannot be bound. * @throws { BusinessError } 401 - Parameter error. Possible causes: @@ -148,7 +148,7 @@ declare class PlainArray { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - add(key: number, value: T): void; + add(key: int, value: T): void; /** * Clears the current PlainArray object * @@ -232,7 +232,7 @@ declare class PlainArray { /** * Checks whether the current PlainArray object contains the specified key * - * @param { number } key - key key need to determine whether to include the key + * @param { int } key - key key need to determine whether to include the key * @returns { boolean } the boolean type * @throws { BusinessError } 10200011 - The has method cannot be bound. * @throws { BusinessError } 401 - Parameter error. Possible causes: @@ -244,7 +244,7 @@ declare class PlainArray { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - has(key: number): boolean; + has(key: int): boolean; /** * Queries the value associated with the specified key * @@ -289,7 +289,7 @@ declare class PlainArray { /** * Queries the value associated with the specified key * - * @param { number } key - looking for goals + * @param { int } key - looking for goals * @returns { T | undefined } the value of key-value pairs * @throws { BusinessError } 10200001 - The value of index is out of range. * @syscap SystemCapability.Utils.Lang @@ -298,7 +298,7 @@ declare class PlainArray { * @since 20 * @arkts 1.2 */ - get(key: number): T | undefined; + get(key: int): T | undefined; /** * Queries the index for a specified key @@ -328,8 +328,8 @@ declare class PlainArray { /** * Queries the index for a specified key * - * @param { number } key - key key Looking for goals - * @returns { number } Subscript corresponding to target + * @param { int } key - key key Looking for goals + * @returns { int } Subscript corresponding to target * @throws { BusinessError } 10200011 - The getIndexOfKey method cannot be bound. * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; @@ -340,7 +340,7 @@ declare class PlainArray { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getIndexOfKey(key: number): number; + getIndexOfKey(key: int): int; /** * Queries the index for a specified value * @@ -364,7 +364,7 @@ declare class PlainArray { * Queries the index for a specified value * * @param { T } value - value value Looking for goals - * @returns { number } Subscript corresponding to target + * @returns { int } Subscript corresponding to target * @throws { BusinessError } 10200011 - The getIndexOfValue method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -372,7 +372,7 @@ declare class PlainArray { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getIndexOfValue(value: T): number; + getIndexOfValue(value: T): int; /** * Checks whether the current PlainArray object is empty * @@ -487,7 +487,7 @@ declare class PlainArray { /** * Remove the key-value pair based on a specified key if it exists and return the value * - * @param { number } key - target to be deleted + * @param { int } key - target to be deleted * @returns { T | undefined } target mapped value, or undefined if key is not exist * @throws { BusinessError } 10200001 - The value of index is out of range. * @syscap SystemCapability.Utils.Lang @@ -496,7 +496,7 @@ declare class PlainArray { * @since 20 * @arkts 1.2 */ - remove(key: number): T | undefined; + remove(key: int): T | undefined; /** * Remove the key-value pair at a specified index if it exists and return the value @@ -542,7 +542,7 @@ declare class PlainArray { /** * Remove the key-value pair at a specified index if it exists and return the value * - * @param { number } index - target subscript for search + * @param { int } index - target subscript for search * @returns { T | undefined } the T type, or undefined if container is empty * @throws { BusinessError } 10200001 - The value of index is out of range. * @syscap SystemCapability.Utils.Lang @@ -551,7 +551,7 @@ declare class PlainArray { * @since 20 * @arkts 1.2 */ - removeAt(index: number): T | undefined; + removeAt(index: int): T | undefined; /** * Remove a group of key-value pairs from a specified index @@ -585,9 +585,9 @@ declare class PlainArray { /** * Remove a group of key-value pairs from a specified index * - * @param { number } index - index index remove start index - * @param { number } size - size size Expected deletion quantity - * @returns { number } Actual deleted quantity + * @param { int } index - index index remove start index + * @param { int } size - size size Expected deletion quantity + * @returns { int } Actual deleted quantity * @throws { BusinessError } 10200011 - The removeRangeFrom method cannot be bound. * @throws { BusinessError } 10200001 - The value of index is out of range. * @throws { BusinessError } 401 - Parameter error. Possible causes: @@ -599,7 +599,7 @@ declare class PlainArray { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - removeRangeFrom(index: number, size: number): number; + removeRangeFrom(index: int, size: int): int; /** * Update value on specified index * @@ -630,7 +630,7 @@ declare class PlainArray { /** * Update value on specified index * - * @param { number } index - index index Target subscript for search + * @param { int } index - index index Target subscript for search * @param { T } value - value value Updated the target mapped value * @throws { BusinessError } 10200011 - The setValueAt method cannot be bound. * @throws { BusinessError } 10200001 - The value of index is out of range. @@ -643,7 +643,7 @@ declare class PlainArray { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - setValueAt(index: number, value: T): void; + setValueAt(index: int, value: T): void; /** * Obtains the string representation of the PlainArray object * @@ -703,7 +703,7 @@ declare class PlainArray { /** * Queries the value at a specified index * - * @param { number } index - index index Target subscript for search + * @param { int } index - index index Target subscript for search * @returns { T } the value of key-value pairs * @throws { BusinessError } 10200011 - The getValueAt method cannot be bound. * @throws { BusinessError } 10200001 - The value of index is out of range. @@ -716,7 +716,7 @@ declare class PlainArray { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getValueAt(index: number): T; + getValueAt(index: int): T; /** * Executes a provided function once for each value in the PlainArray object. * @@ -814,14 +814,14 @@ declare class PlainArray { /** * returns an iterator. Each item of the iterator is a ArkTS Object * - * @returns { IterableIterator<[number, T]> } + * @returns { IterableIterator<[int, T]> } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - $_iterator(): IterableIterator<[number, T]>; + $_iterator(): IterableIterator<[int, T]>; } @@ -830,7 +830,7 @@ declare class PlainArray { * * @typedef { function } PlainArrayForEachCb * @param { T } value - The value of current element - * @param { number } key - The key of current element + * @param { int } key - The key of current element * @param { PlainArray } PlainArray - The PlainArray instance being traversed * @returns { void } This callback does not return a value * @syscap SystemCapability.Utils.Lang @@ -838,6 +838,6 @@ declare class PlainArray { * @since 20 * @arkts 1.2 */ -type PlainArrayForEachCb = (value: T, key: number, PlainArray: PlainArray) => void +export type PlainArrayForEachCb = (value: T, key: int, PlainArray: PlainArray) => void export default PlainArray; diff --git a/api/@ohos.util.Queue.d.ts b/api/@ohos.util.Queue.d.ts index abdba11d47..37ec882239 100644 --- a/api/@ohos.util.Queue.d.ts +++ b/api/@ohos.util.Queue.d.ts @@ -102,14 +102,14 @@ declare class Queue { /** * Gets the element number of the Queue. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Inserting specified element at the end of a queue if it is possible to do @@ -341,7 +341,7 @@ declare class Queue { * * @typedef { function } QueueForEachCb * @param { T } value - The value of current element - * @param { number } index - The key of current element + * @param { int } index - The key of current element * @param { Queue } queue - The Queue instance being traversed * @returns { void } This callback does not return a value * @syscap SystemCapability.Utils.Lang @@ -349,6 +349,6 @@ declare class Queue { * @since 20 * @arkts 1.2 */ -type QueueForEachCb = (value: T, index: number, queue: Queue) => void +export type QueueForEachCb = (value: T, index: int, queue: Queue) => void export default Queue; diff --git a/api/@ohos.util.Stack.d.ts b/api/@ohos.util.Stack.d.ts index 340ed2c85f..2dc7eedf00 100644 --- a/api/@ohos.util.Stack.d.ts +++ b/api/@ohos.util.Stack.d.ts @@ -99,14 +99,14 @@ declare class Stack { /** * Gets the element number of the Stack. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Tests if this stack is empty @@ -282,7 +282,7 @@ declare class Stack { * Returns the 1-based position where an object is on this stack * * @param { T } element - element element Target to be deleted - * @returns { number } the T type,If there is no such element, return -1 + * @returns { int } the T type,If there is no such element, return -1 * @throws { BusinessError } 10200011 - The locate method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -290,7 +290,7 @@ declare class Stack { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - locate(element: T): number; + locate(element: T): int; /** * Executes a provided function once for each value in the Stack object. * @@ -404,7 +404,7 @@ declare class Stack { * * @typedef { function } StackForEachCb * @param { T } value - The value of current element - * @param { number } index - The key of current element + * @param { int } index - The key of current element * @param { Stack } stack - The Stack instance being traversed * @returns { void } This callback does not return a value * @syscap SystemCapability.Utils.Lang @@ -412,6 +412,6 @@ declare class Stack { * @since 20 * @arkts 1.2 */ -type StackForEachCb = (value: T, index: number, stack: Stack) => void +export type StackForEachCb = (value: T, index: int, stack: Stack) => void export default Stack; diff --git a/api/@ohos.util.TreeMap.d.ts b/api/@ohos.util.TreeMap.d.ts index ad93707e33..68a1d106d3 100644 --- a/api/@ohos.util.TreeMap.d.ts +++ b/api/@ohos.util.TreeMap.d.ts @@ -136,14 +136,14 @@ declare class TreeMap { /** * Gets the element number of the TreeMap. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Returns whether the Map object contains elements @@ -871,7 +871,7 @@ declare class TreeMap { * @since 20 * @arkts 1.2 */ -type TreeMapForEachCb = (value: V, key: K, map: TreeMap) => void +export type TreeMapForEachCb = (value: V, key: K, map: TreeMap) => void /** * The type of TreeMap comparator. @@ -879,12 +879,12 @@ type TreeMapForEachCb = (value: V, key: K, map: TreeMap) => void * @typedef { function } TreeMapComparator * @param { K } firstValue - The first value compared * @param { K } secondValue - The second value compared - * @returns { number } - Comparison results + * @returns { double } - Comparison results * @syscap SystemCapability.Utils.Lang * @atomicservice * @since 20 * @arkts 1.2 */ -type TreeMapComparator = (firstValue: K, secondValue: K) => number +export type TreeMapComparator = (firstValue: K, secondValue: K) => double export default TreeMap; diff --git a/api/@ohos.util.TreeSet.d.ts b/api/@ohos.util.TreeSet.d.ts index d09e7b0548..9a61949bd4 100644 --- a/api/@ohos.util.TreeSet.d.ts +++ b/api/@ohos.util.TreeSet.d.ts @@ -133,14 +133,14 @@ declare class TreeSet { /** * Gets the element number of the TreeSet. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Returns whether the Set object contains elements @@ -765,7 +765,7 @@ declare class TreeSet { * @since 20 * @arkts 1.2 */ -type TreeSetForEachCb = (value: T, key: T, set: TreeSet) => void +export type TreeSetForEachCb = (value: T, key: T, set: TreeSet) => void /** * The type of TreeSet comparator. @@ -773,12 +773,12 @@ type TreeSetForEachCb = (value: T, key: T, set: TreeSet) => void * @typedef { function } TreeSetComparator * @param { T } firstValue - The first value compared * @param { T } secondValue - The second value compared - * @returns { number } - Comparison results + * @returns { double } - Comparison results * @syscap SystemCapability.Utils.Lang * @atomicservice * @since 20 * @arkts 1.2 */ -type TreeSetComparator = (firstValue: T, secondValue: T) => number +export type TreeSetComparator = (firstValue: T, secondValue: T) => double export default TreeSet; diff --git a/api/@ohos.util.json.d.ts b/api/@ohos.util.json.d.ts index b865390738..03abf5a6a4 100644 --- a/api/@ohos.util.json.d.ts +++ b/api/@ohos.util.json.d.ts @@ -25,8 +25,7 @@ * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ declare namespace json { /** @@ -39,8 +38,7 @@ declare namespace json { * @returns { Object | undefined | null } Return an Object, undefined or null value * @syscap SystemCapability.Utils.Lang * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ type Transformer = (this: Object, key: string, value: Object) => Object | undefined | null; @@ -64,22 +62,6 @@ declare namespace json { */ function parse(text: string, reviver?: Transformer, options?: ParseOptions): Object | null; - /** - * Converts a JavaScript Object Notation (JSON) string into an Object or null. - * - * @param { string } text - A valid JSON string. - * @param { Type } type - A constructor or class representing the expected type of the parsed result. - * @param { Transformer } [reviver] - A function that transforms the results. - * @param {ParseOptions} [options] - The config of parse. - * @returns { T | null | undefined } Return an Object, array, string, number, boolean, undefined, or null value corresponding to JSON text. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - function parse(text: string, type: Type, reviver?: Transformer, options?: ParseOptions): T | null | undefined; - /** * Converts an ArkTS object or array into a JSON string. In the case of a container, linear containers are supported, * but non-linear containers are not. @@ -105,22 +87,6 @@ declare namespace json { */ function stringify(value: Object, replacer?: (number | string)[] | null, space?: string | number): string; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * - * @param { NullishType } value - A JavaScript value, usually an NullishType or array. - * @param { Transformer | ((number | string)[]) | null } [replacer] - An array of strings and numbers that acts as an approved list - * for selecting the object properties that will be stringify. - * @param { string | number } [space] - Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. - * @returns { string } Return a JSON text. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - function stringify(value: NullishType, replacer?: Transformer | ((number | string)[]) | null, space?: string | number): string; - /** * Converts an ArkTS object or array into a JSON string. In the case of a container, linear containers are supported, * but non-linear containers are not. @@ -155,8 +121,7 @@ declare namespace json { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ function has(obj: object, property: string): boolean; @@ -180,8 +145,7 @@ declare namespace json { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ const enum BigIntMode { /** @@ -190,8 +154,7 @@ declare namespace json { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ DEFAULT = 0, /** @@ -200,8 +163,7 @@ declare namespace json { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ PARSE_AS_BIGINT = 1, /** @@ -210,8 +172,7 @@ declare namespace json { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ ALWAYS_PARSE_AS_BIGINT = 2, } @@ -223,8 +184,7 @@ declare namespace json { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ interface ParseOptions { /** @@ -233,8 +193,7 @@ declare namespace json { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ bigIntMode: BigIntMode; } diff --git a/api/@ohos.util.d.ets b/api/@ohos.util.static.d.ets similarity index 76% rename from api/@ohos.util.d.ets rename to api/@ohos.util.static.d.ets index 23896d2f46..cf05647a8c 100644 --- a/api/@ohos.util.d.ets +++ b/api/@ohos.util.static.d.ets @@ -1,6 +1,7 @@ +'use static'; /* * Copyright (c) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); + * Licensed under the Apache License, Version 2.0 (the "License"), * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * @@ -13,14 +14,34 @@ * limitations under the License. */ -'use static'; /** * @file * @kit ArkTS - * @arkts 1.2 */ + /** + * The util module provides common utility functions, + * such as TextEncoder and TextDecoder for string encoding and decoding, + * RationalNumber8+ for rational number operations, LRUCache9+ for cache management, + * ScopeHelper9+ for range determination, + * Base64Helper9+ for Base64 encoding and decoding, types8+ for built-in object type check, + * and replacement on methods. + * + * @namespace util + * @syscap SystemCapability.Utils.Lang + * @since 20 + * @arkts 1.2 + */ declare namespace util { + /** + * RecordData is used for input parameter obj of the getHash function + * + * @typedef { undefined | null | Object | Record | Array } + * @syscap SystemCapability.Utils.Lang + * @since 20 + * @arkts 1.2 + */ + type RecordData = undefined | null | Object | Record | Array; /** * %s: String will be used to convert all values except BigInt, Object and -0. BigInt values will be represented * with an n and Objects that have no user defined toString function are inspected using util.inspect() with @@ -42,13 +63,9 @@ declare namespace util { * @param { string } format - Styled string * @param { Object[] } args - Data to be formatted * @returns { string } a string formatted in a specific format. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified; - * 2.Incorrect parameter types. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ function format(format: string, ...args: Object[]): string; @@ -59,9 +76,8 @@ declare namespace util { * @returns { string } Return a string representing this UUID. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ function generateRandomUUID(entropyCache?: boolean): string; @@ -70,41 +86,36 @@ declare namespace util { * * @enum { number } Type * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ enum Type { /** * The value indicates that the encoding format of base64 is BASIC * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ BASIC, /** * The value indicates that the encoding format of base64 is MIME * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ MIME, /** * The value indicates that the encoding format of base64 is BASIC_URL_SAFE * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ BASIC_URL_SAFE, /** * The value indicates that the encoding format of base64 is MIME_URL_SAFE * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ MIME_URL_SAFE, } @@ -114,18 +125,16 @@ declare namespace util { * u8 array using the Base64 encoding scheme. * * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ class Base64Helper { /** * Constructor for creating base64 encoding and decoding * * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ constructor(); @@ -135,13 +144,9 @@ declare namespace util { * @param { Uint8Array } src - A Uint8Array value * @param { Type } [options] - Enumerating input parameters includes two encoding formats: BASIC and BASIC_URL_SAFE * @returns { Uint8Array } Return the encoded new Uint8Array. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified; - * 2.Incorrect parameter types. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ encodeSync(src: Uint8Array, options?: Type): Uint8Array; @@ -149,47 +154,37 @@ declare namespace util { * Encodes the specified byte array into a String using the Base64 encoding scheme. * * @param { Uint8Array } src - A Uint8Array value - * @param { Type } options - one of the Type enumeration + * @param { Type } [options] - one of the Type enumeration * @returns { string } Return the encoded string. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified; - * 2.Incorrect parameter types. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ encodeToStringSync(src: Uint8Array, options?: Type): string; /** - * Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme. + * Decodes a Base64 encoded String or + * input u8 array into a newly-allocated u8 array using the Base64 encoding scheme. * * @param { Uint8Array | string } src - A Uint8Array value or a string value * @param { Type } [options] - one of the Type enumeration * @returns { Uint8Array } Return the decoded Uint8Array. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified; - * 2.Incorrect parameter types. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ decodeSync(src: Uint8Array | string, options?: Type): Uint8Array; /** - * Asynchronously encodes all bytes in the specified u8 array into the newly allocated u8 array using the Base64 encoding scheme. + * Asynchronously encodes all bytes in the specified u8 array into the newly allocated u8 array using + * the Base64 encoding scheme. * * @param { Uint8Array } src - A Uint8Array value * @param { Type } [options] - Enumerating input parameters includes two encoding formats: BASIC and BASIC_URL_SAFE * @returns { Promise } Return the encodes asynchronous new Uint8Array. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified; - * 2.Incorrect parameter types. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ encode(src: Uint8Array, options?: Type): Promise; @@ -199,13 +194,9 @@ declare namespace util { * @param { Uint8Array } src - A Uint8Array value * @param { Type } [options] - one of the Type enumeration * @returns { Promise } Returns the encoded asynchronous string. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified; - * 2.Incorrect parameter types. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ encodeToString(src: Uint8Array, options?: Type): Promise; @@ -216,13 +207,9 @@ declare namespace util { * @param { Uint8Array | string } src - A Uint8Array value or a string value * @param { Type } [options] - one of the Type enumeration * @returns { Promise } Return the decoded asynchronous Uint8Array. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified; - * 2.Incorrect parameter types. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ decode(src: Uint8Array | string, options?: Type): Promise; } @@ -232,20 +219,18 @@ declare namespace util { * * @interface ScopeComparable * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ interface ScopeComparable { /** * The comparison function is used by the scope. * - * @param { ScopeComparable } other - Other + * @param { T } other - Other * @returns { boolean } Returns whether the current object is greater than or equal to the input object. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ compareTo(other: T): boolean; } @@ -253,21 +238,30 @@ declare namespace util { /** * A type used to denote ScopeComparable or number. * - * @typedef { ScopeComparable } + * @typedef { ScopeComparable } ScopeType * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ type ScopeType = ScopeComparable; + /** + * Provides APIs to define the valid range of a field. The constructor of this class creates comparable objects + * with lower and upper limits. + * + * @syscap SystemCapability.Utils.Lang + * @since 20 + * @arkts 1.2 + */ class ScopeHelper> { /** * A constructor used to create a Scope instance with the lower and upper bounds specified. * - * @param { ScopeType } lowerObj - A ScopeType value - * @param { ScopeType } upperObj - A ScopeType value + * @param { T } lowerObj - A ScopeType value + * @param { T } upperObj - A ScopeType value + * @syscap SystemCapability.Utils.Lang * @since 20 + * @arkts 1.2 */ constructor(lowerObj: T, upperObj: T); @@ -275,111 +269,143 @@ declare namespace util { * Obtains a string representation of the current range. * * @returns { string } Returns a string representation of the current range object. + * @syscap SystemCapability.Utils.Lang * @since 20 + * @arkts 1.2 */ toString(): string; /** * Returns the intersection of a given range and the current range. * - * @param { ScopeHelper } range - A Scope range object - * @returns { ScopeHelper } Returns the intersection of a given range and the current range. + * @param { ScopeHelper } range - A Scope range object + * @returns { ScopeHelper } Returns the intersection of a given range and the current range. + * @syscap SystemCapability.Utils.Lang * @since 20 + * @arkts 1.2 */ intersect(range: ScopeHelper): ScopeHelper; /** * Returns the intersection of the current range and the range specified by the given lower and upper bounds. * - * @param { ScopeType } lowerObj - A ScopeType value - * @param { ScopeType } upperObj - A ScopeType value - * @returns { ScopeHelper } Returns the intersection of the current range and the range specified by the given lower and upper bounds. + * @param { T } lowerObj - A ScopeType value + * @param { T } upperObj - A ScopeType value + * @returns { ScopeHelper } Returns the intersection of the current range and + * the range specified by the given lower and upper bounds. + * @syscap SystemCapability.Utils.Lang * @since 20 + * @arkts 1.2 */ intersect(lowerObj: T, upperObj: T): ScopeHelper; /** * Obtains the upper bound of the current range. * - * @returns { ScopeType } Returns the upper bound of the current range. + * @returns { T } Returns the upper bound of the current range. + * @syscap SystemCapability.Utils.Lang * @since 20 + * @arkts 1.2 */ getUpper(): T; /** * Obtains the lower bound of the current range. * - * @returns { ScopeType } Returns the lower bound of the current range. + * @returns { T } Returns the lower bound of the current range. + * @syscap SystemCapability.Utils.Lang * @since 20 + * @arkts 1.2 */ getLower(): T; /** * Creates the smallest range that includes the current range and the given lower and upper bounds. * - * @param { ScopeType } lowerObj - A ScopeType value - * @param { ScopeType } upperObj - A ScopeType value - * @returns { ScopeHelper } Returns the smallest range that includes the current range and the given lower and upper bounds. + * @param { T } lowerObj - A ScopeType value + * @param { T } upperObj - A ScopeType value + * @returns { ScopeHelper } Returns the smallest range that includes + * the current range and the given lower and upper bounds. + * @syscap SystemCapability.Utils.Lang * @since 20 + * @arkts 1.2 */ expand(lowerObj: T, upperObj: T): ScopeHelper; /** * Creates the smallest range that includes the current range and a given range. * - * @param { ScopeHelper } range - A Scope range object - * @returns { ScopeHelper } Returns the smallest range that includes the current range and a given range. + * @param { ScopeHelper } range - A Scope range object + * @returns { ScopeHelper } Returns the smallest range that includes the current range and a given range. + * @syscap SystemCapability.Utils.Lang * @since 20 + * @arkts 1.2 */ expand(range: ScopeHelper): ScopeHelper; /** * Creates the smallest range that includes the current range and a given value. * - * @param { ScopeType } value - A ScopeType value - * @returns { ScopeHelper } Returns the smallest range that includes the current range and a given value. + * @param { T } value - A ScopeType value + * @returns { ScopeHelper } Returns the smallest range that includes the current range and a given value. + * @syscap SystemCapability.Utils.Lang * @since 20 + * @arkts 1.2 */ expand(value: T): ScopeHelper; /** * Checks whether a given value is within the current range. * - * @param { ScopeType } value - A ScopeType value + * @param { T } value - A ScopeType value * @returns { boolean } If the value is within the current range return true,otherwise return false. + * @syscap SystemCapability.Utils.Lang * @since 20 + * @arkts 1.2 */ contains(value: T): boolean; /** * Checks whether a given range is within the current range. * - * @param { ScopeHelper } range - A Scope range + * @param { ScopeHelper } range - A Scope range * @returns { boolean } If the current range is within the given range return true,otherwise return false. + * @syscap SystemCapability.Utils.Lang * @since 20 + * @arkts 1.2 */ contains(range: ScopeHelper): boolean; /** * Clamps a given value to the current range. * - * @param { ScopeType } value - A ScopeType value - * @returns { ScopeType } Returns a ScopeType object that a given value is clamped to the current range. + * @param { T } value - A ScopeType value + * @returns { T } Returns a ScopeType object that a given value is clamped to the current range. + * @syscap SystemCapability.Utils.Lang * @since 20 + * @arkts 1.2 */ clamp(value: T): T; } + /** + * Provides APIs to discard the least recently used data to make rooms for new elements when the cache is full. + * This class uses the Least Recently Used (LRU) algorithm, + * which believes that the recently used data may be accessed again in the near future + * and the least accessed data is the least valuable data and should be removed from the cache. + * + * @syscap SystemCapability.Utils.Lang + * @since 20 + * @arkts 1.2 + */ class LRUCache { /** * Default constructor used to create a new LruBuffer instance with the default capacity of 64. * * @param { number } [capacity] - Indicates the capacity to customize for the buffer. - * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ constructor(capacity?: number); @@ -387,33 +413,30 @@ declare namespace util { * Updates the buffer capacity to a specified capacity. * * @param { number } newCapacity - Indicates the new capacity to set. - * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ updateCapacity(newCapacity: number): void; /** * Returns a string representation of the object. * - * @returns { string } Returns the string representation of the object and outputs the string representation of the object. + * @returns { string } Returns the string representation of the object and + * outputs the string representation of the object. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ toString(): string; /** * Obtains a list of all values in the current buffer. * - * @type { number } + * @returns { number } The length of LRUCache * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ get length(): number; @@ -422,9 +445,8 @@ declare namespace util { * * @returns { number } Returns the capacity of the current buffer. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ getCapacity(): number; @@ -432,9 +454,8 @@ declare namespace util { * Clears key-value pairs from the current buffer. * * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ clear(): void; @@ -443,9 +464,8 @@ declare namespace util { * * @returns { number } Returns the number of times createDefault(java.lang.Object) returned a value. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ getCreateCount(): number; @@ -454,9 +474,8 @@ declare namespace util { * * @returns { number } Returns the number of times that the queried values are not matched. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ getMissCount(): number; @@ -465,9 +484,8 @@ declare namespace util { * * @returns { number } Returns the number of times that values are evicted from the buffer. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ getRemovalCount(): number; @@ -476,9 +494,8 @@ declare namespace util { * * @returns { number } Returns the number of times that the queried values are successfully matched. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ getMatchCount(): number; @@ -487,9 +504,8 @@ declare namespace util { * * @returns { number } Returns the number of times that values are added to the buffer. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ getPutCount(): number; @@ -498,9 +514,8 @@ declare namespace util { * * @returns { boolean } Returns true if the current buffer contains no value. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ isEmpty(): boolean; @@ -508,14 +523,11 @@ declare namespace util { * Obtains the value associated with a specified key. * * @param { K } key - Indicates the key to query. - * @returns { V | undefined } Returns the value associated with the key if the specified key is present in the buffer; returns null otherwise. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified; - * 2.Incorrect parameter types. + * @returns { V | undefined } Returns the value associated with the key + * if the specified key is present in the buffer; returns null otherwise. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ get(key: K): V | undefined; @@ -524,25 +536,22 @@ declare namespace util { * * @param { K } key - Indicates the key to add. * @param { V } value - Indicates the value associated with the key to add. - * @returns { V | undefined } Returns the value associated with the added key; returns the original value if the key to add already exists, returns null otherwise. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified; - * 2.Incorrect parameter types. + * @returns { V | undefined } Returns the value associated with the added key; + * returns the original value if the key to add already exists, returns null otherwise. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ put(key: K, value: V): V | undefined; /** * Obtains a list of all values in the current buffer. * - * @returns { Array } Returns the list of all values in the current buffer, ordered from the most recently accessed to the least recently accessed. + * @returns { Array } Returns the list of all values in the current buffer, + * ordered from the most recently accessed to the least recently accessed. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ values(): Array; @@ -550,11 +559,11 @@ declare namespace util { * Obtains a list of keys for the values in the current buffer. * since 9 * - * @returns { Array } Returns a list of keys ordered by access time, from the most recently accessed to the least recently accessed. + * @returns { Array } Returns a list of keys ordered by access time, + * from the most recently accessed to the least recently accessed. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ keys(): Array; @@ -562,14 +571,11 @@ declare namespace util { * Deletes a specified key and its associated value from the current buffer. * * @param { K } key - Indicates the key to delete. - * @returns { V | undefined } Returns an Optional object containing the deleted key-value pair; returns an empty Optional object if the key does not exist. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified; - * 2.Incorrect parameter types. + * @returns { V | undefined } Returns an Optional object containing the deleted key-value pair; + * returns an empty Optional object if the key does not exist. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ remove(key: K): V | undefined; @@ -580,15 +586,12 @@ declare namespace util { * and the parameter value is false in other cases. * @param { K } key - Indicates the deleted key. * @param { V } value - Indicates the deleted value. - * @param { V } newValue - The parameter value is the new value associated if the put(java.lang.Object,java.lang.Object) - * method is called and the key to add already exists. The parameter value is null in other cases. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified; - * 2.Incorrect parameter types. + * @param { V } newValue - The parameter value is the new value associated if the + * put(java.lang.Object,java.lang.Object) method is called and the key to add already exists. + * The parameter value is null in other cases. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ afterRemoval(isEvict: boolean, key: K, value: V, newValue: V): void; @@ -597,13 +600,9 @@ declare namespace util { * * @param { K } key - Indicates the key to check. * @returns { boolean } Returns true if the buffer contains the specified key. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified; - * 2.Incorrect parameter types. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ contains(key: K): boolean; @@ -612,24 +611,20 @@ declare namespace util { * * @param { K } key - Indicates the missed key. * @returns { V | undefined } Returns the value associated with the key. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified; - * 2.Incorrect parameter types. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ createDefault(key: K): V | undefined; /** * Returns an array of key-value pairs of enumeratable properties of a given object. * - * @returns { IterableIterator<[K, V]> } Returns an array of key-value pairs for the enumeratable properties of the given object itself. + * @returns { IterableIterator<[K, V]> } Returns an array of key-value pairs + * for the enumeratable properties of the given object itself. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ entries(): IterableIterator<[K, V]>; @@ -638,9 +633,8 @@ declare namespace util { * * @returns { IterableIterator<[K, V]> } Returns a two - dimensional array in the form of key - value pairs. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ $_iterator(): IterableIterator<[K, V]>; } @@ -650,18 +644,16 @@ declare namespace util { * * @interface TextDecoderOptions * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ interface TextDecoderOptions { /** * Is a fatal error displayed? The default value is false. * @type { ?boolean } * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ fatal?: boolean; @@ -669,9 +661,8 @@ declare namespace util { * Do you want to ignore BOM tags? The default value is false. * @type { ?boolean } * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ ignoreBOM?: boolean; } @@ -681,18 +672,16 @@ declare namespace util { * * @interface DecodeToStringOptions * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ interface DecodeToStringOptions { /** * Stream option controls stream processing in decoding. The default value is false. * @type { ?boolean } * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ stream?: boolean; } @@ -702,36 +691,29 @@ declare namespace util { * koi8-r, macintosh, windows-1250, windows-1251, gbk, gb18030, big5, utf-16be, utf-16 le, etc. * * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ class StringDecoder { /** * The StringDecoder constructor. * * @param { string } [encoding] - Encoding type of the input data.Default: utf8. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified; * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ constructor(encoding?: string); /** - * Returns a decoded string, ensuring that any incomplete multiple byte characters at the end of the Uint8Array are + * Returns a decoded string, ensuring that any incomplete multiple byte characters at the end of the Uint8Array are * omitted from the returned string and stored in an internal buffer. * * @param { string | Uint8Array } chunk - The bytes to decode. * @returns { string } Returns a decoded string. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified; * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ write(chunk: string | Uint8Array): string; @@ -741,12 +723,9 @@ declare namespace util { * * @param { string | Uint8Array } [chunk] - The bytes to decode. * @returns { string } Returns any remaining input stored in the internal buffer as a string. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified; * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ end(chunk?: string | Uint8Array): string; } @@ -756,51 +735,46 @@ declare namespace util { * decodes it in UTF-8 format, and outputs UTF-8 byte stream. * * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ class TextDecoder { /** * The textDecoder constructor. * * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ constructor(); /** * The source encoding's name, lowercased. * - * @return { string } The string of the TextDecoder encoding. + * @returns { string } The string of the TextDecoder encoding. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ get encoding(): string; /** * Returns `true` if error mode is "fatal", and `false` otherwise. * - * @return { boolean } Whether to display fatal errors. + * @returns { boolean } Whether to display fatal errors. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ get fatal(): boolean; /** * Returns `true` if ignore BOM flag is set, and `false` otherwise. * - * @return { boolean } Returns `true` if ignore BOM flag is set, and `false` otherwise. + * @returns { boolean } Returns `true` if ignore BOM flag is set, and `false` otherwise. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ get ignoreBOM(): boolean; @@ -810,10 +784,10 @@ declare namespace util { * @param { string } [encoding] - Decoding format * @param { TextDecoderOptions } [options] - Options * @returns { TextDecoder } + * @static * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ static create(encoding?: string, options?: TextDecoderOptions): TextDecoder; @@ -826,11 +800,9 @@ declare namespace util { * @param { Uint8Array } input - Decoded numbers in accordance with the format. * @param { DecodeToStringOptions } [options] - The default option is set to false. * @returns { string } Return decoded text - * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Parameter verification failed; * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ decodeToString(input: Uint8Array, options?: DecodeToStringOptions): string; } @@ -840,18 +812,16 @@ declare namespace util { * * @interface EncodeIntoUint8ArrayInfo * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ interface EncodeIntoUint8ArrayInfo { /** * The read represents the number of characters that have been encoded. * @type { int } * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ read: int; @@ -859,9 +829,8 @@ declare namespace util { * The written represents the number of bytes occupied by the encoded characters. * @type { int } * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ written: int; } @@ -870,18 +839,16 @@ declare namespace util { * The rational number is mainly to compare rational numbers and obtain the numerator and denominator. * * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ class RationalNumber { /** * A constructor used to create a RationalNumber instance with a given numerator and denominator. * * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ constructor(); @@ -891,13 +858,10 @@ declare namespace util { * @param { number } numerator - An integer number * @param { number } denominator - An integer number * @returns { RationalNumber } - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified; - * 2.Incorrect parameter types. + * @static * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ static parseRationalNumber(numerator: number, denominator: number): RationalNumber; @@ -906,11 +870,10 @@ declare namespace util { * * @param { string } rationalString - String Expression of Rational Numbers * @returns { RationalNumber } Returns a RationalNumber object generated based on the given string. - * @throws { BusinessError } 401 - The type of rationalString must be string. + * @static * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ static createRationalFromString(rationalString: string): RationalNumber; @@ -919,13 +882,9 @@ declare namespace util { * * @param { RationalNumber } another - An object of other rational numbers * @returns { number } Returns 0 or 1, or -1, depending on the comparison. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified; - * 2.Incorrect parameter types. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ compare(another: RationalNumber): number; @@ -936,9 +895,8 @@ declare namespace util { * @returns { boolean } Returns true if the given object is the same as the current object; * Otherwise, false is returned. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ equals(obj: Object): boolean; @@ -947,9 +905,8 @@ declare namespace util { * * @returns { number } Returns the integer and floating-point values of a rational number object. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 12 + * @since 20 + * @arkts 1.2 */ valueOf(): number; @@ -959,13 +916,10 @@ declare namespace util { * @param { number } number1 - Is an integer. * @param { number } number2 - Is an integer. * @returns { number } Returns the greatest common factor of two integers, integer type. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified; - * 2.Incorrect parameter types. + * @static * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ static getCommonFactor(number1: number, number2: number): number; @@ -974,9 +928,8 @@ declare namespace util { * * @returns { number } Returns the denominator of the current object. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ getDenominator(): number; @@ -985,9 +938,8 @@ declare namespace util { * * @returns { number } Returns the numerator of the current object. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ getNumerator(): number; @@ -996,9 +948,8 @@ declare namespace util { * * @returns { boolean } If the denominator is not 0, true is returned. Otherwise, false is returned. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ isFinite(): boolean; @@ -1007,9 +958,8 @@ declare namespace util { * * @returns { boolean } If both the denominator and numerator are 0, true is returned. Otherwise, false is returned. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ isNaN(): boolean; @@ -1019,9 +969,8 @@ declare namespace util { * @returns { boolean } If the value represented by the current object is 0, true is returned. * Otherwise, false is returned. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ isZero(): boolean; @@ -1030,9 +979,8 @@ declare namespace util { * * @returns { string } Returns a string representation of the current RationalNumber object. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ toString(): string; } @@ -1042,19 +990,17 @@ declare namespace util { * The encoder takes the byte stream as the input and outputs the String string. * * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ class TextEncoder { /** * Encoding format. * - * @return { string } The string of the TextEncoder encoding. + * @returns { string } The string of the TextEncoder encoding. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ get encoding(): string; @@ -1062,11 +1008,9 @@ declare namespace util { * The textEncoder constructor. * * @param { string } [encoding] - The string for encoding format. - * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Parameter verification failed. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ constructor(encoding?: string); @@ -1075,11 +1019,10 @@ declare namespace util { * * @param { string } [encoding] - The string for encoding format. * @returns { TextEncoder } - * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Parameter verification failed. + * @static * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ static create(encoding?: string): TextEncoder; @@ -1089,9 +1032,8 @@ declare namespace util { * @param { string } [input] - The string to be encoded. * @returns { Uint8Array } Returns the encoded text. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ encodeInto(input?: string): Uint8Array; @@ -1104,19 +1046,18 @@ declare namespace util { * the number of characters that have been encoded, and written * represents the number of bytes occupied by the encoded characters. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ encodeIntoUint8Array(input: string, dest: Uint8Array): EncodeIntoUint8ArrayInfo; } + /** * Check the type of parameter. * * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ class types { @@ -1126,9 +1067,8 @@ declare namespace util { * @param { Object } value - A ArrayBuffer or SharedArrayBuffer value * @returns { boolean } Returns true if the value is a built-in ArrayBuffer or SharedArrayBuffer instance. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ isAnyArrayBuffer(value: Object): boolean; /** @@ -1138,9 +1078,8 @@ declare namespace util { * @returns { boolean } Returns true if the value is an instance of one of the ArrayBuffer views, * such as typed array objects or DataView. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ isArrayBufferView(value: Object): boolean; /** @@ -1151,9 +1090,8 @@ declare namespace util { * This does not include SharedArrayBuffer instances. * Usually, it is desirable to test for both; See isAnyArrayBuffer() for that. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ isArrayBuffer(value: Object): boolean; /** @@ -1162,9 +1100,8 @@ declare namespace util { * @param { Object } value - A BigInt64Array value * @returns { boolean } Returns true if the value is a BigInt64Array instance. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ isBigInt64Array(value: Object): boolean; /** @@ -1173,9 +1110,8 @@ declare namespace util { * @param { Object } value - A BigUint64Array value * @returns { boolean } Returns true if the value is a BigUint64Array instance. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ isBigUint64Array(value: Object): boolean; /** @@ -1184,9 +1120,8 @@ declare namespace util { * @param { Object } value - A DataView value * @returns { boolean } Returns true if the value is a built-in DataView instance. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ isDataView(value: Object): boolean; /** @@ -1195,9 +1130,8 @@ declare namespace util { * @param { Object } value - A Date value * @returns { boolean } Returns true if the value is a built-in Date instance. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ isDate(value: Object): boolean; /** @@ -1206,9 +1140,8 @@ declare namespace util { * @param { Object } value - A Float32Array value * @returns { boolean } Returns true if the value is a built-in Float32Array instance. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ isFloat32Array(value: Object): boolean; /** @@ -1217,9 +1150,8 @@ declare namespace util { * @param { Object } value - A Float64Array value * @returns { boolean } Returns true if the value is a built-in Float64Array instance. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ isFloat64Array(value: Object): boolean; /** @@ -1228,9 +1160,8 @@ declare namespace util { * @param { Object } value - A Int8Array value * @returns { boolean } Returns true if the value is a built-in Int8Array instance. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ isInt8Array(value: Object): boolean; /** @@ -1239,9 +1170,8 @@ declare namespace util { * @param { Object } value - A Int16Array value * @returns { boolean } Returns true if the value is a built-in Int16Array instance. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ isInt16Array(value: Object): boolean; /** @@ -1250,9 +1180,8 @@ declare namespace util { * @param { Object } value - A Int32Array value * @returns { boolean } Returns true if the value is a built-in Int32Array instance. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ isInt32Array(value: Object): boolean; /** @@ -1261,9 +1190,8 @@ declare namespace util { * @param { Object } value - A Map value * @returns { boolean } Returns true if the value is a built-in Map instance. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ isMap(value: Object): boolean; /** @@ -1272,9 +1200,8 @@ declare namespace util { * @param { Object } value - A Map iterator value * @returns { boolean } Returns true if the value is an iterator returned for a built-in Map instance. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ isMapIterator(value: Object): boolean; /** @@ -1283,9 +1210,8 @@ declare namespace util { * @param { Object } value - A Error value * @returns { boolean } Returns true if the value is an instance of a built-in Error type. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ isNativeError(value: Object): boolean; /** @@ -1294,9 +1220,8 @@ declare namespace util { * @param { Object } value - A Promise value * @returns { boolean } Returns true if the value is a built-in Promise. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ isPromise(value: Object): boolean; /** @@ -1305,9 +1230,8 @@ declare namespace util { * @param { Object } value - A regular expression object value * @returns { boolean } Returns true if the value is a regular expression object. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ isRegExp(value: Object): boolean; /** @@ -1316,9 +1240,8 @@ declare namespace util { * @param { Object } value - A Set instance value * @returns { boolean } Returns true if the value is a built-in Set instance. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ isSet(value: Object): boolean; /** @@ -1327,9 +1250,8 @@ declare namespace util { * @param { Object } value - A Set iterator value * @returns { boolean } Returns true if the value is an iterator returned for a built-in Set instance. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ isSetIterator(value: Object): boolean; /** @@ -1338,9 +1260,8 @@ declare namespace util { * @param { Object } value - A TypedArray instance value * @returns { boolean } Returns true if the value is a built-in TypedArray instance. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ isTypedArray(value: Object): boolean; /** @@ -1349,9 +1270,8 @@ declare namespace util { * @param { Object } value - A Uint8Array value * @returns { boolean } Returns true if the value is a built-in Uint8Array instance. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ isUint8Array(value: Object): boolean; /** @@ -1360,9 +1280,8 @@ declare namespace util { * @param { Object } value - A Uint8ClampedArray value * @returns { boolean } Returns true if the value is a built-in Uint8ClampedArray instance. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ isUint8ClampedArray(value: Object): boolean; /** @@ -1371,9 +1290,8 @@ declare namespace util { * @param { Object } value - A Uint16Array value * @returns { boolean } Returns true if the value is a built-in Uint16Array instance. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ isUint16Array(value: Object): boolean; /** @@ -1382,9 +1300,8 @@ declare namespace util { * @param { Object } value - A Uint32Array value * @returns { boolean } Returns true if the value is a built-in Uint32Array instance. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ isUint32Array(value: Object): boolean; /** @@ -1393,9 +1310,8 @@ declare namespace util { * @param { Object } value - A WeakMap value * @returns { boolean } Returns true if the value is a built-in WeakMap instance. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ isWeakMap(value: Object): boolean; /** @@ -1404,23 +1320,68 @@ declare namespace util { * @param { Object } value - A WeakSet value * @returns { boolean } Returns true if the value is a built-in WeakSet instance. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 */ isWeakSet(value: Object): boolean; } + /** + * The type of promisify return function + * + * @typedef { function } promisifiedFunc + * @param { FixedArray } args - arguments to be passed + * @returns { Promise } - a promise value + * @syscap SystemCapability.Utils.Lang + * @since 20 + * @arkts 1.2 + */ + type PromisifiedFunc = (...args: FixedArray) => Promise; + + /** + * Takes a function following the common error-first callback style, i.e taking an (err, value) => + * callback as the last argument, and return a function that returns promises. + * + * @param { Function } original - Asynchronous Function + * @returns { PromisifiedFunc } Return a function that returns promises + * @syscap SystemCapability.Utils.Lang + * @since 20 + * @arkts 1.2 + */ + function promisify(original: Function): PromisifiedFunc; + /** * Get the hash code of an object. * - * @param { object } [obj] - The object that need to get hash code. + * @param { RecordData } obj - The object that need to get hash code. * @returns { number } Return a hash code of an object. * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice * @since 20 + * @arkts 1.2 + */ + function getHash(obj: RecordData): number; + + /** + * Generate a random RFC 4122 version 4 binary UUID using a cryptographically secure random number generator. + * + * @param { boolean } [entropyCache] - Whether to generate the UUID with using the cache. Default: true. + * @returns { Uint8Array | undefined } Return a Uint8Array representing this UUID, or undefined on failure. + * @syscap SystemCapability.Utils.Lang + * @since 20 + * @arkts 1.2 + */ + function generateRandomBinaryUUID(entropyCache?: boolean): Uint8Array | undefined; + + /** + * Parse a UUID from the string standard representation as described in the RFC 4122 version 4. + * + * @param { string } uuid - String that specifies a UUID + * @returns { Uint8Array } Return a Uint8Array representing this UUID. Throw SyntaxError if parsing fails. + * @throws { BusinessError } 10200002 - Invalid uuid string. + * @syscap SystemCapability.Utils.Lang + * @since 20 + * @arkts 1.2 */ - function getHash(obj: object): number; + function parseUUID(uuid: string): Uint8Array; } export default util; diff --git a/api/@ohos.util.stream.d.ts b/api/@ohos.util.stream.d.ts index 9680254afd..c6735e4187 100644 --- a/api/@ohos.util.stream.d.ts +++ b/api/@ohos.util.stream.d.ts @@ -17,35 +17,61 @@ * @file * @kit ArkTS */ - import { Callback } from './@ohos.base'; - import emitter from './@ohos.events.emitter'; - - /** - * The stream module provides a comprehensive set of stream processing capabilities, including four types of streams: - * - Writable: streams designed for writing data to. - * - Readable: streams designed for reading data from. - * - Duplex: streams that are both readable and writable. - * - Transform: a specialized type of duplex stream that can modify or transform data as it's being written and read. - * - * @namespace stream - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 - */ + +/*** if arkts 1.1 */ +import { Callback } from './@ohos.base'; +import emitter from './@ohos.events.emitter'; +/*** endif */ +/*** if arkts 1.2 */ +import buffer from '@ohos.buffer'; +/*** endif */ + +/** + * The stream module provides a comprehensive set of stream processing capabilities, including four types of streams: + * - Writable: streams designed for writing data to. + * - Readable: streams designed for reading data from. + * - Duplex: streams that are both readable and writable. + * - Transform: a specialized type of duplex stream that can modify or transform data as it's being written and read. + * + * @namespace stream + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ declare namespace stream { /** - * The type of stream callback function. + * Return readable options. * - * @typedef { function } StreamCb - * @returns { void } - The function return void + * @interface ReadableOptions * @syscap SystemCapability.Utils.Lang + * @crossplatform * @atomicservice - * @since 20 - * @arkts 1.2 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ - type StreamCb = () => void; + interface ReadableOptions { + /** + * Specifies the encoding format of the data. If this parameter is provided, + * the readable stream decodes the data into a string in the specified encoding format. Default: utf8. + * If an invalid string is entered, a 401 exception is thrown in the Readable constructor. + * Supported encoding 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-cyrillic, gbk, gb18030, big5, euc-jp, iso-2022-jp, shift_jis, + * euc-kr, utf-16be, utf-16le. + * + * @type { ?string } + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + encoding?: string; + } + /** * Streams to which data can be written. * @@ -66,6 +92,7 @@ declare namespace stream { * @arkts 1.1&1.2 */ constructor(); + /** * writes a chunk to Writable and invokes callback when the chunk is flushed. The return value indicates * whether the internal buffer of the Writable reaches the hightWaterMark. If true is returned, the buffer @@ -87,31 +114,11 @@ declare namespace stream { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ write(chunk?: string | Uint8Array, encoding?: string, callback?: Function): boolean; - /** - * writes a chunk to Writable and invokes callback when the chunk is flushed. The return value indicates - * whether the internal buffer of the Writable reaches the hightWaterMark. If true is returned, the buffer - * does not reach the hightWaterMark. If false is returned, the buffer has been reached. The write function - * should be called after the drain event is triggered. If the write function is called continuously, - * the chunk is still added to the buffer until the memory overflows - * - * @param { string | Uint8Array } [chunk] - Data to be written. - * @param { string } [encoding] - Encoding type. - * @param { StreamCb } [callback] - Callback after writing. - * @returns { boolean } Write success returns true, write failure returns false. - * @throws { BusinessError } 10200035 - The doWrite method has not been implemented. - * @throws { BusinessError } 10200036 - The stream has been ended. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - write(chunk?: string | Uint8Array, encoding?: string, callback?: StreamCb): boolean; - /** * Write the last chunk to Writable. * @@ -127,26 +134,11 @@ declare namespace stream { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ end(chunk?: string | Uint8Array, encoding?: string, callback?: Function): Writable; - /** - * Write the last chunk to Writable. - * - * @param { string | Uint8Array } [chunk] - Data to be written. - * @param { string } [encoding] - Encoding type. - * @param { StreamCb } [callback] - Callback after writing. - * @returns { Writable } Returns the Writable object. - * @throws { BusinessError } 10200035 - The doWrite method has not been implemented. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - end(chunk?: string | Uint8Array, encoding?: string, callback?: StreamCb): Writable; - /** * Set the default encoding mode. * @@ -163,6 +155,7 @@ declare namespace stream { * @arkts 1.1&1.2 */ setDefaultEncoding(encoding?: string): boolean; + /** * After the call, all Write operations will be forced to write to the buffer instead of being flushed. * @@ -174,6 +167,7 @@ declare namespace stream { * @arkts 1.1&1.2 */ cork(): boolean; + /** * After calling, flush all buffers. * @@ -185,6 +179,7 @@ declare namespace stream { * @arkts 1.1&1.2 */ uncork(): boolean; + /** * Registering Event Messages. * @@ -197,30 +192,28 @@ declare namespace stream { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ on(event: string, callback: Callback): void; + /** - * Cancel event message. + * Registering Event Messages. * * @param { string } event - Register Event. - * @param { Callback } callback - event callbacks. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified; - * 2.Incorrect parameter types. + * @param { Function } callback - event callbacks. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 */ - off(event: string, callback?: Callback): void; + on(event: string, callback: Function): void; + /** - * This method is invoked by the Writable method during initialization and must not be invoked directly. - * After the resource is initialized in the doInitialize method, the callback () method is invoked. + * Cancel event message. * - * @param { Function } callback - Callback when the stream has completed the initial. + * @param { string } event - Register Event. + * @param { Callback } callback - event callbacks. * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types. @@ -229,58 +222,62 @@ declare namespace stream { * @atomicservice * @since 12 */ - doInitialize(callback: Function): void; + off(event: string, callback?: Callback): void; /** - * This method is invoked by the Writable method during initialization and must not be invoked directly. - * After the resource is initialized in the doInitialize method, the callback () method is invoked. + * Cancel event message. * - * @param { StreamCb } callback - Callback when the stream has completed the initial. + * @param { string } event - Register Event. + * @param { Function } [callback] - event callbacks. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - doInitialize(callback: StreamCb): void; + off(event: string, callback?: Function): void; /** - * Implemented by subclass inheritance. The implementation logic of flushing chunks in the buffer must not be - * directly called. The call is controlled by Writable.write. + * This method is invoked by the Writable method during initialization and must not be invoked directly. + * After the resource is initialized in the doInitialize method, the callback () method is invoked. * - * @param { string | Uint8Array } chunk - Data to be written. - * @param { string } encoding - Encoding type. - * @param { Function } callback - Callback after writing. + * @param { Function } callback - Callback when the stream has completed the initial. * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; - * 2.Incorrect parameter types; - * 3.Parameter verification failed. + * 2.Incorrect parameter types. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ - doWrite(chunk: string | Uint8Array, encoding: string, callback: Function): void; + doInitialize(callback: Function): void; + /** * Implemented by subclass inheritance. The implementation logic of flushing chunks in the buffer must not be * directly called. The call is controlled by Writable.write. * - * @param { string | Uint8Array } chunk - Data to be written. - * @param { string } encoding - Encoding type. - * @param { StreamCb } callback - Callback after writing. + * @param { string | Uint8Array } [chunk] - Data to be written. + * @param { string } [encoding] - Encoding type. + * @param { Function } [callback] - Callback after writing. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 20 - * @arkts 1.2 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ - doWrite(chunk: string | Uint8Array, encoding: string, callback: StreamCb): void; + doWrite(chunk: string | Uint8Array, encoding: string, callback: Function): void; + /** * The implementation logic of flushing chunks in the buffer in batches should not be actively called. * The call is controlled by Writable.write. * - * @param { string[] | Uint8Array[] } chunks - Data to be written. - * @param { Function } callback - Callback after writing. + * @param { string[] | Uint8Array[] } [chunks] - Data to be written. + * @param { Function } [callback] - Callback after writing. * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types; @@ -288,225 +285,94 @@ declare namespace stream { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ doWritev(chunks: string[] | Uint8Array[], callback: Function): void; - /** - * The implementation logic of flushing chunks in the buffer in batches should not be actively called. - * The call is controlled by Writable.write. - * - * @param { string[] | Uint8Array[] } chunks - Data to be written. - * @param { StreamCb } callback - Callback after writing. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - doWritev(chunks: string[] | Uint8Array[], callback: StreamCb): void; /** * Returns boolean indicating whether it is in ObjectMode. * * @type { boolean } - * @readonly * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - readonly writableObjectMode: boolean; + get writableObjectMode(): boolean; + /** * Value of highWatermark. * - * @type { number } - * @readonly + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - readonly writableHighWatermark: number; + get writableHighWatermark(): int; + /** * Is true if it is safe to call writable.write(), which means the stream has not been destroyed, error or end. * * @type { boolean } - * @readonly * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - readonly writable: boolean; + get writable(): boolean; + /** * Size of data that can be flushed, in bytes or objects. * - * @type { number } - * @readonly + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - readonly writableLength: number; + get writableLength(): int; + /** * Number of times writable.uncork() needs to be called in order to fully uncork the stream. * - * @type { number } - * @readonly + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - readonly writableCorked: number; + get writableCorked(): int; + /** * Whether Writable.end has been called. * * @type { boolean } - * @readonly * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - readonly writableEnded: boolean; + get writableEnded(): boolean; + /** * Whether Writable.end has been called and all buffers have been flushed. * * @type { boolean } - * @readonly * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - readonly writableFinished: boolean; - } - /** - * Transform stream is a Duplex stream where the output is computed in some way from the input. - * Transform implementations must implement the doTransform() method and may also implement the doFlush() method. - * - * @extends Duplex - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 - */ - class Transform extends Duplex { - /** - * The Transform constructor. - * - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 - */ - constructor(); - /** - * Convert the input data. After the conversion, Transform.push can be called to send the input to the read stream. - * Transform.push should not be called Transform.write to call. - * - * @param { string } chunk - Input data to be converted. - * @param { string } encoding - If the chunk is a string, then this is the encoding type. If chunk is a buffer, - * then this is the special value 'buffer'. Ignore it in that case. - * @param { Function } callback - Callback after conversion. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified; - * 2.Incorrect parameter types; - * 3.Parameter verification failed. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 12 - */ - doTransform(chunk: string, encoding: string, callback: Function): void; - - /** - * Convert the input data. After the conversion, Transform.push can be called to send the input to the read stream. - * Transform.push should not be called Transform.write to call. - * - * @param { string } chunk - Input data to be converted. - * @param { string } encoding - If the chunk is a string, then this is the encoding type. If chunk is a buffer, - * then this is the special value 'buffer'. Ignore it in that case. - * @param { StreamCb } callback - Callback after conversion. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - doTransform(chunk: string, encoding: string, callback: StreamCb): void; - - /** - * After all data is flushed to the write stream, you can use the Transform.doFlush writes some extra data, must - * not be called directly, only called by Writable after flushing all data. - * - * @param { Function } callback - Callback after flush completion. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified; - * 2.Incorrect parameter types; - * 3.Parameter verification failed. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 12 - */ - doFlush(callback: Function): void; - - /** - * After all data is flushed to the write stream, you can use the Transform.doFlush writes some extra data, must - * not be called directly, only called by Writable after flushing all data. - * - * @param { StreamCb } callback - Callback after flush completion. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - doFlush(callback: StreamCb): void; - - } - - /** - * Return readable options. - * - * @interface ReadableOptions - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 - */ - interface ReadableOptions { - /** - * Specifies the encoding format of the data. If this parameter is provided, - * the readable stream decodes the data into a string in the specified encoding format. Default: utf8. - * If an invalid string is entered, a 401 exception is thrown in the Readable constructor. - * Supported encoding 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-cyrillic, gbk, gb18030, big5, euc-jp, iso-2022-jp, shift_jis, - * euc-kr, utf-16be, utf-16le. - * - * @type { ?string } - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 - */ - encoding?: string; + get writableFinished(): boolean; } /** @@ -558,10 +424,29 @@ declare namespace stream { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ read(size?: number): string | null; + + /** + * Reads a buffer of a specified size from the buffer. If the available buffer is sufficient, the result + * of the specified size is returned. Otherwise, if Readable has ended, all remaining buffers are returned. + * + * @param { int } [size] - Expected length of the data to be read. + * @returns { buffer.Buffer | string | null } If no data is available to read, null is returned. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200038 - The doRead method has not been implemented. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + read(size?: int): buffer.Buffer | string | null; + /** * Switch Readable to Streaming Mode. * @@ -654,10 +539,21 @@ declare namespace stream { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ on(event: string, callback: Callback): void; + /** + * Registering Event Messages. + * + * @param { string } event - Registering Events. + * @param { Function } callback - Event callback. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + on(event: string, callback: Function): void; /** * Cancel event message. * @@ -669,45 +565,44 @@ declare namespace stream { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ off(event: string, callback?: Callback): void; /** - * It may be implemented by child classes, and if so, will be called by the Readable class methods only. - * It must not be called directly. + * Cancel event message. * - * @param { Function } callback - Callback when the stream has completed the initial. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified; - * 2.Incorrect parameter types; - * 3.Parameter verification failed. + * @param { string } event - Registering Events. + * @param { Function } [callback] - Event callback. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since 20 + * @arkts 1.2 */ - doInitialize(callback: Function): void; - + off(event: string, callback?: Function): void; /** * It may be implemented by child classes, and if so, will be called by the Readable class methods only. * It must not be called directly. * - * @param { StreamCb } callback - Callback when the stream has completed the initial. + * @param { Function } callback - Callback when the stream has completed the initial. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 20 - * @arkts 1.2 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ - doInitialize(callback: StreamCb): void; + doInitialize(callback: Function): void; /** * The specific implementation of data production. It must not be actively called. * After data production, Readable.push should be called to push the produced data into the buffer. * If push is not called, doRead will not be called again. * - * @param { number } size - Expected length of the data to be read. + * @param { int } size - Expected length of the data to be read. * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; * 2.Incorrect parameter types; @@ -718,7 +613,8 @@ declare namespace stream { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - doRead(size: number): void; + doRead(size: int): void; + /** * Adds the generated data to the buffer. The return value indicates whether the data in the buffer has not * reached the highWaterMark (similar to Writable.write). If the chunk is null, all data has been generated. @@ -733,96 +629,109 @@ declare namespace stream { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} + * @since 12 + */ + /** + * Adds the generated data to the buffer. The return value indicates whether the data in the buffer has not + * reached the highWaterMark (similar to Writable.write). If the chunk is null, all data has been generated. + * + * @param { Uint8Array | string | undefined | null } chunk - Binary data to be stored in the buffer. + * @param { string } [encoding] - Binary data encoding type. + * @returns { boolean } If true is returned, the data in the buffer reaches the highWaterMark. Otherwise, the + * data in the buffer does not reach the highWaterMark. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'20', '1.2':'20'} * @arkts 1.1&1.2 */ - push(chunk: Uint8Array | string | null, encoding?: string): boolean; + push(chunk: Uint8Array | string | undefined | null, encoding?: string): boolean; + /** * Returns boolean indicating whether it is in ObjectMode. * * @type { boolean } - * @readonly * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - readonly readableObjectMode: boolean; + get readableObjectMode(): boolean; + /** * Is true if it is safe to call readable.read(), which means * the stream has not been destroyed or emitted 'error' or 'end'. * * @type { boolean } - * @readonly * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - readonly readable: boolean; + get readable(): boolean; + /** * Returns the value of highWatermark passed when creating this Readable. * - * @type { number } - * @readonly + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - readonly readableHighWatermark: number; + get readableHighWatermark(): int; + /** * This property reflects the current state of the readable stream null/true/false. * * @type { boolean | null } - * @readonly * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - readonly readableFlowing: boolean | null; + get readableFlowing(): boolean | null; + /** * Size of the data that can be read, in bytes or objects. * - * @type { number } - * @readonly + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - readonly readableLength: number; + get readableLength(): int; + /** * Getter for the property encoding of a given Readable stream. The encoding property can be set using the * readable.setEncoding() method. * * @type { string | null } - * @readonly * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - readonly readableEncoding: string | null; + get readableEncoding(): string | null; + /** * Whether all data has been generated. * * @type { boolean } - * @readonly * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - readonly readableEnded: boolean; + get readableEnded(): boolean; } /** * Duplex streams are streams that implement both the Readable streams and Writable streams interfaces. @@ -866,32 +775,11 @@ declare namespace stream { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ write(chunk?: string | Uint8Array, encoding?: string, callback?: Function): boolean; - /** - * writes a chunk to Writable and invokes callback when the chunk is flushed. The return value indicates - * whether the internal buffer of the Writable reaches the hightWaterMark. If true is returned, the buffer - * does not reach the hightWaterMark. If false is returned, the buffer has been reached. The write function - * should be called after the drain event is triggered. If the write function is called continuously, - * the chunk is still added to the buffer until the memory overflows - * - * @param { string | Uint8Array } [chunk] - Data to be written. - * @param { string } [encoding] - Encoding type. - * @param { StreamCb } [callback] - Callback after writing. - * @returns { boolean } Write success returns true, write failure returns false. - * @throws { BusinessError } 10200036 - The stream has been ended. - * @throws { BusinessError } 10200037 - The callback is invoked multiple times consecutively. - * @throws { BusinessError } 10200039 - The doTransform method has not been implemented for a class that inherits from Transform. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - write(chunk?: string | Uint8Array, encoding?: string, callback?: StreamCb): boolean; - /** * Write the last chunk to Writable. * @@ -907,26 +795,11 @@ declare namespace stream { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ end(chunk?: string | Uint8Array, encoding?: string, callback?: Function): Writable; - /** - * Write the last chunk to Writable. - * - * @param { string | Uint8Array } [chunk] - Data to be written. - * @param { string } [encoding] - Encoding type. - * @param { StreamCb } [callback] - Callback after writing. - * @returns { Writable } Returns the Writable object. - * @throws { BusinessError } 10200039 - The doTransform method has not been implemented for a class that inherits from Transform. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - end(chunk?: string | Uint8Array, encoding?: string, callback?: StreamCb): Writable; - /** * Set the default encoding mode. * @@ -979,25 +852,11 @@ declare namespace stream { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ doWrite(chunk: string | Uint8Array, encoding: string, callback: Function): void; - /** - * Implemented by subclass inheritance. The implementation logic of flushing chunks in the buffer must not be - * directly called. The call is controlled by Writable.write. - * - * @param { string | Uint8Array } chunk - Data to be written. - * @param { string } encoding - Encoding type. - * @param { StreamCb } callback - Callback after writing. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - doWrite(chunk: string | Uint8Array, encoding: string, callback: StreamCb): void; - /** * The implementation logic of flushing chunks in the buffer in batches should not be actively called. * The call is controlled by Writable.write. @@ -1011,108 +870,155 @@ declare namespace stream { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ doWritev(chunks: string[] | Uint8Array[], callback: Function): void; - /** - * The implementation logic of flushing chunks in the buffer in batches should not be actively called. - * The call is controlled by Writable.write. - * - * @param { string[] | Uint8Array[] } chunks - Data to be written. - * @param { StreamCb } callback - Callback after writing. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - doWritev(chunks: string[] | Uint8Array[], callback: StreamCb): void; - /** * Returns boolean indicating whether it is in ObjectMode. * * @type { boolean } - * @readonly * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - readonly writableObjectMode: boolean; + get writableObjectMode(): boolean; + /** * Value of highWatermark. * - * @type { number } - * @readonly + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - readonly writableHighWatermark: number; + get writableHighWatermark(): int; + /** * Is true if it is safe to call writable.write(), which means the stream has not been destroyed, error or end. * * @type { boolean } - * @readonly * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - readonly writable: boolean; + get writable(): boolean; + /** * Size of data that can be flushed, in bytes or objects. * - * @type { number } - * @readonly + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - readonly writableLength: number; + get writableLength(): int; + /** * Number of times writable.uncork() needs to be called in order to fully uncork the stream. * - * @type { number } - * @readonly + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - readonly writableCorked: number; + get writableCorked(): int; + /** * Whether Writable.end has been called. * * @type { boolean } - * @readonly * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - readonly writableEnded: boolean; + get writableEnded(): boolean; + /** * Whether Writable.end has been called and all buffers have been flushed. * * @type { boolean } - * @readonly * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - readonly writableFinished: boolean; + get writableFinished(): boolean; + } + + /** + * Transform stream is a Duplex stream where the output is computed in some way from the input. + * Transform implementations must implement the doTransform() method and may also implement the doFlush() method. + * + * @extends Duplex + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + class Transform extends Duplex { + /** + * The Transform constructor. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + constructor(); + + /** + * Convert the input data. After the conversion, Transform.push can be called to send the input to the read stream. + * Transform.push should not be called Transform.write to call. + * + * @param { string } chunk - Input data to be converted. + * @param { string } encoding - If the chunk is a string, then this is the encoding type. If chunk is a buffer, + * then this is the special value 'buffer'. Ignore it in that case. + * @param { Function } callback - Callback after conversion. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + doTransform(chunk: string, encoding: string, callback: Function): void; + + /** + * After all data is flushed to the write stream, you can use the Transform.doFlush writes some extra data, must + * not be called directly, only called by Writable after flushing all data. + * + * @param { Function } callback - Callback after flush completion. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + doFlush(callback: Function): void; } } export default stream; diff --git a/api/@ohos.xml.d.ts b/api/@ohos.xml.d.ts index f568a8d186..c570cba5a5 100644 --- a/api/@ohos.xml.d.ts +++ b/api/@ohos.xml.d.ts @@ -988,14 +988,14 @@ declare namespace xml { /** * Obtains the current column number, starting from 1. * - * @returns { number } + * @returns { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - getColumnNumber(): number; + getColumnNumber(): int; /** * The current depth of the element. * @@ -1014,14 +1014,14 @@ declare namespace xml { /** * Obtains the depth of this element. * - * @returns { number } + * @returns { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - getDepth(): number; + getDepth(): int; /** * The current line number, starting from 1. * @@ -1040,14 +1040,14 @@ declare namespace xml { /** * Obtains the current line number, starting from 1. * - * @returns { number } + * @returns { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - getLineNumber(): number; + getLineNumber(): int; /** * The current element's name. * @@ -1222,14 +1222,14 @@ declare namespace xml { /** * Obtains the number of attributes for the current start tag. * - * @returns { number } + * @returns { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - getAttributeCount(): number; + getAttributeCount(): int; } /** @@ -1392,33 +1392,8 @@ declare namespace xml { * @arkts 1.1&1.2 */ tokenValueCallbackFunction?: (eventType: EventType, value: ParseInfo) => boolean; - - /** - * Attribute value and tag callback function. - * - * @type { ?AttributeWithTagCb } - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - attributeWithTagCallbackFunction?: AttributeWithTagCb; } - /** - * The type of ParseOptions attributeWithTagCallbackFunction. - * - * @typedef { function } AttributeWithTagCb - * @param { string } tagName - The tag in xml parse node - * @param { string } key - The key in xml parse node - * @param { string } value - The value in xml parse node - * @returns { boolean } - whether continue to parse xml data - * @syscap SystemCapability.Utils.Lang - * @atomicservice - * @since 20 - */ - type AttributeWithTagCb = (tagName: string, key: string, value: string) => boolean; - /** * The XmlPullParser interface is used to parse the existing xml file. * diff --git a/arkts/@arkts.collections.d.ets b/arkts/@arkts.collections.d.ets index 85a9115f2b..8af3613320 100644 --- a/arkts/@arkts.collections.d.ets +++ b/arkts/@arkts.collections.d.ets @@ -37,8 +37,7 @@ import lang from './@arkts.lang' * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'18','1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ declare namespace collections { /** @@ -11741,309 +11740,6 @@ declare namespace collections { static of(...items: number[]): Float32Array; } - /** - * An ordered collections of bit values, which are either 0 or 1. - * If multiple threads access a BitVector instance concurrently, - * and at least one of the threads modifies the array structurally, - * it must be synchronized externally. - * - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - class BitVector { - /** - * A constructor used to create a BitVector object. - * - * @param { number } length - The length of BitVector object. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - constructor(length: number); - /** - * Gets the element number of the BitVector. This is a number one higher than the highest index in the bit vector. - * It can be changed by resize(). - * - * @readonly - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - get length(): number; - /** - * Appends the bit element to the end of this bit vector. - * - * @param { number } element - Element to be appended to this bit vector (0 means 0, else means 1). - * @returns { boolean } The boolean type, returns true if the addition is successful, and returns false if it fails. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified. - * 2.Incorrect parameter types. - * @throws { BusinessError } 10200011 - The push method cannot be bound. - * @throws { BusinessError } 10200201 - Concurrent modification error. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - push(element: number): boolean; - /** - * Retrieves and removes the bit element to the end of this bit vector. - * - * @returns { number | undefined } The boolean type, if the bit push successfully, return true, else return false. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - pop(): number | undefined; - /** - * Check if bit vector contains a particular bit element. - * - * @param { number } element - Element to be contained (0 means 0, else means 1). - * @param { number } fromIndex - The starting position of the index, containing the value at that index position. - * @param { number } toIndex - The end of the index, containing the value at that index. - * @returns { boolean } The boolean type, if bit vector contains the specified element, return true, - else return false. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified. - * 2.Incorrect parameter types. - * @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range. - * @throws { BusinessError } 10200011 - The has method cannot be bound. - * @throws { BusinessError } 10200201 - Concurrent modification error. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - has(element: number, fromIndex: number, toIndex: number): boolean; - /** - * Sets a range of bits in a bit vector to a particular element. - * - * @param { number } element - Element to be set (0 means 0, else means 1). - * @param { number } fromIndex - The starting position of the index, containing the value at that index position. - * @param { number } toIndex - The end of the index, excluding the value at that index. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified. - * 2.Incorrect parameter types. - * @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range. - * @throws { BusinessError } 10200011 - The setBitsByRange method cannot be bound. - * @throws { BusinessError } 10200201 - Concurrent modification error. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - setBitsByRange(element: number, fromIndex: number, toIndex: number): void; - /** - * Sets all of bits in a bit vector to a particular element. - * - * @param { number } element - Element to be set (0 means 0, else means 1). - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified. - * 2.Incorrect parameter types. - * @throws { BusinessError } 10200011 - The setAllBits method cannot be bound. - * @throws { BusinessError } 10200201 - Concurrent modification error. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - setAllBits(element: number): void; - /** - * Returns the bit values in a range of indices in a bit vector. - * - * @param { number } fromIndex - The starting position of the index, containing the value at that index position. - * @param { number } toIndex - The end of the index, excluding the value at that index. - * @returns { BitVector } The BitVector type, returns the bit values in a range of indices in a bit vector. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified. - * 2.Incorrect parameter types. - * @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range. - * @throws { BusinessError } 10200011 - The getBitsByRange method cannot be bound. - * @throws { BusinessError } 10200201 - Concurrent modification error. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - getBitsByRange(fromIndex: number, toIndex: number): BitVector; - /** - * Resize the bitVector's length. - * - * @param { number } size - The new size for bitVector. If count is greater than the current size of bitVector, - * the additional bit elements are set to 0. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified. - * 2.Incorrect parameter types. - * @throws { BusinessError } 10200011 - The resize method cannot be bound. - * @throws { BusinessError } 10200201 - Concurrent modification error. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - resize(size: number): void; - /** - * Counts the number of times a certain bit element occurs within a range of bits in a bit vector. - * - * @param { number } element - Element to be counted (0 means 0, else means 1). - * @param { number } fromIndex - The starting position of the index, containing the value at that index position. - * @param { number } toIndex - The end of the index, excluding the value at that index. - * @returns { number } The number type, return the number of times a certain bit element - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified. - * 2.Incorrect parameter types. - * @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range. - * @throws { BusinessError } 10200011 - The getBitCountByRange method cannot be bound. - * @throws { BusinessError } 10200201 - Concurrent modification error. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - getBitCountByRange(element: number, fromIndex: number, toIndex: number): number; - /** - * Locates the first occurrence of a certain bit value within a range of bits in a bit vector. - * - * @param { number } element - Element to be Located (0 means 0, else means 1). - * @param { number } fromIndex - The starting position of the index, containing the value at that index position. - * @param { number } toIndex - The end of the index, excluding the value at that index. - * @returns { number } The number type, return the first index of specified bit within a range, - * or -1 if this range of the bitVector does not contain the element. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified. - * 2.Incorrect parameter types. - * @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range. - * @throws { BusinessError } 10200011 - The getIndexOf method cannot be bound. - * @throws { BusinessError } 10200201 - Concurrent modification error. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - getIndexOf(element: number, fromIndex: number, toIndex: number): number; - /** - * Locates the last occurrence of a certain bit value within a range of bits in a bit vector. - * - * @param { number } element - Element to be Located (0 means 0, else means 1). - * @param { number } fromIndex - The starting position of the index, containing the value at that index position. - * @param { number } toIndex - The end of the index, excluding the value at that index. - * @returns { number } The number type, return the last index of specified bit within a range, - * or -1 if this range of the bitVector does not contain the element. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified. - * 2.Incorrect parameter types. - * @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range. - * @throws { BusinessError } 10200011 - The getLastIndexOf method cannot be bound. - * @throws { BusinessError } 10200201 - Concurrent modification error. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - getLastIndexOf(element: number, fromIndex: number, toIndex: number): number; - /** - * Flips the bit value by index in a bit vector.(Flip 0 to 1, flip 1 to 0) - * - * @param { number } index - The index in the bit vector. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified. - * 2.Incorrect parameter types. - * @throws { BusinessError } 10200001 - The value of index is out of range. - * @throws { BusinessError } 10200011 - The flipBitByIndex method cannot be bound. - * @throws { BusinessError } 10200201 - Concurrent modification error. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - flipBitByIndex(index: number): void; - /** - * Flips a range of bit values in a bit vector.(Flip 0 to 1, flip 1 to 0). - * - * @param { number } fromIndex - The starting position of the index, containing the value at that index position. - * @param { number } toIndex - The end of the index, excluding the value at that index. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified. - * 2.Incorrect parameter types. - * @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range. - * @throws { BusinessError } 10200011 - The flipBitsByRange method cannot be bound. - * @throws { BusinessError } 10200201 - Concurrent modification error. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - flipBitsByRange(fromIndex: number, toIndex: number): void; - /** - * Returns an iterator that iterates over bit vector. - * - * @returns { IterableIterator } A new iterable iterator object. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - $_iterator(): IterableIterator; - /** - * Returns an iterable of values in the bit vector - * - * @returns { IterableIterator } A new iterable iterator object. - * @throws { BusinessError } 10200011 - The values method cannot be bound. - * @throws { BusinessError } 10200201 - Concurrent modification error. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - values(): IterableIterator; - /** - * Returns the item at that index. - * - * @param { number } index - The zero-based index of the desired code unit. - * @returns { number } The element in the bitVector matching the given index. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - $_get(index: number): number; - /** - * Set the value of item at that index. - * - * @param { number } index - The index of the element to set. - * @param { number } value - The value to set at the specified index. - * @syscap SystemCapability.Utils.Lang - * @atomicservice - * @crossplatform - * @since 20 - * @arkts 1.2 - */ - $_set(index: number, value: number): void; - } - /** * An ordered collections of bit values, which are either 0 or 1. * If multiple threads access a BitVector instance concurrently, diff --git a/arkts/@arkts.collections.static.d.ets b/arkts/@arkts.collections.static.d.ets new file mode 100644 index 0000000000..c57d2eb03a --- /dev/null +++ b/arkts/@arkts.collections.static.d.ets @@ -0,0 +1,256 @@ +'use static'; +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file Defines the collections for ArkTS + * @kit ArkTS + */ + +/** + * ArkTS collections. + * + * @namespace collections + * @syscap SystemCapability.Utils.Lang + * @since 20 + * @arkts 1.2 + */ +declare namespace collections { + /** + * An ordered collections of bit values, which are either 0 or 1. + * If multiple threads access a BitVector instance concurrently, + * and at least one of the threads modifies the array structurally, + * it must be synchronized externally. + * + * @syscap SystemCapability.Utils.Lang + * @since 20 + * @arkts 1.2 + */ + class BitVector { + /** + * A constructor used to create a BitVector object. + * + * @param { int } length - The length of BitVector object. + * @syscap SystemCapability.Utils.Lang + * @since 20 + * @arkts 1.2 + */ + constructor(length: int); + /** + * Gets the element number of the BitVector. This is a number one higher than the highest index in the bit vector. + * It can be changed by resize(). + * + * @readonly + * @syscap SystemCapability.Utils.Lang + * @since 20 + * @arkts 1.2 + */ + get length(): int; + /** + * Appends the bit element to the end of this bit vector. + * + * @param { int } element - Element to be appended to this bit vector (0 means 0, else means 1). + * @returns { boolean } The boolean type, returns true if the addition is successful, and returns false if it fails. + * @throws { BusinessError } 10200011 - The push method cannot be bound. + * @throws { BusinessError } 10200201 - Concurrent modification error. + * @syscap SystemCapability.Utils.Lang + * @since 20 + * @arkts 1.2 + */ + push(element: int): boolean; + /** + * Retrieves and removes the bit element to the end of this bit vector. + * + * @returns { int | undefined } The boolean type, if the bit push successfully, return true, else return false. + * @syscap SystemCapability.Utils.Lang + * @since 20 + * @arkts 1.2 + */ + pop(): int | undefined; + /** + * Check if bit vector contains a particular bit element. + * + * @param { int } element - Element to be contained (0 means 0, else means 1). + * @param { int } fromIndex - The starting position of the index, containing the value at that index position. + * @param { int } toIndex - The end of the index, containing the value at that index. + * @returns { boolean } The boolean type, if bit vector contains the specified element, return true, + else return false. + * @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range. + * @throws { BusinessError } 10200011 - The has method cannot be bound. + * @throws { BusinessError } 10200201 - Concurrent modification error. + * @syscap SystemCapability.Utils.Lang + * @since 20 + * @arkts 1.2 + */ + has(element: int, fromIndex: int, toIndex: int): boolean; + /** + * Sets a range of bits in a bit vector to a particular element. + * + * @param { int } element - Element to be set (0 means 0, else means 1). + * @param { int } fromIndex - The starting position of the index, containing the value at that index position. + * @param { int } toIndex - The end of the index, excluding the value at that index. + * @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range. + * @throws { BusinessError } 10200011 - The setBitsByRange method cannot be bound. + * @throws { BusinessError } 10200201 - Concurrent modification error. + * @syscap SystemCapability.Utils.Lang + * @since 20 + * @arkts 1.2 + */ + setBitsByRange(element: int, fromIndex: int, toIndex: int): void; + /** + * Sets all of bits in a bit vector to a particular element. + * + * @param { int } element - Element to be set (0 means 0, else means 1). + * @throws { BusinessError } 10200011 - The setAllBits method cannot be bound. + * @throws { BusinessError } 10200201 - Concurrent modification error. + * @syscap SystemCapability.Utils.Lang + * @since 20 + * @arkts 1.2 + */ + setAllBits(element: int): void; + /** + * Returns the bit values in a range of indices in a bit vector. + * + * @param { int } fromIndex - The starting position of the index, containing the value at that index position. + * @param { int } toIndex - The end of the index, excluding the value at that index. + * @returns { BitVector } The BitVector type, returns the bit values in a range of indices in a bit vector. + * @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range. + * @throws { BusinessError } 10200011 - The getBitsByRange method cannot be bound. + * @throws { BusinessError } 10200201 - Concurrent modification error. + * @syscap SystemCapability.Utils.Lang + * @since 20 + * @arkts 1.2 + */ + getBitsByRange(fromIndex: int, toIndex: int): BitVector; + /** + * Resize the bitVector's length. + * + * @param { int } size - The new size for bitVector. If count is greater than the current size of bitVector, + * the additional bit elements are set to 0. + * @throws { BusinessError } 10200011 - The resize method cannot be bound. + * @throws { BusinessError } 10200201 - Concurrent modification error. + * @syscap SystemCapability.Utils.Lang + * @since 20 + * @arkts 1.2 + */ + resize(size: int): void; + /** + * Counts the number of times a certain bit element occurs within a range of bits in a bit vector. + * + * @param { int } element - Element to be counted (0 means 0, else means 1). + * @param { int } fromIndex - The starting position of the index, containing the value at that index position. + * @param { int } toIndex - The end of the index, excluding the value at that index. + * @returns { int } The number type, return the number of times a certain bit element + * @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range. + * @throws { BusinessError } 10200011 - The getBitCountByRange method cannot be bound. + * @throws { BusinessError } 10200201 - Concurrent modification error. + * @syscap SystemCapability.Utils.Lang + * @since 20 + * @arkts 1.2 + */ + getBitCountByRange(element: int, fromIndex: int, toIndex: int): int; + /** + * Locates the first occurrence of a certain bit value within a range of bits in a bit vector. + * + * @param { int } element - Element to be Located (0 means 0, else means 1). + * @param { int } fromIndex - The starting position of the index, containing the value at that index position. + * @param { int } toIndex - The end of the index, excluding the value at that index. + * @returns { int } The number type, return the first index of specified bit within a range, + * or -1 if this range of the bitVector does not contain the element. + * @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range. + * @throws { BusinessError } 10200011 - The getIndexOf method cannot be bound. + * @throws { BusinessError } 10200201 - Concurrent modification error. + * @syscap SystemCapability.Utils.Lang + * @since 20 + * @arkts 1.2 + */ + getIndexOf(element: int, fromIndex: int, toIndex: int): int; + /** + * Locates the last occurrence of a certain bit value within a range of bits in a bit vector. + * + * @param { int } element - Element to be Located (0 means 0, else means 1). + * @param { int } fromIndex - The starting position of the index, containing the value at that index position. + * @param { int } toIndex - The end of the index, excluding the value at that index. + * @returns { int } The number type, return the last index of specified bit within a range, + * or -1 if this range of the bitVector does not contain the element. + * @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range. + * @throws { BusinessError } 10200011 - The getLastIndexOf method cannot be bound. + * @throws { BusinessError } 10200201 - Concurrent modification error. + * @syscap SystemCapability.Utils.Lang + * @since 20 + * @arkts 1.2 + */ + getLastIndexOf(element: int, fromIndex: int, toIndex: int): int; + /** + * Flips the bit value by index in a bit vector.(Flip 0 to 1, flip 1 to 0) + * + * @param { int } index - The index in the bit vector. + * @throws { BusinessError } 10200001 - The value of index is out of range. + * @throws { BusinessError } 10200011 - The flipBitByIndex method cannot be bound. + * @throws { BusinessError } 10200201 - Concurrent modification error. + * @syscap SystemCapability.Utils.Lang + * @since 20 + * @arkts 1.2 + */ + flipBitByIndex(index: int): void; + /** + * Flips a range of bit values in a bit vector.(Flip 0 to 1, flip 1 to 0). + * + * @param { int } fromIndex - The starting position of the index, containing the value at that index position. + * @param { int } toIndex - The end of the index, excluding the value at that index. + * @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range. + * @throws { BusinessError } 10200011 - The flipBitsByRange method cannot be bound. + * @throws { BusinessError } 10200201 - Concurrent modification error. + * @syscap SystemCapability.Utils.Lang + * @since 20 + * @arkts 1.2 + */ + flipBitsByRange(fromIndex: int, toIndex: int): void; + /** + * Returns an iterator that iterates over bit vector. + * + * @returns { IterableIterator } A new iterable iterator object. + * @syscap SystemCapability.Utils.Lang + * @since 20 + * @arkts 1.2 + */ + $_iterator(): IterableIterator; + /** + * Returns an iterable of values in the bit vector + * + * @returns { IterableIterator } A new iterable iterator object. + * @throws { BusinessError } 10200011 - The values method cannot be bound. + * @throws { BusinessError } 10200201 - Concurrent modification error. + * @syscap SystemCapability.Utils.Lang + * @since 20 + * @arkts 1.2 + */ + values(): IterableIterator; + /** + * Accesses or sets the element at the specified index in the BitVector. + * + * @param { int } index - The index of the element to access or set. + * Throws an error if index < 0 or index >= bitVector.length. + * @returns { int } The element in the BitVector at the given index. + * @throws { BusinessError } 10200001 - The value of index is out of range. + * @syscap SystemCapability.Utils.Lang + * @since 20 + * @arkts 1.2 + */ + [index: int]: int; + } +} + +export default collections; diff --git a/arkts/@arkts.math.Decimal.d.ets b/arkts/@arkts.math.Decimal.d.ets index 166fdaefd9..d0140f37f4 100644 --- a/arkts/@arkts.math.Decimal.d.ets +++ b/arkts/@arkts.math.Decimal.d.ets @@ -38,13 +38,14 @@ type Rounding = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8; /** * The type uesd to set rounding * + * @typedef { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ -type Rounding = number; +type Rounding = int; /** * The type uesd to set modulo @@ -63,6 +64,18 @@ type Rounding = number; */ type Modulo = Rounding | 9; +/** + * The type uesd to set modulo + * + * @typedef { int } + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ +type Modulo = int; + /** * The type uesd to denote decimal value * @@ -73,12 +86,14 @@ type Modulo = Rounding | 9; /** * The type uesd to denote decimal value * + * @typedef { string | double | Decimal } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ -type Value = string | number | Decimal; +type Value = string | double | Decimal; /** * Provides configuration for decimal. @@ -95,7 +110,8 @@ type Value = string | number | Decimal; * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ interface DecimalConfig { /** @@ -111,13 +127,14 @@ interface DecimalConfig { * The maximum number of significant digits of the result of an operation. * Default value: 20 * - * @type { number } integer, 1 to 1e+9 inclusive + * @type { double } integer, 1 to 1e+9 inclusive * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - precision?: number; + precision?: double; /** * The default rounding mode used when rounding the result of an operation to precision significant digits, * and when rounding the return value of the round, toBinary, toDecimalPlaces, toExponential, toFixed, @@ -135,11 +152,12 @@ interface DecimalConfig { * toHexadecimal, toNearest, toOctal, toPrecision and toSignificantDigits methods. * Default value: 4 (ROUND_HALF_UP) * - * @type { number } integer, integer, 0 to 8 inclusive + * @type { Rounding } integer, integer, 0 to 8 inclusive * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ rounding?: Rounding; /** @@ -155,13 +173,14 @@ interface DecimalConfig { * The negative exponent value at and below which toString returns exponential notation. * Default value: -7 * - * @type { number } integer, -9e15 to 0 inclusive + * @type { double } integer, -9e15 to 0 inclusive * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - toExpNeg?: number; + toExpNeg?: double; /** * The positive exponent value at and above which toString returns exponential notation. * Default value: 20 @@ -175,13 +194,14 @@ interface DecimalConfig { * The positive exponent value at and above which toString returns exponential notation. * Default value: 20 * - * @type { number } integer, 0 to 9e15 inclusive + * @type { double } integer, 0 to 9e15 inclusive * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - toExpPos?: number; + toExpPos?: double; /** * The negative exponent limit, i.e. the exponent value below which underflow to zero occurs. * Default value: -9e15 @@ -195,13 +215,14 @@ interface DecimalConfig { * The negative exponent limit, i.e. the exponent value below which underflow to zero occurs. * Default value: -9e15 * - * @type { number } integer, -9e15 to 0 inclusive + * @type { double } integer, -9e15 to 0 inclusive * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - minE?: number; + minE?: double; /** * The positive exponent limit, i.e. the exponent value above which overflow to Infinity occurs. * Default value: 9e15 @@ -215,13 +236,14 @@ interface DecimalConfig { * The positive exponent limit, i.e. the exponent value above which overflow to Infinity occurs. * Default value: 9e15 * - * @type { number } integer, 0 to 9e15 inclusive + * @type { double } integer, 0 to 9e15 inclusive * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - maxE?: number; + maxE?: double; /** * The value that determines whether cryptographically-secure pseudo-random number generation is used. * Default value: false @@ -239,7 +261,8 @@ interface DecimalConfig { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ crypto?: boolean; /** @@ -255,11 +278,12 @@ interface DecimalConfig { * The modulo mode used when calculating the modulus: a mod n. * Default value: 1 (ROUND_DOWN) * - * @type { number } integer, 0 to 9 inclusive + * @type { Modulo } integer, 0 to 9 inclusive * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ modulo?: Modulo; /** @@ -279,7 +303,8 @@ interface DecimalConfig { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ defaults?: boolean; } @@ -297,7 +322,8 @@ interface DecimalConfig { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ declare class Decimal { /** @@ -321,6 +347,19 @@ declare class Decimal { */ readonly d: number[]; + /** + * The numbers of decimal digits. + * + * @type { Array | null } + * @readonly + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + get d(): Array | null; + /** * The number of decimal exponent. * @@ -333,14 +372,15 @@ declare class Decimal { /** * The number of decimal exponent. * - * @type { number } + * @type { double } * @readonly * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - readonly e: number; + get e(): double; /** * The number of decimal sign. @@ -354,14 +394,15 @@ declare class Decimal { /** * The number of decimal sign. * - * @type { number } + * @type { double } * @readonly * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - readonly s: number; + get s(): double; /** * Return a new Decimal whose value is the absolute value of this Decimal. @@ -377,14 +418,15 @@ declare class Decimal { /** * Return a new Decimal whose value is the absolute value of this Decimal. * - * @param { Value } n {number | string | Decimal} + * @param { Value } n {double | string | Decimal} * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; * 2. Parameter verification failed. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ constructor(n: Value); @@ -403,7 +445,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ abs(): Decimal; @@ -424,7 +467,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ floor(): Decimal; @@ -445,7 +489,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ ceil(): Decimal; @@ -464,7 +509,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ trunc(): Decimal; @@ -487,8 +533,8 @@ declare class Decimal { * Return a new Decimal whose value is the value of this Decimal clamped to the range * delineated by `min` and `max`. * - * @param { Value } min {number | string | Decimal} - * @param { Value } max {number | string | Decimal} + * @param { Value } min {double | string | Decimal} + * @param { Value } max {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -497,7 +543,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ clamp(min: Value, max: Value): Decimal; @@ -518,7 +565,7 @@ declare class Decimal { * Return a new Decimal whose value is the value of this Decimal plus `n`, rounded to `precision` * significant digits using rounding mode `rounding`. * - * @param { Value } n {number | string | Decimal} + * @param { Value } n {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -526,7 +573,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ add(n: Value): Decimal; @@ -547,7 +595,7 @@ declare class Decimal { * Return a new Decimal whose value is the value of this Decimal minus `n`, rounded to `precision` * significant digits using rounding mode `rounding`. * - * @param { Value } n {number | string | Decimal} + * @param { Value } n {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -555,7 +603,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ sub(n: Value): Decimal; @@ -576,7 +625,7 @@ declare class Decimal { * Return a new Decimal whose value is this Decimal times `n`, rounded to `precision` significant * digits using rounding mode `rounding`. * - * @param { Value } n {number | string | Decimal} + * @param { Value } n {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -584,7 +633,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ mul(n: Value): Decimal; @@ -605,7 +655,7 @@ declare class Decimal { * Return a new Decimal whose value is the value of this Decimal divided by `n`, rounded to * `precision` significant digits using rounding mode `rounding`. * - * @param { Value } n {number | string | Decimal} + * @param { Value } n {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -613,7 +663,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ div(n: Value): Decimal; @@ -634,7 +685,7 @@ declare class Decimal { * Return a new Decimal whose value is the value of this Decimal modulo `n`, rounded to * `precision` significant digits using rounding mode `rounding`. * - * @param { Value } n {number | string | Decimal} + * @param { Value } n {double | string | Decimal} * @returns { Decimal }the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -642,7 +693,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ mod(n: Value): Decimal; @@ -663,7 +715,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ sqrt(): Decimal; @@ -684,7 +737,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ cbrt(): Decimal; @@ -706,7 +760,7 @@ declare class Decimal { * Return a new Decimal whose value is the value of this Decimal raised to the power `n`, rounded * to `precision` significant digits using rounding mode `rounding`. * - * @param { Value } n {number | string | Decimal} + * @param { Value } n {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -715,7 +769,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ pow(n: Value): Decimal; @@ -740,7 +795,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ exp(): Decimal; @@ -762,7 +818,7 @@ declare class Decimal { * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision` * significant digits using rounding mode `rounding`. * - * @param { Value } n {number | string | Decimal} + * @param { Value } n {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -771,7 +827,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ log(n: Value): Decimal; @@ -794,7 +851,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ ln(): Decimal; @@ -813,7 +871,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ cos(): Decimal; @@ -832,7 +891,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ sin(): Decimal; @@ -851,7 +911,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ tan(): Decimal; @@ -872,7 +933,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ cosh(): Decimal; @@ -891,7 +953,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ sinh(): Decimal; @@ -910,7 +973,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ tanh(): Decimal; @@ -931,7 +995,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ acos(): Decimal; @@ -954,7 +1019,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ asin(): Decimal; @@ -975,7 +1041,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ atan(): Decimal; @@ -998,7 +1065,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ acosh(): Decimal; @@ -1021,7 +1089,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ asinh(): Decimal; @@ -1044,7 +1113,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ atanh(): Decimal; @@ -1071,17 +1141,18 @@ declare class Decimal { * 0 if they have the same value, * NaN if the value of either Decimal is NaN. * - * @param { Value } n {number | string | Decimal} - * @returns { number } the number type + * @param { Value } n {double | string | Decimal} + * @returns { double } the number type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; * 2. Parameter verification failed. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - comparedTo(n: Value): number; + comparedTo(n: Value): double; /** * Return true if the value of this Decimal is equal to the value of `n`, otherwise return false. @@ -1098,7 +1169,7 @@ declare class Decimal { /** * Return true if the value of this Decimal is equal to the value of `n`, otherwise return false. * - * @param { Value } n {number | string | Decimal} + * @param { Value } n {double | string | Decimal} * @returns { boolean } the boolean type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -1106,7 +1177,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ equals(n: Value): boolean; @@ -1125,7 +1197,7 @@ declare class Decimal { /** * Return true if the value of this Decimal is greater than the value of `n`, otherwise return false. * - * @param { Value } n {number | string | Decimal} + * @param { Value } n {double | string | Decimal} * @returns { boolean } the boolean type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -1133,7 +1205,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ greaterThan(n: Value): boolean; @@ -1154,7 +1227,7 @@ declare class Decimal { * Return true if the value of this Decimal is greater than or equal to the value of `n`, * otherwise return false. * - * @param { Value } n {number | string | Decimal} + * @param { Value } n {double | string | Decimal} * @returns { boolean } the boolean type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -1162,7 +1235,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ greaterThanOrEqualTo(n: Value): boolean; @@ -1181,7 +1255,7 @@ declare class Decimal { /** * Return true if the value of this Decimal is less than `n`, otherwise return false. * - * @param { Value } n {number | string | Decimal} + * @param { Value } n {double | string | Decimal} * @returns { boolean } the boolean type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -1189,7 +1263,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ lessThan(n: Value): boolean; @@ -1208,7 +1283,7 @@ declare class Decimal { /** * Return true if the value of this Decimal is less than or equal to `n`, otherwise return false. * - * @param { Value } n {number | string | Decimal} + * @param { Value } n {double | string | Decimal} * @returns { boolean } the boolean type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -1216,7 +1291,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ lessThanOrEqualTo(n: Value): boolean; @@ -1235,7 +1311,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ isFinite(): boolean; @@ -1254,7 +1331,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ isInteger(): boolean; @@ -1273,7 +1351,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ isNaN(): boolean; @@ -1292,7 +1371,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ isNegative(): boolean; @@ -1311,7 +1391,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ isPositive(): boolean; @@ -1330,7 +1411,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ isZero(): boolean; @@ -1351,7 +1433,7 @@ declare class Decimal { * Return a new Decimal whose value is the integer part of dividing the value of this Decimal * by the value of `n`, rounded to `precision` significant digits using rounding mode `rounding`. * - * @param { Value } n {number | string | Decimal} + * @param { Value } n {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -1359,7 +1441,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ dividedToIntegerBy(n: Value): Decimal; @@ -1378,7 +1461,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ negate(): Decimal; @@ -1397,7 +1481,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ toBinary(): string; @@ -1416,15 +1501,16 @@ declare class Decimal { * Return a string representing the value of this Decimal in base 2, round to `significantDigits` * significant digits. * - * @param { number } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive. + * @param { double } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive. * @returns { string } the string type * @throws { BusinessError } 10200001 - The value of `significantDigits` is out of range. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - toBinary(significantDigits: number): string; + toBinary(significantDigits: double): string; /** * Return a string representing the value of this Decimal in base 2, round to `significantDigits` @@ -1442,16 +1528,17 @@ declare class Decimal { * Return a string representing the value of this Decimal in base 2, round to `significantDigits` * significant digits using rounding mode `rounding`. * - * @param { number } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive. + * @param { double } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive. * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive. * @returns { string } the string type * @throws { BusinessError } 10200001 - The value of `significantDigits | rounding` is out of range. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - toBinary(significantDigits: number, rounding: Rounding): string; + toBinary(significantDigits: double, rounding: Rounding): string; /** * Return a string representing the value of this Decimal in base 8. @@ -1468,7 +1555,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ toOctal(): string; @@ -1485,15 +1573,16 @@ declare class Decimal { /** * Return a string representing the value of this Decimal in base 8, round to `significantDigits` significant. * - * @param { number } significantDigits {number | string | Decimal} + * @param { double } significantDigits {double | string | Decimal} * @returns { string } the string type * @throws { BusinessError } 10200001 - The value of `significantDigits` is out of range. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - toOctal(significantDigits: number): string; + toOctal(significantDigits: double): string; /** * Return a string representing the value of this Decimal in base 8, round to `significantDigits` significant @@ -1511,16 +1600,17 @@ declare class Decimal { * Return a string representing the value of this Decimal in base 8, round to `significantDigits` significant * digits using rounding mode `rounding`. * - * @param { number } significantDigits {number | string | Decimal} + * @param { double } significantDigits {double | string | Decimal} * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive. * @returns { string } the string type * @throws { BusinessError } 10200001 - The value of `significantDigits | rounding` is out of range. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - toOctal(significantDigits: number, rounding: Rounding): string; + toOctal(significantDigits: double, rounding: Rounding): string; /** * Return a string representing the value of this Decimal in base 16 @@ -1537,7 +1627,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ toHexadecimal(): string; @@ -1554,15 +1645,16 @@ declare class Decimal { /** * Return a string representing the value of this Decimal in base 16, round to `significantDigits` significant. * - * @param { number } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive. + * @param { double } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive. * @returns { string } the string type * @throws { BusinessError } 10200001 - The value of `significantDigits` is out of range. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - toHexadecimal(significantDigits: number): string; + toHexadecimal(significantDigits: double): string; /** * Return a string representing the value of this Decimal in base 16, round to `significantDigits` significant @@ -1580,16 +1672,17 @@ declare class Decimal { * Return a string representing the value of this Decimal in base 16, round to `significantDigits` significant * digits using rounding mode `rounding`. * - * @param { number } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive. + * @param { double } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive. * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive. * @returns { string } the string type * @throws { BusinessError } 10200001 - The value of `significantDigits | rounding` is out of range. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - toHexadecimal(significantDigits: number, rounding: Rounding): string; + toHexadecimal(significantDigits: double, rounding: Rounding): string; /** * Return a new Decimal whose value is the value of this Decimal. @@ -1606,7 +1699,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ toDecimalPlaces(): Decimal; @@ -1625,15 +1719,16 @@ declare class Decimal { * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `decimalPlaces` * decimal places. * - * @param { number } decimalPlaces Significant digits. Integer, 1 to MAX_DIGITS inclusive. + * @param { double } decimalPlaces Significant digits. Integer, 1 to MAX_DIGITS inclusive. * @returns { Decimal } the Decimal type * @throws { BusinessError } 10200001 - The value of `decimalPlaces` is out of range. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - toDecimalPlaces(decimalPlaces: number): Decimal; + toDecimalPlaces(decimalPlaces: double): Decimal; /** * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `decimalPlaces` @@ -1651,16 +1746,17 @@ declare class Decimal { * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `decimalPlaces` * decimal places using rounding mode `rounding`. * - * @param { number } decimalPlaces Significant digits. Integer, 1 to MAX_DIGITS inclusive. + * @param { double } decimalPlaces Significant digits. Integer, 1 to MAX_DIGITS inclusive. * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive. * @returns { Decimal } the Decimal type * @throws { BusinessError } 10200001 - The value of `decimalPlaces | rounding` is out of range. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - toDecimalPlaces(decimalPlaces: number, rounding: Rounding): Decimal; + toDecimalPlaces(decimalPlaces: double, rounding: Rounding): Decimal; /** * Return a string representing the value of this Decimal in exponential notation. @@ -1677,7 +1773,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ toExponential(): string; @@ -1696,15 +1793,16 @@ declare class Decimal { * Return a string representing the value of this Decimal in exponential notation rounded to * `decimalPlaces` fixed decimal places. * - * @param { number } decimalPlaces Decimal places. Integer, 0 to MAX_DIGITS inclusive. + * @param { double } decimalPlaces Decimal places. Integer, 0 to MAX_DIGITS inclusive. * @returns { string } the string type * @throws { BusinessError } 10200001 - The value of `decimalPlaces` is out of range. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - toExponential(decimalPlaces: number): string; + toExponential(decimalPlaces: double): string; /** * Return a string representing the value of this Decimal in exponential notation rounded to @@ -1722,16 +1820,17 @@ declare class Decimal { * Return a string representing the value of this Decimal in exponential notation rounded to * `decimalPlaces` fixed decimal places using rounding mode `rounding`. * - * @param { number } decimalPlaces Decimal places. Integer, 0 to MAX_DIGITS inclusive. + * @param { double } decimalPlaces Decimal places. Integer, 0 to MAX_DIGITS inclusive. * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive. * @returns { string } the string type * @throws { BusinessError } 10200001 - The value of `decimalPlaces | rounding` is out of range. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - toExponential(decimalPlaces: number, rounding: Rounding): string; + toExponential(decimalPlaces: double, rounding: Rounding): string; /** * Return a string representing the value of this Decimal in normal (fixed-point). @@ -1748,7 +1847,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ toFixed(): string; @@ -1766,14 +1866,16 @@ declare class Decimal { * Return a string representing the value of this Decimal in normal (fixed-point) notation to * `decimalPlaces` fixed decimal places. * - * @param { number } decimalPlaces Decimal places. Integer, 0 to MAX_DIGITS inclusive. + * @param { double } decimalPlaces Decimal places. Integer, 0 to MAX_DIGITS inclusive. * @returns { string } the string type * @throws { BusinessError } 10200001 - The value of `decimalPlaces` is out of range. + * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - toFixed(decimalPlaces: number): string; + toFixed(decimalPlaces: double): string; /** * Return a string representing the value of this Decimal in normal (fixed-point) notation to @@ -1791,16 +1893,17 @@ declare class Decimal { * Return a string representing the value of this Decimal in normal (fixed-point) notation to * `decimalPlaces` fixed decimal places and rounded using rounding mode `rounding`. * - * @param { number } decimalPlaces Decimal places. Integer, 0 to MAX_DIGITS inclusive. + * @param { double } decimalPlaces Decimal places. Integer, 0 to MAX_DIGITS inclusive. * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive. * @returns { string } the string type * @throws { BusinessError } 10200001 - The value of `decimalPlaces | rounding` is out of range. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - toFixed(decimalPlaces: number, rounding: Rounding): string; + toFixed(decimalPlaces: double, rounding: Rounding): string; /** * Return an array representing the value of this Decimal as a simple fraction with an integer @@ -1819,7 +1922,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ toFraction(): Decimal[]; @@ -1842,7 +1946,7 @@ declare class Decimal { * numerator and an integer denominator. The denominator will be a positive non-zero value * less than or equal to `max_denominator`. * - * @param { Value } maxDenominator {number | string | Decimal} + * @param { Value } maxDenominator {double | string | Decimal} * @returns { Decimal[] } the Decimal[] type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -1850,7 +1954,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ toFraction(maxDenominator: Value): Decimal[]; @@ -1869,7 +1974,7 @@ declare class Decimal { /** * Returns a new Decimal whose value is the nearest multiple of `n`. * - * @param { Value } n {number | string | Decimal} + * @param { Value } n {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -1877,7 +1982,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ toNearest(n: Value): Decimal; @@ -1900,7 +2006,7 @@ declare class Decimal { * Returns a new Decimal whose value is the nearest multiple of `n` in the direction of rounding * mode `rounding`, to the value of this Decimal. * - * @param { Value } n {number | string | Decimal} + * @param { Value } n {double | string | Decimal} * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive. * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: @@ -1910,7 +2016,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ toNearest(n: Value, rounding: Rounding): Decimal; @@ -1929,7 +2036,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ toPrecision(): string; @@ -1946,15 +2054,16 @@ declare class Decimal { /** * Return a string representing the value of this Decimal rounded to `significantDigits` significant digits. * - * @param { number } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive. + * @param { double } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive. * @returns { string } the string type * @throws { BusinessError } 10200001 - The value of `significantDigits` is out of range. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - toPrecision(significantDigits: number): string; + toPrecision(significantDigits: double): string; /** * Return a string representing the value of this Decimal rounded to `significantDigits` significant digits @@ -1972,16 +2081,17 @@ declare class Decimal { * Return a string representing the value of this Decimal rounded to `significantDigits` significant digits * using rounding mode `rounding`. * - * @param { number } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive. + * @param { double } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive. * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive. * @returns { string } the string type * @throws { BusinessError } 10200001 - The value of `significantDigits | rounding` is out of range. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - toPrecision(significantDigits: number, rounding: Rounding): string; + toPrecision(significantDigits: double, rounding: Rounding): string; /** * Return a new Decimal whose value is the value of this Decimal. @@ -1998,7 +2108,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ toSignificantDigits(): Decimal; @@ -2017,15 +2128,16 @@ declare class Decimal { * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `significantDigits` * significant digits. * - * @param { number } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive. + * @param { double } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive. * @returns { Decimal } the Decimal type * @throws { BusinessError } 10200001 - The value of `significantDigits` is out of range. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - toSignificantDigits(significantDigits: number): Decimal; + toSignificantDigits(significantDigits: double): Decimal; /** * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `significantDigits` @@ -2043,16 +2155,17 @@ declare class Decimal { * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `significantDigits` * significant digits using rounding mode `rounding`. * - * @param { number } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive. + * @param { double } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive. * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive. * @returns { Decimal } the Decimal type * @throws { BusinessError } 10200001 - The value of `significantDigits | rounding` is out of range. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - toSignificantDigits(significantDigits: number, rounding: Rounding): Decimal; + toSignificantDigits(significantDigits: double, rounding: Rounding): Decimal; /** * Return the value of this Decimal converted to a number primitive. Zero keeps its sign. @@ -2065,13 +2178,14 @@ declare class Decimal { /** * Return the value of this Decimal converted to a number primitive. Zero keeps its sign. * - * @returns { number } the number type + * @returns { double } the number type * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - toNumber(): number; + toNumber(): double; /** * Return a string representing the value of this Decimal. @@ -2092,7 +2206,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ toString(): string; @@ -2113,7 +2228,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ valueOf(): string; @@ -2128,13 +2244,14 @@ declare class Decimal { /** * Return the number of decimal places of the value of this Decimal. * - * @returns { number } the number type + * @returns { double } the number type * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - decimalPlaces(): number; + decimalPlaces(): double; /** * Return the number of significant digits of the value of this Decimal. @@ -2147,13 +2264,14 @@ declare class Decimal { /** * Return the number of significant digits of the value of this Decimal. * - * @returns { number } the number type + * @returns { double } the number type * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - precision(): number; + precision(): double; /** * Return the number of significant digits of the value of this Decimal, whether to count @@ -2171,16 +2289,17 @@ declare class Decimal { * Return the number of significant digits of the value of this Decimal, whether to count * integer-part trailing zeros. * - * @param { boolean | number } includeZeros Whether to count integer-part trailing zeros: true, false, + * @param { boolean | int } includeZeros Whether to count integer-part trailing zeros: true, false, * 1 or 0. - * @returns { number } the number type + * @returns { double } the number type * @throws { BusinessError } 10200001 - The value of `includeZeros` is out of range. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - precision(includeZeros: boolean | number): number; + precision(includeZeros: boolean | int): double; /** * Return a new Decimal whose value is the absolute value of `n`. @@ -2198,7 +2317,7 @@ declare class Decimal { /** * Return a new Decimal whose value is the absolute value of `n`. * - * @param { Value } n {number | string | Decimal} + * @param { Value } n {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -2207,7 +2326,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static abs(n: Value): Decimal; @@ -2227,7 +2347,7 @@ declare class Decimal { /** * Return a new Decimal whose value is `n` round to an integer using `ROUND_FLOOR`. * - * @param { Value } n {number | string | Decimal} + * @param { Value } n {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -2236,7 +2356,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static floor(n: Value): Decimal; @@ -2256,7 +2377,7 @@ declare class Decimal { /** * Return a new Decimal whose value is `n` rounded to an integer using `ROUND_CEIL`. * - * @param { Value } n {number | string | Decimal} + * @param { Value } n {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -2265,7 +2386,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static ceil(n: Value): Decimal; @@ -2285,7 +2407,7 @@ declare class Decimal { /** * Return a new Decimal whose value is `n` truncated to an integer. * - * @param { Value } n {number | string | Decimal} + * @param { Value } n {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -2294,7 +2416,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static trunc(n: Value): Decimal; @@ -2317,9 +2440,9 @@ declare class Decimal { /** * Return a new Decimal whose value is `n` clamped to the range delineated by `min` and `max`. * - * @param { Value } n {number | string | Decimal} - * @param { Value } min {number | string | Decimal} - * @param { Value } max {number | string | Decimal} + * @param { Value } n {double | string | Decimal} + * @param { Value } min {double | string | Decimal} + * @param { Value } max {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -2329,7 +2452,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static clamp(n: Value, min: Value, max: Value): Decimal; @@ -2352,8 +2476,8 @@ declare class Decimal { * Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant * digits using rounding mode `rounding`. * - * @param { Value } x {number | string | Decimal} - * @param { Value } y {number | string | Decimal} + * @param { Value } x {double | string | Decimal} + * @param { Value } y {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -2362,7 +2486,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static add(x: Value, y: Value): Decimal; @@ -2388,7 +2513,7 @@ declare class Decimal { * * Only the result is rounded, not the intermediate calculations. * - * @param { Value[] } n {number | string | Decimal} + * @param { Value[] } n {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -2397,7 +2522,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static sum(...n: Value[]): Decimal; @@ -2420,8 +2546,8 @@ declare class Decimal { * Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits * using rounding mode `rounding`. * - * @param { Value } x {number | string | Decimal} - * @param { Value } y {number | string | Decimal} + * @param { Value } x {double | string | Decimal} + * @param { Value } y {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -2430,7 +2556,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static sub(x: Value, y: Value): Decimal; @@ -2453,8 +2580,8 @@ declare class Decimal { * Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant * digits using rounding mode `rounding`. * - * @param { Value } x {number | string | Decimal} - * @param { Value } y {number | string | Decimal} + * @param { Value } x {double | string | Decimal} + * @param { Value } y {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -2463,7 +2590,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static mul(x: Value, y: Value): Decimal; @@ -2486,8 +2614,8 @@ declare class Decimal { * Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant * digits using rounding mode `rounding`. * - * @param { Value } x {number | string | Decimal} - * @param { Value } y {number | string | Decimal} + * @param { Value } x {double | string | Decimal} + * @param { Value } y {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -2496,7 +2624,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static div(x: Value, y: Value): Decimal; @@ -2519,8 +2648,8 @@ declare class Decimal { * Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits * using rounding mode `rounding`. * - * @param { Value } x {number | string | Decimal} - * @param { Value } y {number | string | Decimal} + * @param { Value } x {double | string | Decimal} + * @param { Value } y {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -2529,7 +2658,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static mod(x: Value, y: Value): Decimal; @@ -2551,7 +2681,7 @@ declare class Decimal { * Return a new Decimal whose value is the square root of `n`, rounded to `precision` significant * digits using rounding mode `rounding`. * - * @param { Value } n {number | string | Decimal} + * @param { Value } n {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -2560,7 +2690,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static sqrt(n: Value): Decimal; @@ -2582,7 +2713,7 @@ declare class Decimal { * Return a new Decimal whose value is the cube root of `n`, rounded to `precision` significant * digits using rounding mode `rounding`. * - * @param { Value } n {number | string | Decimal} + * @param { Value } n {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -2591,7 +2722,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static cbrt(n: Value): Decimal; @@ -2615,8 +2747,8 @@ declare class Decimal { * Return a new Decimal whose value is `base` raised to the power `exponent`, rounded to precision * significant digits using rounding mode `rounding`. * - * @param { Value } base {number | string | Decimal} The base. - * @param { Value } exponent {number | string | Decimal} The exponent. + * @param { Value } base {double | string | Decimal} The base. + * @param { Value } exponent {double | string | Decimal} The exponent. * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -2626,7 +2758,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static pow(base: Value, exponent: Value): Decimal; @@ -2649,7 +2782,7 @@ declare class Decimal { * Return a new Decimal whose value is the natural exponential of `n`, rounded to `precision` * significant digits using rounding mode `rounding`. * - * @param { Value } n {number | string | Decimal} + * @param { Value } n {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -2659,7 +2792,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static exp(n: Value): Decimal; @@ -2683,8 +2817,8 @@ declare class Decimal { * Return a new Decimal whose value is the log of `n` to the base `base`, rounded to `precision` * significant digits using rounding mode `rounding`. * - * @param { Value } n {number | string | Decimal} - * @param { Value } base {number | string | Decimal} + * @param { Value } n {double | string | Decimal} + * @param { Value } base {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -2694,7 +2828,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static log(n: Value, base: Value): Decimal; @@ -2717,7 +2852,7 @@ declare class Decimal { * Return a new Decimal whose value is the natural logarithm of `n`, rounded to `precision` * significant digits using rounding mode `rounding`. * - * @param { Value } n {number | string | Decimal} + * @param { Value } n {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -2727,7 +2862,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static ln(n: Value): Decimal; @@ -2750,7 +2886,7 @@ declare class Decimal { * Return a new Decimal whose value is the base 2 logarithm of `n`, rounded to `precision` * significant digits using rounding mode `rounding`. * - * @param { Value } n {number | string | Decimal} + * @param { Value } n {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -2760,7 +2896,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static log2(n: Value): Decimal; @@ -2783,7 +2920,7 @@ declare class Decimal { * Return a new Decimal whose value is the base 10 logarithm of `n`, rounded to `precision` * significant digits using rounding mode `rounding`. * - * @param { Value } n {number | string | Decimal} + * @param { Value } n {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -2793,7 +2930,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static log10(n: Value): Decimal; @@ -2815,7 +2953,7 @@ declare class Decimal { * Return a new Decimal whose value is the cosine of `n`, rounded to `precision` significant * digits using rounding mode `rounding` * - * @param { Value } n {number | string | Decimal} A value in radians. + * @param { Value } n {double | string | Decimal} A value in radians. * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -2824,7 +2962,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static cos(n: Value): Decimal; @@ -2846,7 +2985,7 @@ declare class Decimal { * Return a new Decimal whose value is the sine of `n`, rounded to `precision` significant digits * using rounding mode `rounding`. * - * @param { Value } n {number | string | Decimal} A value in radians. + * @param { Value } n {double | string | Decimal} A value in radians. * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -2855,7 +2994,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static sin(n: Value): Decimal; @@ -2877,7 +3017,7 @@ declare class Decimal { * Return a new Decimal whose value is the tangent of `n`, rounded to `precision` significant * digits using rounding mode `rounding`. * - * @param { Value } n {number | string | Decimal} A value in radians. + * @param { Value } n {double | string | Decimal} A value in radians. * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -2886,7 +3026,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static tan(n: Value): Decimal; @@ -2908,7 +3049,7 @@ declare class Decimal { * Return a new Decimal whose value is the hyperbolic cosine of `n`, rounded to precision * significant digits using rounding mode `rounding`. * - * @param { Value } n {number | string | Decimal} A value in radians. + * @param { Value } n {double | string | Decimal} A value in radians. * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -2917,7 +3058,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static cosh(n: Value): Decimal; @@ -2939,7 +3081,7 @@ declare class Decimal { * Return a new Decimal whose value is the hyperbolic sine of `n`, rounded to `precision` * significant digits using rounding mode `rounding`. * - * @param { Value } n {number | string | Decimal} + * @param { Value } n {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -2948,7 +3090,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static sinh(n: Value): Decimal; @@ -2970,7 +3113,7 @@ declare class Decimal { * Return a new Decimal whose value is the hyperbolic tangent of `n`, rounded to `precision` * significant digits using rounding mode `rounding`. * - * @param { Value } n {number | string | Decimal} A value in radians. + * @param { Value } n {double | string | Decimal} A value in radians. * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -2979,7 +3122,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static tanh(n: Value): Decimal; @@ -3000,7 +3144,7 @@ declare class Decimal { /** * Return a new Decimal whose value is the arccosine in radians of `n`. * - * @param { Value } n {number | string | Decimal} + * @param { Value } n {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -3010,7 +3154,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static acos(n: Value): Decimal; @@ -3033,7 +3178,7 @@ declare class Decimal { * Return a new Decimal whose value is the arcsine in radians of `n`, rounded to `precision` * significant digits using rounding mode `rounding`. * - * @param { Value } n {number | string | Decimal} + * @param { Value } n {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -3043,7 +3188,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static asin(n: Value): Decimal; @@ -3066,7 +3212,7 @@ declare class Decimal { * Return a new Decimal whose value is the arctangent in radians of `n`, rounded to `precision` * significant digits using rounding mode `rounding`. * - * @param { Value } n {number | string | Decimal} + * @param { Value } n {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -3076,7 +3222,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static atan(n: Value): Decimal; @@ -3099,7 +3246,7 @@ declare class Decimal { * Return a new Decimal whose value is the inverse of the hyperbolic cosine of `n`, rounded to * `precision` significant digits using rounding mode `rounding`. * - * @param { Value } n {number | string | Decimal} + * @param { Value } n {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -3109,7 +3256,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static acosh(n: Value): Decimal; @@ -3132,7 +3280,7 @@ declare class Decimal { * Return a new Decimal whose value is the inverse of the hyperbolic sine of `n`, rounded to * `precision` significant digits using rounding mode `rounding`. * - * @param { Value } n {number | string | Decimal} A value in radians. + * @param { Value } n {double | string | Decimal} A value in radians. * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -3142,7 +3290,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static asinh(n: Value): Decimal; @@ -3165,7 +3314,7 @@ declare class Decimal { * Return a new Decimal whose value is the inverse of the hyperbolic tangent of `n`, rounded to * `precision` significant digits using rounding mode `rounding`. * - * @param { Value } n {number | string | Decimal} A value in radians. + * @param { Value } n {double | string | Decimal} A value in radians. * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -3175,7 +3324,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static atanh(n: Value): Decimal; @@ -3199,8 +3349,8 @@ declare class Decimal { * Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi * (inclusive), rounded to `precision` significant digits using rounding mode `rounding`. * - * @param { Value } y {number | string | Decimal} The y-coordinate. - * @param { Value } x {number | string | Decimal} The x-coordinate. + * @param { Value } y {double | string | Decimal} The y-coordinate. + * @param { Value } x {double | string | Decimal} The x-coordinate. * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -3210,7 +3360,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static atan2(y: Value, x: Value): Decimal; @@ -3232,7 +3383,7 @@ declare class Decimal { * Return a new Decimal whose value is the square root of the sum of the squares of the arguments, * rounded to `precision` significant digits using rounding mode `rounding`. * - * @param { Value[] } n {number | string | Decimal} Decimal + * @param { Value[] } n {double | string | Decimal} Decimal * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -3241,7 +3392,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static hypot(...n: Value[]): Decimal; @@ -3261,7 +3413,7 @@ declare class Decimal { /** * Return a new Decimal whose value is the maximum of the arguments. * - * @param { Value[] } n {number | string | Decimal} + * @param { Value[] } n {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -3270,7 +3422,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static max(...n: Value[]): Decimal; @@ -3290,7 +3443,7 @@ declare class Decimal { /** * Return a new Decimal whose value is the minimum of the arguments. * - * @param { Value[] } n {number | string | Decimal} + * @param { Value[] } n {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -3299,7 +3452,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static min(...n: Value[]): Decimal; @@ -3322,7 +3476,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static random(): Decimal; @@ -3345,7 +3500,7 @@ declare class Decimal { * Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with * `significantDigits` significant digits (or less if trailing zeros are produced). * - * @param { Value } significantDigits {number} Significant digits. Integer, 0 to MAX_DIGITS inclusive. + * @param { Value } significantDigits {double} Significant digits. Integer, 0 to MAX_DIGITS inclusive. * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -3355,9 +3510,10 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - static random(significantDigits: number): Decimal; + static random(significantDigits: double): Decimal; /** * Return the sign of the passed value to the method. @@ -3385,8 +3541,8 @@ declare class Decimal { * -0 if x is -0, * NaN otherwise * - * @param { Value } n {number | string | Decimal} - * @returns { Decimal } the Decimal type + * @param { Value } n {double | string | Decimal} + * @returns { double } the number type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; * 2. Parameter verification failed. @@ -3394,9 +3550,10 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - static sign(n: Value): number; + static sign(n: Value): double; /** * Return a new Decimal whose value is `n` rounded to an integer using rounding mode `rounding`. @@ -3414,7 +3571,7 @@ declare class Decimal { /** * Return a new Decimal whose value is `n` rounded to an integer using rounding mode `rounding`. * - * @param { Value } n {number | string | Decimal} + * @param { Value } n {double | string | Decimal} * @returns { Decimal } the Decimal type * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Incorrect parameter types; @@ -3423,7 +3580,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static round(n: Value): Decimal; @@ -3455,14 +3613,14 @@ declare class Decimal { * Configures the 'global' settings for this particular Decimal constructor. * * @param { DecimalConfig } An object with one or more of the following properties, - * precision {number} - * rounding {number} - * toExpNeg {number} - * toExpPos {number} - * maxE {number} - * minE {number} - * modulo {number} - * crypto {boolean|number} + * precision {double} + * rounding {Rounding} + * toExpNeg {double} + * toExpPos {double} + * maxE {double} + * minE {double} + * modulo {Modulo} + * crypto {boolean} * defaults {true} * @returns { void } * @throws { BusinessError } 401 - Parameter error. Possible causes: @@ -3474,7 +3632,8 @@ declare class Decimal { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ static set(config: DecimalConfig): void; @@ -3499,6 +3658,20 @@ declare class Decimal { */ static readonly ROUND_UP : 0; + /** + * Rounds away from zero + * + * @type { int } + * @readonly + * @static + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + static readonly ROUND_UP: int; + /** * Rounds towards zero * @@ -3520,6 +3693,20 @@ declare class Decimal { */ static readonly ROUND_DOWN : 1; + /** + * Rounds towards zero + * + * @type { int } + * @readonly + * @static + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + static readonly ROUND_DOWN: int; + /** * Rounds towards Infinity * @@ -3541,6 +3728,20 @@ declare class Decimal { */ static readonly ROUND_CEILING : 2; + /** + * Rounds towards Infinity + * + * @type { int } + * @readonly + * @static + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + static readonly ROUND_CEILING: int; + /** * Rounds towards -Infinity * @@ -3562,6 +3763,20 @@ declare class Decimal { */ static readonly ROUND_FLOOR : 3; + /** + * Rounds towards -Infinity + * + * @type { int } + * @readonly + * @static + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + static readonly ROUND_FLOOR: int; + /** * Rounds towards nearest neighbour. If equidistant, rounds away from zero * @@ -3583,6 +3798,20 @@ declare class Decimal { */ static readonly ROUND_HALF_UP : 4; + /** + * Rounds towards nearest neighbour. If equidistant, rounds away from zero + * + * @type { int } + * @readonly + * @static + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + static readonly ROUND_HALF_UP: int; + /** * Rounds towards nearest neighbour. If equidistant, rounds towards zero * @@ -3604,6 +3833,20 @@ declare class Decimal { */ static readonly ROUND_HALF_DOWN : 5; + /** + * Rounds towards nearest neighbour. If equidistant, rounds towards zero + * + * @type { int } + * @readonly + * @static + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + static readonly ROUND_HALF_DOWN: int; + /** * Rounds towards nearest neighbour. If equidistant, rounds towards even neighbour * @@ -3625,6 +3868,20 @@ declare class Decimal { */ static readonly ROUND_HALF_EVEN : 6; + /** + * Rounds towards nearest neighbour. If equidistant, rounds towards even neighbour + * + * @type { int } + * @readonly + * @static + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + static readonly ROUND_HALF_EVEN: int; + /** * Rounds towards nearest neighbour. If equidistant, rounds towards Infinity * @@ -3646,6 +3903,20 @@ declare class Decimal { */ static readonly ROUND_HALF_CEILING : 7; + /** + * Rounds towards nearest neighbour. If equidistant, rounds towards Infinity + * + * @type { int } + * @readonly + * @static + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + static readonly ROUND_HALF_CEILING: int; + /** * Rounds towards nearest neighbour. If equidistant, rounds towards -Infinity * @@ -3667,6 +3938,20 @@ declare class Decimal { */ static readonly ROUND_HALF_FLOOR : 8; + /** + * Rounds towards nearest neighbour. If equidistant, rounds towards -Infinity + * + * @type { int } + * @readonly + * @static + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + static readonly ROUND_HALF_FLOOR: int; + /** * Not a rounding mode, see modulo * @@ -3687,5 +3972,19 @@ declare class Decimal { * @since 18 */ static readonly EUCLIDEAN : 9; + + /** + * Not a rounding mode, see modulo + * + * @type { int } + * @readonly + * @static + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + static readonly EUCLIDEAN: int; } export default Decimal; -- Gitee