diff --git a/api/@ohos.util.d.ets b/api/@ohos.util.d.ets deleted file mode 100644 index 522478ab1dd1ad241d86f3fbc180fe7f1bfcb42c..0000000000000000000000000000000000000000 --- a/api/@ohos.util.d.ets +++ /dev/null @@ -1,1465 +0,0 @@ -/* - * 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. - */ - -'use static'; -/** - * @file - * @kit ArkTS - * @arkts 1.2 - */ - -declare namespace util { - /** - * %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 - * options { depth: 0, colors: false, compact: 3 }. - * %d: Number will be used to convert all values except BigInt and Symbol. - * %i: parseInt(value, 10) is used for all values except BigInt and Symbol. - * %f: parseFloat(value) is used for all values except Bigint and Symbol. - * %j: JSON. Replaced with the string '[Circular]' if the argument contains circular references. - * %o: Object. A string representation of an object with generic JavaScript object formatting.Similar to - * util.inspect() with options { showHidden: true, showProxy: true}. This will show the full object including - * non-enumerable properties and proxies. - * %O: Object. A string representation of an object with generic JavaScript object formatting. - * %O: Object. A string representation of an object with generic JavaScript object formatting.Similar to - * util.inspect() without options. This will show the full object not including non-enumerable properties and - * proxies. - * %c: CSS. This specifier is ignored and will skip any CSS passed in. - * %%: single percent sign ('%'). This does not consume an argument.Returns: The formatted string. - * - * @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 - */ - function format(format: string, ...args: Object[]): string; - - /** - * Generate a random RFC 4122 version 4 UUID using a cryptographically secure random number generator. - * - * @param { boolean } [entropyCache] - Whether to generate the UUID with using the cache. Default: true. - * @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 - */ - function generateRandomUUID(entropyCache?: boolean): string; - - /** - * The Type represents four different encoding formats for base64 - * - * @enum { number } Type - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - enum Type { - /** - * The value indicates that the encoding format of base64 is BASIC - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - BASIC, - /** - * The value indicates that the encoding format of base64 is MIME - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - MIME, - /** - * The value indicates that the encoding format of base64 is BASIC_URL_SAFE - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - BASIC_URL_SAFE, - /** - * The value indicates that the encoding format of base64 is MIME_URL_SAFE - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - MIME_URL_SAFE, - } - - /** - * Decodes a Base64 encoded String or input u8 array into a newly-allocated - * u8 array using the Base64 encoding scheme. - * - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - class Base64Helper { - /** - * Constructor for creating base64 encoding and decoding - * - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - constructor(); - - /** - * Encodes all bytes from the specified u8 array into a 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 { 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 - */ - encodeSync(src: Uint8Array, options?: Type): Uint8Array; - - /** - * 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 - * @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 - */ - 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. - * - * @param { 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 - */ - 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. - * - * @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 - */ - encode(src: Uint8Array, options?: Type): Promise; - - /** - * Asynchronously 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 - * @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 - */ - encodeToString(src: Uint8Array, options?: Type): Promise; - - /** - * Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or - * input u8 array into a newly allocated u8 array. - * - * @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 - */ - decode(src: Uint8Array | string, options?: Type): Promise; - } - - /** - * The ScopeComparable contains comparison methods. - * - * @interface ScopeComparable - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - interface ScopeComparable { - /** - * The comparison function is used by the scope. - * - * @param { ScopeComparable } 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 - */ - compareTo(other: T): boolean; - } - - /** - * A type used to denote ScopeComparable or number. - * - * @typedef { ScopeComparable } - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - type ScopeType = ScopeComparable; - - 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 - * @since 20 - */ - constructor(lowerObj: T, upperObj: T); - - /** - * Obtains a string representation of the current range. - * - * @returns { string } Returns a string representation of the current range object. - * @since 20 - */ - 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. - * @since 20 - */ - 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. - * @since 20 - */ - intersect(lowerObj: T, upperObj: T): ScopeHelper; - - /** - * Obtains the upper bound of the current range. - * - * @returns { ScopeType } Returns the upper bound of the current range. - * @since 20 - */ - getUpper(): T; - - /** - * Obtains the lower bound of the current range. - * - * @returns { ScopeType } Returns the lower bound of the current range. - * @since 20 - */ - 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. - * @since 20 - */ - 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. - * @since 20 - */ - 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. - * @since 20 - */ - expand(value: T): ScopeHelper; - - /** - * Checks whether a given value is within the current range. - * - * @param { ScopeType } value - A ScopeType value - * @returns { boolean } If the value is within the current range return true,otherwise return false. - * @since 20 - */ - contains(value: T): boolean; - - /** - * Checks whether a given range is within the current range. - * - * @param { ScopeHelper } range - A Scope range - * @returns { boolean } If the current range is within the given range return true,otherwise return false. - * @since 20 - */ - 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. - * @since 20 - */ - clamp(value: T): T; - } - - 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 - */ - constructor(capacity?: number); - - /** - * 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 - */ - 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. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - toString(): string; - - /** - * Obtains a list of all values in the current buffer. - * - * @type { number } - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - get length(): number; - - /** - * Obtains the capacity of the current buffer. - * - * @returns { number } Returns the capacity of the current buffer. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - getCapacity(): number; - - /** - * Clears key-value pairs from the current buffer. - * - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - clear(): void; - - /** - * Obtains the number of times createDefault(Object) returned a value. - * - * @returns { number } Returns the number of times createDefault(java.lang.Object) returned a value. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - getCreateCount(): number; - - /** - * Obtains the number of times that the queried values are not matched. - * - * @returns { number } Returns the number of times that the queried values are not matched. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - getMissCount(): number; - - /** - * Obtains the number of times that values are evicted from the buffer. - * - * @returns { number } Returns the number of times that values are evicted from the buffer. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - getRemovalCount(): number; - - /** - * Obtains the number of times that the queried values are successfully matched. - * - * @returns { number } Returns the number of times that the queried values are successfully matched. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - getMatchCount(): number; - - /** - * Obtains the number of times that values are added to the buffer. - * - * @returns { number } Returns the number of times that values are added to the buffer. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - getPutCount(): number; - - /** - * Checks whether the current buffer is empty. - * - * @returns { boolean } Returns true if the current buffer contains no value. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - isEmpty(): boolean; - - /** - * 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. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - get(key: K): V | undefined; - - /** - * Adds a key-value pair to the buffer. - * - * @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. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - 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. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - values(): Array; - - /** - * 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. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - keys(): Array; - - /** - * 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. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - remove(key: K): V | undefined; - - /** - * Executes subsequent operations after a value is deleted. - * - * @param { boolean } isEvict - The parameter value is true if this method is called due to insufficient capacity, - * 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. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - afterRemoval(isEvict: boolean, key: K, value: V, newValue: V): void; - - /** - * Checks whether the current buffer contains a specified key. - * - * @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 - */ - contains(key: K): boolean; - - /** - * Executes subsequent operations if miss to compute a value for the specific key. - * - * @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 - */ - 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. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - entries(): IterableIterator<[K, V]>; - - /** - * Specifies the default iterator for an object. - * - * @returns { IterableIterator<[K, V]> } Returns a two - dimensional array in the form of key - value pairs. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - $_iterator(): IterableIterator<[K, V]>; - } - - /** - * Defines the TextDecoder related options parameters. - * - * @interface TextDecoderOptions - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - interface TextDecoderOptions { - /** - * Is a fatal error displayed? The default value is false. - * @type { ?boolean } - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - - fatal?: boolean; - /** - * Do you want to ignore BOM tags? The default value is false. - * @type { ?boolean } - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - ignoreBOM?: boolean; - } - - /** - * Defines the decode with stream related options parameters. - * - * @interface DecodeToStringOptions - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - interface DecodeToStringOptions { - /** - * Stream option controls stream processing in decoding. The default value is false. - * @type { ?boolean } - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - stream?: boolean; - } - - /** - * Provide the ability to decode binary streams into strings. The supported encoding types include: utf-8, iso-8859-2, - * koi8-r, macintosh, windows-1250, windows-1251, gbk, gb18030, big5, utf-16be, utf-16 le, etc. - * - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - 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 - */ - constructor(encoding?: string); - - /** - * 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 - */ - write(chunk: string | Uint8Array): string; - - /** - * Returns any remaining input stored in the internal buffer as a string. After end() is called, - * this object can be reused for new input. - * - * @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 - */ - end(chunk?: string | Uint8Array): string; - } - - /** - * The TextDecoder represents a text decoder that accepts a string as input, - * decodes it in UTF-8 format, and outputs UTF-8 byte stream. - * - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - class TextDecoder { - /** - * The textDecoder constructor. - * - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - constructor(); - - /** - * The source encoding's name, lowercased. - * - * @return { string } The string of the TextDecoder encoding. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - get encoding(): string; - - /** - * Returns `true` if error mode is "fatal", and `false` otherwise. - * - * @return { boolean } Whether to display fatal errors. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - 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. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - get ignoreBOM(): boolean; - - /** - * Replaces the original constructor to process arguments and return a textDecoder object. - * - * @param { string } [encoding] - Decoding format - * @param { TextDecoderOptions } [options] - Options - * @returns { TextDecoder } - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - static create(encoding?: string, options?: TextDecoderOptions): TextDecoder; - - /** - * The input is decoded and a string is returned. - * If options.stream is set to true, any incomplete byte sequences found at the end of the input are internally - * buffered and will be emitted after the next call to textDecoder.decodeToString(). - * If textDecoder.fatal is set to true, any decoding errors that occur will result in a TypeError being thrown. - * - * @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 - */ - decodeToString(input: Uint8Array, options?: DecodeToStringOptions): string; - } - - /** - * Return encoded text. - * - * @interface EncodeIntoUint8ArrayInfo - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - interface EncodeIntoUint8ArrayInfo { - /** - * The read represents the number of characters that have been encoded. - * @type { int } - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - - read: int; - /** - * The written represents the number of bytes occupied by the encoded characters. - * @type { int } - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - written: int; - } - - /** - * The rational number is mainly to compare rational numbers and obtain the numerator and denominator. - * - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - class RationalNumber { - /** - * A constructor used to create a RationalNumber instance with a given numerator and denominator. - * - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - constructor(); - - /** - * Used to create a RationalNumber instance with a given numerator and denominator. - * - * @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. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - static parseRationalNumber(numerator: number, denominator: number): RationalNumber; - - /** - * Creates a RationalNumber object based on a given string. - * - * @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. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - static createRationalFromString(rationalString: string): RationalNumber; - - /** - * Compares the current RationalNumber object to the given object. - * - * @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 - */ - compare(another: RationalNumber): number; - - /** - * Compares two objects for equality. - * - * @param { Object } obj - An object - * @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 - */ - equals(obj: Object): boolean; - - /** - * Gets integer and floating-point values of a rational number object. - * - * @returns { number } Returns the integer and floating-point values of a rational number object. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 12 - */ - valueOf(): number; - - /** - * Get the greatest common factor of two integers. - * - * @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. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - static getCommonFactor(number1: number, number2: number): number; - - /** - * Gets the denominator of the current object. - * - * @returns { number } Returns the denominator of the current object. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - getDenominator(): number; - - /** - * Gets the numerator of the current object. - * - * @returns { number } Returns the numerator of the current object. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - getNumerator(): number; - - /** - * Checks whether the current RationalNumber object represents an infinite value. - * - * @returns { boolean } If the denominator is not 0, true is returned. Otherwise, false is returned. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - isFinite(): boolean; - - /** - * Checks whether the current RationalNumber object represents a Not-a-Number (NaN) value. - * - * @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 - */ - isNaN(): boolean; - - /** - * Checks whether the current RationalNumber object represents the value 0. - * - * @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 - */ - isZero(): boolean; - - /** - * Obtains a string representation of the current RationalNumber object. - * - * @returns { string } Returns a string representation of the current RationalNumber object. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - toString(): string; - } - - /** - * The TextEncoder interface represents a text encoder. - * The encoder takes the byte stream as the input and outputs the String string. - * - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - class TextEncoder { - /** - * Encoding format. - * - * @return { string } The string of the TextEncoder encoding. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - get encoding(): string; - - /** - * 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 - */ - constructor(encoding?: string); - - /** - * Create a TextEncoder object. - * - * @param { string } [encoding] - The string for encoding format. - * @returns { TextEncoder } - * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Parameter verification failed. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - static create(encoding?: string): TextEncoder; - - /** - * UTF-8 encodes the input string and returns a Uint8Array containing the encoded bytes. - * - * @param { string } [input] - The string to be encoded. - * @returns { Uint8Array } Returns the encoded text. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - encodeInto(input?: string): Uint8Array; - - /** - * Encode string, write the result to dest array. - * - * @param { string } input - The string to be encoded. - * @param { Uint8Array } dest - Encoded numbers in accordance with the format - * @returns { EncodeIntoUint8ArrayInfo } Return the object, where read represents - * 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 - */ - encodeIntoUint8Array(input: string, dest: Uint8Array): EncodeIntoUint8ArrayInfo; - } - - /** - * Check the type of parameter. - * - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - class types { - - /** - * Check whether the entered value is of arraybuffer or sharedarraybuffer type. - * - * @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 - */ - isAnyArrayBuffer(value: Object): boolean; - /** - * Check whether the type is included in the isAnyArrayBuffer. - * - * @param { Object } value - A included in the isAnyArrayBuffer value - * @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 - */ - isArrayBufferView(value: Object): boolean; - /** - * Check whether the entered value is of arraybuffer type. - * - * @param { Object } value - A arraybuffer value - * @returns { boolean } Returns true if the value is a built-in ArrayBuffer instance. - * 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 - */ - isArrayBuffer(value: Object): boolean; - /** - * Check whether the entered value is of bigint64array array type. - * - * @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 - */ - isBigInt64Array(value: Object): boolean; - /** - * Check whether the entered value is of biguint64array array array type. - * - * @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 - */ - isBigUint64Array(value: Object): boolean; - /** - * Check whether the entered value is of DataView type. - * - * @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 - */ - isDataView(value: Object): boolean; - /** - * Check whether the entered value is of type date. - * - * @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 - */ - isDate(value: Object): boolean; - /** - * Check whether the entered value is of float32array array type. - * - * @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 - */ - isFloat32Array(value: Object): boolean; - /** - * Check whether the entered value is of float64array array type. - * - * @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 - */ - isFloat64Array(value: Object): boolean; - /** - * Check whether the entered value is of int8array array type. - * - * @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 - */ - isInt8Array(value: Object): boolean; - /** - * Check whether the entered value is the int16array type. - * - * @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 - */ - isInt16Array(value: Object): boolean; - /** - * Check whether the entered value is the int32array array type. - * - * @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 - */ - isInt32Array(value: Object): boolean; - /** - * Check whether the entered value is of map type. - * - * @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 - */ - isMap(value: Object): boolean; - /** - * Check whether the entered value is the iterator type of map. - * - * @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 - */ - isMapIterator(value: Object): boolean; - /** - * Check whether the value entered is of type error. - * - * @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 - */ - isNativeError(value: Object): boolean; - /** - * Check whether the entered value is of promise type. - * - * @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 - */ - isPromise(value: Object): boolean; - /** - * Check whether the entered value is of type regexp. - * - * @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 - */ - isRegExp(value: Object): boolean; - /** - * Check whether the entered value is of type set. - * - * @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 - */ - isSet(value: Object): boolean; - /** - * Check whether the entered value is the iterator type of set. - * - * @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 - */ - isSetIterator(value: Object): boolean; - /** - * Check whether the entered value is a type contained in typedarray. - * - * @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 - */ - isTypedArray(value: Object): boolean; - /** - * Check whether the entered value is the uint8array array type. - * - * @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 - */ - isUint8Array(value: Object): boolean; - /** - * Check whether the entered value is the uint8clapedarray array type. - * - * @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 - */ - isUint8ClampedArray(value: Object): boolean; - /** - * Check whether the entered value is the uint16array array array type. - * - * @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 - */ - isUint16Array(value: Object): boolean; - /** - * Check whether the entered value is the uint32array array type. - * - * @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 - */ - isUint32Array(value: Object): boolean; - /** - * Check whether the entered value is of type weakmap. - * - * @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 - */ - isWeakMap(value: Object): boolean; - /** - * Check whether the entered value is of type weakset. - * - * @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 - */ - isWeakSet(value: Object): boolean; - } - - /** - * 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 { Function } Return a function that returns promises - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - */ - function promisify(original: Function): (...args: FixedArray) => Promise; - - /** - * Get the hash code of an object. - * - * @param { object } [object] - 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 - */ - function getHash(object: object): 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 - * @crossplatform - * @atomicservice - * @since 20 - */ - 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 - * @crossplatform - * @atomicservice - * @since 20 - */ - function parseUUID(uuid: string): Uint8Array; -} -export default util; diff --git a/api/@ohos.util.d.ts b/api/@ohos.util.d.ts index 9fd84a717844c473359f9a70a1eb81239e74aed3..bebdee3aa3fba3b2e07bd4b043f1297c813f0095 100644 --- a/api/@ohos.util.d.ts +++ b/api/@ohos.util.d.ts @@ -43,7 +43,8 @@ * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 11 + * @since arkts {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ declare namespace util { /** @@ -156,7 +157,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ function format(format: string, ...args: Object[]): string; @@ -206,7 +208,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ function errnoToString(errno: number): string; @@ -292,6 +295,20 @@ declare namespace util { */ function promisify(original: (err: Object, value: Object) => void): Function; + /** + * 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 { UtilCbFn } Return a function that returns promises + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function promisify(original: Function): UtilCbFn; + /** * Takes a function following the common error-first callback style, i.e taking an (err, value) => * callback as the last argument, and return a version that returns promises. @@ -365,7 +382,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ function generateRandomBinaryUUID(entropyCache?: boolean): Uint8Array; @@ -398,7 +416,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ function parseUUID(uuid: string): Uint8Array; @@ -413,9 +432,10 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ - function getHash(object: object): number; + function getHash(obj: object): number; /** * Defines the TextDecoder related options parameters. @@ -424,7 +444,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 11 + * @since arkts {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ interface TextDecoderOptions { /** @@ -433,7 +454,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 11 + * @since arkts {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ fatal?: boolean; /** @@ -442,7 +464,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 11 + * @since arkts {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ ignoreBOM?: boolean; } @@ -475,7 +498,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ interface DecodeToStringOptions { /** @@ -484,7 +508,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ stream?: boolean; } @@ -511,7 +536,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 11 + * @since arkts {'1.1':'11','1.2':'20'} + * @arkts 1.1&1.2 */ class TextDecoder { /** @@ -533,7 +559,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ constructor(); @@ -563,6 +590,19 @@ declare namespace util { */ readonly encoding: string; + /** + * The source encoding's name, lowercased. + * + * @return { 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. * @@ -589,6 +629,18 @@ declare namespace util { */ readonly fatal: boolean; + /** + * Returns `true` if error mode is "fatal", and `false` otherwise. + * + * @return { boolean } Wether 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. * @@ -615,6 +667,18 @@ declare namespace util { */ readonly ignoreBOM = false; + /** + * Returns `true` if ignore BOM flag is set, and `false` otherwise. + * + * @return { 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; + /** * The textDecoder constructor. * @@ -658,7 +722,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 11 + * @since arkts {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ static create(encoding?: string, options?: TextDecoderOptions): TextDecoder; @@ -738,7 +803,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ decodeToString(input: Uint8Array, options?: DecodeToStringOptions): string; } @@ -773,6 +839,40 @@ declare namespace util { written: number; } + /** + * Return encoded text. + * + * @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; + /** + * 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; + } + /** * The TextEncoder interface represents a text encoder. * The encoder takes the byte stream as the input and outputs the String string. @@ -795,7 +895,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 11 + * @since arkts {'1.1':'11','1.2':'20'} + * @arkts 1.1&1.2 */ class TextEncoder { /** @@ -824,6 +925,18 @@ declare namespace util { */ readonly encoding = 'utf-8'; + /** + * Encoding format. + * + * @return { string } The string of the TextEncoder encoding. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + get encoding(): string + /** * The textEncoder constructor. * @@ -872,7 +985,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 11 + * @since arkts {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ constructor(encoding?: string); @@ -885,7 +999,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ static create(encoding?: string): TextEncoder; @@ -929,7 +1044,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 11 + * @since arkts {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ encodeInto(input?: string): Uint8Array; @@ -991,7 +1107,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 11 + * @since arkts {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ encodeIntoUint8Array(input: string, dest: Uint8Array): EncodeIntoUint8ArrayInfo; } @@ -1015,7 +1132,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ class RationalNumber { /** @@ -1049,7 +1167,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ constructor(); @@ -1090,7 +1209,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ static parseRationalNumber(numerator: number, denominator: number): RationalNumber; @@ -1122,7 +1242,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ static createRationalFromString(rationalString: string): RationalNumber; @@ -1172,7 +1293,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ compare(another: RationalNumber): number; @@ -1201,7 +1323,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ equals(obj: Object): boolean; @@ -1227,7 +1350,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ valueOf(): number; @@ -1281,7 +1405,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ static getCommonFactor(number1: number, number2: number): number; @@ -1307,7 +1432,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ getDenominator(): number; @@ -1333,7 +1459,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ getNumerator(): number; @@ -1359,7 +1486,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ isFinite(): boolean; @@ -1385,7 +1513,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ isNaN(): boolean; @@ -1411,7 +1540,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ isZero(): boolean; @@ -1437,7 +1567,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ toString(): string; } @@ -1722,7 +1853,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ class LRUCache { /** @@ -1748,7 +1880,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ constructor(capacity?: number); @@ -1777,7 +1910,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ updateCapacity(newCapacity: number): void; @@ -1803,7 +1937,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ toString(): string; @@ -1833,6 +1968,18 @@ declare namespace util { */ length: number; + /** + * Obtains a list of all values in the current buffer. + * + * @return { number } The length + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + get length(): number; + /** * Obtains the capacity of the current buffer. * @@ -1855,7 +2002,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ getCapacity(): number; @@ -1878,7 +2026,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ clear(): void; @@ -1904,7 +2053,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ getCreateCount(): number; @@ -1930,7 +2080,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ getMissCount(): number; @@ -1956,7 +2107,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ getRemovalCount(): number; @@ -1982,7 +2134,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ getMatchCount(): number; @@ -2008,7 +2161,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ getPutCount(): number; @@ -2034,7 +2188,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ isEmpty(): boolean; @@ -2072,7 +2227,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ get(key: K): V | undefined; @@ -2117,6 +2273,20 @@ declare namespace util { */ put(key: K, value: V): V; + /** + * Adds a key-value pair to the buffer. + * + * @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. + * @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. * @@ -2143,6 +2313,18 @@ declare namespace util { */ values(): V[]; + /** + * 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. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + values(): Array; + /** * Obtains a list of keys for the values in the current buffer. * since 9 @@ -2172,6 +2354,19 @@ declare namespace util { */ keys(): K[]; + /** + * 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. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + keys(): Array; + /** * Deletes a specified key and its associated value from the current buffer. * @@ -2206,7 +2401,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ remove(key: K): V | undefined; @@ -2256,7 +2452,9 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ afterRemoval(isEvict: boolean, key: K, value: V, newValue: V): void; @@ -2294,7 +2492,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ contains(key: K): boolean; @@ -2336,6 +2535,22 @@ declare namespace util { */ createDefault(key: K): V; + /** + * Executes subsequent operations if miss to compute a value for the specific key. + * + * @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. * @@ -2358,7 +2573,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ entries(): IterableIterator<[K, V]>; @@ -2387,6 +2603,18 @@ declare namespace util { * @since 12 */ [Symbol.iterator](): IterableIterator<[K, V]>; + + /** + * Specifies the default iterator for an object. + * + * @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]>; } /** @@ -2444,6 +2672,31 @@ declare namespace util { compareTo(other: ScopeComparable): boolean; } + /** + * The ScopeComparable contains comparison methods. + * + * @interface ScopeComparable + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + interface ScopeComparable { + /** + * The comparison function is used by the scope. + * + * @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; + } + /** * A type used to denote ScopeComparable or number. * @@ -3056,6 +3309,183 @@ declare namespace util { clamp(value: ScopeType): ScopeType; } + /** + * The ScopeHelper interface is used to describe the valid range of a field. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + class ScopeHelper { + /** + * A constructor used to create a Scope instance with the lower and upper bounds specified. + * + * @param { T } lowerObj - A ScopeType value + * @param { T } upperObj - A ScopeType value + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + constructor(lowerObj: T, upperObj: T); + + /** + * Obtains a string representation of the current range. + * + * @returns { string } Returns a string representation of the current range object. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @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. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @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 { 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 + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + intersect(lowerObj: T, upperObj: T): ScopeHelper; + + /** + * Obtains the upper bound of the current range. + * + * @returns { T } Returns the upper bound of the current range. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + getUpper(): T; + + /** + * Obtains the lower bound of the current range. + * + * @returns { T } Returns the lower bound of the current range. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + getLower(): T; + + /** + * Creates 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 + * @atomicservice + * @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. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + expand(range: ScopeHelper): ScopeHelper; + + /** + * Creates 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 + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + expand(value: T): ScopeHelper; + + /** + * Checks whether a given value is within the current range. + * + * @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 + * @crossplatform + * @atomicservice + * @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 + * @returns { boolean } If the current range is within the given range return true,otherwise return false. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + contains(range: ScopeHelper): boolean; + + /** + * Clamps a given value 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 + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + clamp(value: T): T; + } + + /** + * A type used to denote ScopeComparable or number. + * + * @typedef { ScopeComparable } + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + type ScopeType = ScopeComparable; + /** * Decodes a Base64 encoded String or input u8 array into a newly-allocated * u8 array using the Base64 encoding scheme. @@ -3173,7 +3603,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ enum Type { /** @@ -3187,7 +3618,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 11 + * @since arkts {'1.1':'11','1.2':'20'} + * @arkts 1.1&1.2 */ BASIC, /** @@ -3201,7 +3633,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 11 + * @since arkts {'1.1':'11','1.2':'20'} + * @arkts 1.1&1.2 */ MIME, /** @@ -3209,7 +3642,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ BASIC_URL_SAFE, /** @@ -3217,7 +3651,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ MIME_URL_SAFE } @@ -3244,7 +3679,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 11 + * @since arkts {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ class Base64Helper { /** @@ -3266,7 +3702,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 11 + * @since arkts {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ constructor(); @@ -3318,7 +3755,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ encodeSync(src: Uint8Array, options?: Type): Uint8Array; @@ -3372,7 +3810,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ encodeToStringSync(src: Uint8Array, options?: Type): string; @@ -3426,7 +3865,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ decodeSync(src: Uint8Array | string, options?: Type): Uint8Array; @@ -3478,7 +3918,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ encode(src: Uint8Array, options?: Type): Promise; @@ -3518,7 +3959,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ encodeToString(src: Uint8Array, options?: Type): Promise; @@ -3561,7 +4003,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ decode(src: Uint8Array | string, options?: Type): Promise; } @@ -3585,7 +4028,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ class types { /** @@ -3607,7 +4051,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ constructor(); /** @@ -3635,7 +4080,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ isAnyArrayBuffer(value: Object): boolean; /** @@ -3666,7 +4112,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ isArrayBufferView(value: Object): boolean; /** @@ -3725,7 +4172,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ isArrayBuffer(value: Object): boolean; /** @@ -3784,7 +4232,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ isBigInt64Array(value: Object): boolean; /** @@ -3812,7 +4261,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ isBigUint64Array(value: Object): boolean; /** @@ -3898,7 +4348,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ isDataView(value: Object): boolean; /** @@ -3926,7 +4377,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ isDate(value: Object): boolean; /** @@ -3982,7 +4434,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ isFloat32Array(value: Object): boolean; /** @@ -4010,7 +4463,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ isFloat64Array(value: Object): boolean; /** @@ -4103,7 +4557,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ isInt8Array(value: Object): boolean; /** @@ -4131,7 +4586,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ isInt16Array(value: Object): boolean; /** @@ -4159,7 +4615,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ isInt32Array(value: Object): boolean; /** @@ -4187,7 +4644,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ isMap(value: Object): boolean; /** @@ -4215,7 +4673,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ isMapIterator(value: Object): boolean; /** @@ -4271,7 +4730,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ isNativeError(value: Object): boolean; /** @@ -4328,7 +4788,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ isPromise(value: Object): boolean; /** @@ -4384,7 +4845,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ isRegExp(value: Object): boolean; /** @@ -4412,7 +4874,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ isSet(value: Object): boolean; /** @@ -4440,7 +4903,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ isSetIterator(value: Object): boolean; /** @@ -4471,7 +4935,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ isSharedArrayBuffer(value: Object): boolean; /** @@ -4557,7 +5022,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ isTypedArray(value: Object): boolean; /** @@ -4585,7 +5051,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ isUint8Array(value: Object): boolean; /** @@ -4613,7 +5080,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ isUint8ClampedArray(value: Object): boolean; /** @@ -4641,7 +5109,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ isUint16Array(value: Object): boolean; /** @@ -4669,7 +5138,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ isUint32Array(value: Object): boolean; /** @@ -4697,7 +5167,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ isWeakMap(value: Object): boolean; /** @@ -4725,7 +5196,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ isWeakSet(value: Object): boolean; } @@ -4853,7 +5325,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ class StringDecoder { /** @@ -4866,7 +5339,8 @@ declare namespace util { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ constructor(encoding?: string); /** @@ -4881,7 +5355,8 @@ declare namespace util { * @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): string; /** @@ -4896,9 +5371,23 @@ declare namespace util { * @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): string; } + + /** + * The type of URL callback function. + * + * @typedef { function } UtilCbFn + * @param { FixedArray } args - The args of the function. + * @returns { Promise } return Promise. + * @syscap SystemCapability.Utils.Lang + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + type UtilCbFn = (...args: FixedArray) => Promise; } export default util;