1/* 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit ArkTS 19 */ 20 21/** 22 * TextDecoder support full encoding in ICU data utf-8 utf-16 iso8859 must support in all device, TextEncoder takes a 23 * stream of code points as input and emits a stream of UTF-8 bytes, and system help function. 24 * 25 * @namespace util 26 * @syscap SystemCapability.Utils.Lang 27 * @since 7 28 */ 29/** 30 * TextDecoder support full encoding in ICU data utf-8 utf-16 iso8859 must support in all device, TextEncoder takes a 31 * stream of code points as input and emits a stream of UTF-8 bytes, and system help function. 32 * 33 * @namespace util 34 * @syscap SystemCapability.Utils.Lang 35 * @crossplatform 36 * @since 10 37 */ 38/** 39 * The util module provides common utility functions, such as TextEncoder and TextDecoder for string encoding and decoding, 40 * RationalNumber8+ for rational number operations, LRUCache9+ for cache management, ScopeHelper9+ for range determination, 41 * Base64Helper9+ for Base64 encoding and decoding, types8+ for built-in object type check, and Aspect11+ for instrumentation 42 * and replacement on methods. 43 * 44 * @namespace util 45 * @syscap SystemCapability.Utils.Lang 46 * @crossplatform 47 * @atomicservice 48 * @since 11 49 */ 50declare namespace util { 51 /** 52 * %s: String will be used to convert all values except BigInt, Object and -0. BigInt values will be represented 53 * with an n and Objects that have no user defined toString function are inspected using util.inspect() with 54 * options { depth: 0, colors: false, compact: 3 }. 55 * %d: Number will be used to convert all values except BigInt and Symbol. 56 * %i: parseInt(value, 10) is used for all values except BigInt and Symbol. 57 * %f: parseFloat(value) is used for all values except Bigint and Symbol. 58 * %j: JSON. Replaced with the string '[Circular]' if the argument contains circular references. 59 * %o: Object. A string representation of an object with generic JavaScript object formatting.Similar to 60 * util.inspect() with options { showHidden: true, showProxy: true}. This will show the full object including 61 * non-enumerable properties and proxies. 62 * %O: Object. A string representation of an object with generic JavaScript object formatting. 63 * %O: Object. A string representation of an object with generic JavaScript object formatting.Similar to 64 * util.inspect() without options. This will show the full object not including non-enumerable properties and 65 * proxies. 66 * %c: CSS. This specifier is ignored and will skip any CSS passed in. 67 * %%: single percent sign ('%'). This does not consume an argument.Returns: <string> The formatted string. 68 * 69 * @param { string } format - Styled string 70 * @param { Object[] } args - Data to be formatted 71 * @returns { string } Return the character string formatted in a specific format 72 * @syscap SystemCapability.Utils.Lang 73 * @since 7 74 * @deprecated since 9 75 * @useinstead ohos.util.format 76 */ 77 function printf(format: string, ...args: Object[]): string; 78 79 /** 80 * %s: String will be used to convert all values except BigInt, Object and -0. BigInt values will be represented 81 * with an n and Objects that have no user defined toString function are inspected using util.inspect() with 82 * options { depth: 0, colors: false, compact: 3 }. 83 * %d: Number will be used to convert all values except BigInt and Symbol. 84 * %i: parseInt(value, 10) is used for all values except BigInt and Symbol. 85 * %f: parseFloat(value) is used for all values except Bigint and Symbol. 86 * %j: JSON. Replaced with the string '[Circular]' if the argument contains circular references. 87 * %o: Object. A string representation of an object with generic JavaScript object formatting.Similar to 88 * util.inspect() with options { showHidden: true, showProxy: true}. This will show the full object including 89 * non-enumerable properties and proxies. 90 * %O: Object. A string representation of an object with generic JavaScript object formatting. 91 * %O: Object. A string representation of an object with generic JavaScript object formatting.Similar to 92 * util.inspect() without options. This will show the full object not including non-enumerable properties and 93 * proxies. 94 * %c: CSS. This specifier is ignored and will skip any CSS passed in. 95 * %%: single percent sign ('%'). This does not consume an argument.Returns: <string> The formatted string. 96 * 97 * @param { string } format - Styled string 98 * @param { Object[] } args - Data to be formatted 99 * @returns { string } Return the character string formatted in a specific format 100 * @throws { BusinessError } 401 - Parameter error. Possible causes: 101 * 1.Mandatory parameters are left unspecified; 102 * 2.Incorrect parameter types. 103 * @syscap SystemCapability.Utils.Lang 104 * @since 9 105 */ 106 /** 107 * %s: String will be used to convert all values except BigInt, Object and -0. BigInt values will be represented 108 * with an n and Objects that have no user defined toString function are inspected using util.inspect() with 109 * options { depth: 0, colors: false, compact: 3 }. 110 * %d: Number will be used to convert all values except BigInt and Symbol. 111 * %i: parseInt(value, 10) is used for all values except BigInt and Symbol. 112 * %f: parseFloat(value) is used for all values except Bigint and Symbol. 113 * %j: JSON. Replaced with the string '[Circular]' if the argument contains circular references. 114 * %o: Object. A string representation of an object with generic JavaScript object formatting.Similar to 115 * util.inspect() with options { showHidden: true, showProxy: true}. This will show the full object including 116 * non-enumerable properties and proxies. 117 * %O: Object. A string representation of an object with generic JavaScript object formatting. 118 * %O: Object. A string representation of an object with generic JavaScript object formatting.Similar to 119 * util.inspect() without options. This will show the full object not including non-enumerable properties and 120 * proxies. 121 * %c: CSS. This specifier is ignored and will skip any CSS passed in. 122 * %%: single percent sign ('%'). This does not consume an argument.Returns: <string> The formatted string. 123 * 124 * @param { string } format - Styled string 125 * @param { Object[] } args - Data to be formatted 126 * @returns { string } a string formatted in a specific format. 127 * @throws { BusinessError } 401 - Parameter error. Possible causes: 128 * 1.Mandatory parameters are left unspecified; 129 * 2.Incorrect parameter types. 130 * @syscap SystemCapability.Utils.Lang 131 * @crossplatform 132 * @since 10 133 */ 134 /** 135 * Formats a string by replacing the placeholders in it. 136 * %s: String will be used to convert all values except BigInt, Object and -0. BigInt values will be represented 137 * with an n and Objects that have no user defined toString function are inspected using util.inspect() with 138 * options { depth: 0, colors: false, compact: 3 }. 139 * %d: Number will be used to convert all values except BigInt and Symbol. 140 * %i: parseInt(value, 10) is used for all values except BigInt and Symbol. 141 * %f: parseFloat(value) is used for all values except Bigint and Symbol. 142 * %j: JSON. Replaced with the string '[Circular]' if the argument contains circular references. 143 * %o: Object. A string representation of an object with generic JavaScript object formatting.Similar to 144 * util.inspect() with options { showHidden: true, showProxy: true}. This will show the full object including 145 * non-enumerable properties and proxies. 146 * %O: Object. A string representation of an object with generic JavaScript object formatting. 147 * %O: Object. A string representation of an object with generic JavaScript object formatting.Similar to 148 * util.inspect() without options. This will show the full object not including non-enumerable properties and 149 * proxies. 150 * %c: CSS. This specifier is ignored and will skip any CSS passed in. 151 * %%: single percent sign ('%'). This does not consume an argument.Returns: <string> The formatted string. 152 * 153 * @param { string } format - Format string. This string contains zero or more placeholders, which specify the 154 * position and format of the arguments to be inserted. 155 * @param { Object[] } args - Data used to replace the placeholders in format. If null is passed in, the first 156 * argument is returned by default. 157 * @returns { string } a string formatted in a specific format. 158 * @throws { BusinessError } 401 - Parameter error. Possible causes: 159 * 1.Mandatory parameters are left unspecified; 160 * 2.Incorrect parameter types. 161 * @syscap SystemCapability.Utils.Lang 162 * @crossplatform 163 * @atomicservice 164 * @since 12 165 */ 166 function format(format: string, ...args: Object[]): string; 167 168 /** 169 * Get the string name of the system errno. 170 * 171 * @param { number } errno - The error code generated by an error in the system 172 * @returns { string } Return the string name of a system errno 173 * @syscap SystemCapability.Utils.Lang 174 * @since 7 175 * @deprecated since 9 176 * @useinstead ohos.util.errnoToString 177 */ 178 function getErrorString(errno: number): string; 179 180 /** 181 * Get the string name of the system errno. 182 * 183 * @param { number } errno - The error code generated by an error in the system 184 * @returns { string } Return the string name of a system errno 185 * @throws { BusinessError } 401 - Parameter error. Possible causes: 186 * 1.Mandatory parameters are left unspecified; 187 * 2.Incorrect parameter types. 188 * @syscap SystemCapability.Utils.Lang 189 * @since 9 190 */ 191 /** 192 * Get the string name of the system errno. 193 * 194 * @param { number } errno - The error code generated by an error in the system 195 * @returns { string } Return the string name of a system errno 196 * @throws { BusinessError } 401 - Parameter error. Possible causes: 197 * 1.Mandatory parameters are left unspecified; 198 * 2.Incorrect parameter types. 199 * @syscap SystemCapability.Utils.Lang 200 * @crossplatform 201 * @since 10 202 */ 203 /** 204 * Obtains detailed information about a system error code. 205 * 206 * @param { number } errno - Error code generated. 207 * @returns { string } Return the string name of a system errno 208 * @throws { BusinessError } 401 - Parameter error. Possible causes: 209 * 1.Mandatory parameters are left unspecified; 210 * 2.Incorrect parameter types. 211 * @syscap SystemCapability.Utils.Lang 212 * @crossplatform 213 * @atomicservice 214 * @since 12 215 */ 216 function errnoToString(errno: number): string; 217 218 /** 219 * Takes an async function (or a function that returns a Promise) and returns a function following the 220 * error-first callback style. 221 * 222 * @param { Function } original - Asynchronous function 223 * @returns { function } Return a Asynchronous function 224 * @throws { BusinessError } 401 - Parameter error. Possible causes: 225 * 1.Mandatory parameters are left unspecified; 226 * 2.Incorrect parameter types. 227 * @syscap SystemCapability.Utils.Lang 228 * @since 7 229 */ 230 /** 231 * Takes an async function (or a function that returns a Promise) and returns a function following the 232 * error-first callback style. 233 * 234 * @param { Function } original - Asynchronous function 235 * @returns { function } Return a Asynchronous function 236 * @throws { BusinessError } 401 - Parameter error. Possible causes: 237 * 1.Mandatory parameters are left unspecified; 238 * 2.Incorrect parameter types. 239 * @syscap SystemCapability.Utils.Lang 240 * @crossplatform 241 * @since 10 242 */ 243 /** 244 * Calls back an asynchronous function. In the callback, the first parameter indicates the cause of the rejection 245 * (the value is null if the promise has been resolved), and the second parameter indicates the resolved value. 246 * 247 * @param { Function } original - Asynchronous function. 248 * @returns { function } Return a Asynchronous function 249 * @throws { BusinessError } 401 - Parameter error. Possible causes: 250 * 1.Mandatory parameters are left unspecified; 251 * 2.Incorrect parameter types. 252 * @syscap SystemCapability.Utils.Lang 253 * @crossplatform 254 * @atomicservice 255 * @since 12 256 */ 257 function callbackWrapper(original: Function): (err: Object, value: Object) => void; 258 259 /** 260 * Takes a function following the common error-first callback style, i.e taking an (err, value) => 261 * callback as the last argument, and return a function that returns promises. 262 * 263 * @param { function } original - Asynchronous function 264 * @returns { function } Return a function that returns promises 265 * @throws { BusinessError } 401 - Parameter error. Possible causes: 266 * 1.Mandatory parameters are left unspecified; 267 * 2.Incorrect parameter types. 268 * @syscap SystemCapability.Utils.Lang 269 * @since 9 270 */ 271 /** 272 * Takes a function following the common error-first callback style, i.e taking an (err, value) => 273 * callback as the last argument, and return a function that returns promises. 274 * 275 * @param { function } original - Asynchronous function 276 * @returns { Function } Return a function that returns promises 277 * @throws { BusinessError } 401 - Parameter error. Possible causes: 278 * 1.Mandatory parameters are left unspecified; 279 * 2.Incorrect parameter types. 280 * @syscap SystemCapability.Utils.Lang 281 * @crossplatform 282 * @since 10 283 */ 284 /** 285 * Processes an asynchronous function and returns a promise. 286 * 287 * @param { function } original - Function, in which the first parameter err indicates the cause of the rejection 288 * (the value is null if the promise has been resolved) and the second parameter value indicates the resolved value. 289 * @returns { Function } Return a function that returns promises 290 * @throws { BusinessError } 401 - Parameter error. Possible causes: 291 * 1.Mandatory parameters are left unspecified; 292 * 2.Incorrect parameter types. 293 * @syscap SystemCapability.Utils.Lang 294 * @crossplatform 295 * @atomicservice 296 * @since 12 297 */ 298 function promisify(original: (err: Object, value: Object) => void): Function; 299 300 /** 301 * Takes a function following the common error-first callback style, i.e taking an (err, value) => 302 * callback as the last argument, and return a version that returns promises. 303 * 304 * @param { function } original - Asynchronous function 305 * @returns { Object } Return a version that returns promises 306 * @syscap SystemCapability.Utils.Lang 307 * @since 7 308 * @deprecated since 9 309 * @useinstead ohos.util.promisify 310 */ 311 function promiseWrapper(original: (err: Object, value: Object) => void): Object; 312 313 /** 314 * Generate a random RFC 4122 version 4 UUID using a cryptographically secure random number generator. 315 * 316 * @param { boolean } [entropyCache] - Whether to generate the UUID with using the cache. Default: true. 317 * @returns { string } Return a string representing this UUID. 318 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 319 * @syscap SystemCapability.Utils.Lang 320 * @since 9 321 */ 322 /** 323 * Generate a random RFC 4122 version 4 UUID using a cryptographically secure random number generator. 324 * 325 * @param { boolean } [entropyCache] - Whether to generate the UUID with using the cache. Default: true. 326 * @returns { string } Return a string representing this UUID. 327 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 328 * @syscap SystemCapability.Utils.Lang 329 * @crossplatform 330 * @since 10 331 */ 332 /** 333 * Uses a secure random number generator to generate a random universally unique identifier (UUID) of the 334 * string type in RFC 4122 version 4. 335 * 336 * @param { boolean } [entropyCache] - Whether to generate the UUID with using the cache. Default: true. 337 * @returns { string } Return a string representing this UUID. 338 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 339 * @syscap SystemCapability.Utils.Lang 340 * @crossplatform 341 * @atomicservice 342 * @since 12 343 */ 344 function generateRandomUUID(entropyCache?: boolean): string; 345 346 /** 347 * Generate a random RFC 4122 version 4 binary UUID using a cryptographically secure random number generator. 348 * 349 * @param { boolean } [entropyCache] - Whether to generate the UUID with using the cache. Default: true. 350 * @returns { Uint8Array } Return a Uint8Array representing this UUID. 351 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 352 * @syscap SystemCapability.Utils.Lang 353 * @since 9 354 */ 355 /** 356 * Generate a random RFC 4122 version 4 binary UUID using a cryptographically secure random number generator. 357 * 358 * @param { boolean } [entropyCache] - Whether to generate the UUID with using the cache. Default: true. 359 * @returns { Uint8Array } Return a Uint8Array representing this UUID. 360 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 361 * @syscap SystemCapability.Utils.Lang 362 * @crossplatform 363 * @since 10 364 */ 365 /** 366 * Uses a secure random number generator to generate a random UUID of the Uint8Array type in RFC 4122 version 4. 367 * 368 * @param { boolean } [entropyCache] - Whether to generate the UUID with using the cache. Default: true. 369 * @returns { Uint8Array } Return a Uint8Array representing this UUID. 370 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 371 * @syscap SystemCapability.Utils.Lang 372 * @crossplatform 373 * @atomicservice 374 * @since 12 375 */ 376 function generateRandomBinaryUUID(entropyCache?: boolean): Uint8Array; 377 378 /** 379 * Parse a UUID from the string standard representation as described in the RFC 4122 version 4. 380 * 381 * @param { string } uuid - String that specifies a UUID 382 * @returns { Uint8Array } Return a Uint8Array representing this UUID. Throw SyntaxError if parsing fails. 383 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 384 * @syscap SystemCapability.Utils.Lang 385 * @since 9 386 */ 387 /** 388 * Parse a UUID from the string standard representation as described in the RFC 4122 version 4. 389 * 390 * @param { string } uuid - String that specifies a UUID 391 * @returns { Uint8Array } Return a Uint8Array representing this UUID. Throw SyntaxError if parsing fails. 392 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 393 * @syscap SystemCapability.Utils.Lang 394 * @crossplatform 395 * @since 10 396 */ 397 /** 398 * Converts a UUID of the string type generated by generateRandomUUID to a UUID of the Uint8Array type generated 399 * by generateRandomBinaryUUID, as described in RFC 4122 version 4. 400 * 401 * @param { string } uuid - A string representing the UUID. 402 * @returns { Uint8Array } Return a Uint8Array representing this UUID. Throw SyntaxError if parsing fails. 403 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 404 * @throws { BusinessError } 10200002 - Invalid uuid string. 405 * @syscap SystemCapability.Utils.Lang 406 * @crossplatform 407 * @atomicservice 408 * @since 12 409 */ 410 function parseUUID(uuid: string): Uint8Array; 411 412 /** 413 * Obtains the hash value of an object. If no hash value has been obtained, a random hash value is generated 414 * saved to the hash field of the object, and returned. If a hash value has been obtained, the hash value saved 415 * in the hash field is returned (the same value is returned for the same object). 416 * 417 * @param { object } [object] - Object whose hash value is to be obtained. 418 * @returns { number } Return a hash code of an object. 419 * @throws { BusinessError } 401 - Parameter error. Possible causes: 420 * 1.Mandatory parameters are left unspecified; 421 * 2.Incorrect parameter types. 422 * @syscap SystemCapability.Utils.Lang 423 * @crossplatform 424 * @atomicservice 425 * @since 12 426 */ 427 function getHash(object: object): number; 428 429 /** 430 * Get stack trace information for the main thread, returning up to 64 call frames 431 * This interface may impact main thread performance – use with caution. 432 * 433 * @returns { string } Return a stack trace of main thread. 434 * @syscap SystemCapability.Utils.Lang 435 * @crossplatform 436 * @atomicservice 437 * @since 20 438 */ 439 function getMainThreadStackTrace(): string; 440 441 /** 442 * Describes decoding-related options, which include fatal and ignoreBOM. 443 * 444 * @interface TextDecoderOptions 445 * @syscap SystemCapability.Utils.Lang 446 * @crossplatform 447 * @atomicservice 448 * @since 11 449 */ 450 interface TextDecoderOptions { 451 /** 452 * Whether to display fatal errors. The value true means to display fatal errors, and false means the opposite. 453 * The default value is false. 454 * @type { ?boolean } 455 * @syscap SystemCapability.Utils.Lang 456 * @crossplatform 457 * @atomicservice 458 * @since 11 459 */ 460 fatal?: boolean; 461 /** 462 * Whether to ignore the BOM. The value true means to ignore the BOM, and false means the opposite. 463 * The default value is false. 464 * @type { ?boolean } 465 * @syscap SystemCapability.Utils.Lang 466 * @crossplatform 467 * @atomicservice 468 * @since 11 469 */ 470 ignoreBOM?: boolean; 471 } 472 473 /** 474 * Defines the decode with stream related options parameters. 475 * 476 * @interface DecodeWithStreamOptions 477 * @syscap SystemCapability.Utils.Lang 478 * @crossplatform 479 * @atomicservice 480 * @since 11 481 */ 482 interface DecodeWithStreamOptions { 483 /** 484 * Does the call follow additional data blocks. The default value is false. 485 * @type { ?boolean } 486 * @syscap SystemCapability.Utils.Lang 487 * @crossplatform 488 * @atomicservice 489 * @since 11 490 */ 491 stream?: boolean; 492 } 493 494 /** 495 * Defines the decode with stream related options parameters. 496 * 497 * @interface DecodeToStringOptions 498 * @syscap SystemCapability.Utils.Lang 499 * @crossplatform 500 * @atomicservice 501 * @since 12 502 */ 503 interface DecodeToStringOptions { 504 /** 505 * Stream option controls stream processing in decoding. The default value is false. 506 * @type { ?boolean } 507 * @syscap SystemCapability.Utils.Lang 508 * @crossplatform 509 * @atomicservice 510 * @since 12 511 */ 512 stream?: boolean; 513 } 514 515 /** 516 * The TextDecoder represents a text decoder that accepts a string as input, 517 * decodes it in UTF-8 format, and outputs UTF-8 byte stream. 518 * 519 * @syscap SystemCapability.Utils.Lang 520 * @since 7 521 */ 522 /** 523 * The TextDecoder represents a text decoder that accepts a string as input, 524 * decodes it in UTF-8 format, and outputs UTF-8 byte stream. 525 * 526 * @syscap SystemCapability.Utils.Lang 527 * @crossplatform 528 * @since 10 529 */ 530 /** 531 * Provides APIs to decode byte arrays into strings. It supports multiple formats, 532 * including UTF-8, UTF-16LE, UTF-16BE, ISO-8859, and Windows-1251. 533 * 534 * @syscap SystemCapability.Utils.Lang 535 * @crossplatform 536 * @atomicservice 537 * @since 11 538 */ 539 class TextDecoder { 540 /** 541 * The textDecoder constructor. 542 * 543 * @syscap SystemCapability.Utils.Lang 544 * @since 9 545 */ 546 /** 547 * The textDecoder constructor. 548 * 549 * @syscap SystemCapability.Utils.Lang 550 * @crossplatform 551 * @since 10 552 */ 553 /** 554 * A constructor used to create a TextDecoder object. 555 * 556 * @syscap SystemCapability.Utils.Lang 557 * @crossplatform 558 * @atomicservice 559 * @since 12 560 */ 561 constructor(); 562 563 /** 564 * The source encoding's name, lowercased. 565 * 566 * @type { string } 567 * @syscap SystemCapability.Utils.Lang 568 * @since 7 569 */ 570 /** 571 * The source encoding's name, lowercased. 572 * 573 * @type { string } 574 * @syscap SystemCapability.Utils.Lang 575 * @crossplatform 576 * @since 10 577 */ 578 /** 579 * The source encoding's name, lowercased. 580 * 581 * @type { string } 582 * @syscap SystemCapability.Utils.Lang 583 * @crossplatform 584 * @atomicservice 585 * @since 12 586 */ 587 readonly encoding: string; 588 589 /** 590 * Returns `true` if error mode is "fatal", and `false` otherwise. 591 * 592 * @type { boolean } 593 * @syscap SystemCapability.Utils.Lang 594 * @since 7 595 */ 596 /** 597 * Returns `true` if error mode is "fatal", and `false` otherwise. 598 * 599 * @type { boolean } 600 * @syscap SystemCapability.Utils.Lang 601 * @crossplatform 602 * @since 10 603 */ 604 /** 605 * Returns `true` if error mode is "fatal", and `false` otherwise. 606 * 607 * @type { boolean } 608 * @syscap SystemCapability.Utils.Lang 609 * @crossplatform 610 * @atomicservice 611 * @since 12 612 */ 613 readonly fatal: boolean; 614 615 /** 616 * Returns `true` if ignore BOM flag is set, and `false` otherwise. 617 * 618 * @type { false } 619 * @syscap SystemCapability.Utils.Lang 620 * @since 7 621 */ 622 /** 623 * Returns `true` if ignore BOM flag is set, and `false` otherwise. 624 * 625 * @type { false } 626 * @syscap SystemCapability.Utils.Lang 627 * @crossplatform 628 * @since 10 629 */ 630 /** 631 * Returns `true` if ignore BOM flag is set, and `false` otherwise. 632 * 633 * @type { false } 634 * @syscap SystemCapability.Utils.Lang 635 * @crossplatform 636 * @atomicservice 637 * @since 12 638 */ 639 readonly ignoreBOM = false; 640 641 /** 642 * The textDecoder constructor. 643 * 644 * @param { string } encoding - Decoding format 645 * @param { object } options - Options 646 * @syscap SystemCapability.Utils.Lang 647 * @since 7 648 * @deprecated since 9 649 * @useinstead ohos.util.TextDecoder.create 650 */ 651 constructor(encoding?: string, options?: { fatal?: boolean; ignoreBOM?: boolean }); 652 653 /** 654 * Replaces the original constructor to process arguments and return a textDecoder object. 655 * 656 * @param { string } encoding - Decoding format 657 * @param { object } options - Options 658 * @returns { TextDecoder } 659 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 660 * @syscap SystemCapability.Utils.Lang 661 * @since 9 662 */ 663 /** 664 * Replaces the original constructor to process arguments and return a textDecoder object. 665 * 666 * @param { string } encoding - Decoding format 667 * @param { object } options - Options 668 * @returns { TextDecoder } 669 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 670 * @syscap SystemCapability.Utils.Lang 671 * @crossplatform 672 * @since 10 673 */ 674 /** 675 * Creates a TextDecoder object. It provides the same function as the deprecated argument constructor. 676 * 677 * @param { string } [encoding] - Encoding format. The default format is 'utf-8'. 678 * @param { TextDecoderOptions } [options] - Decoding-related options, which include fatal and ignoreBOM. 679 * @returns { TextDecoder } 680 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 681 * @syscap SystemCapability.Utils.Lang 682 * @crossplatform 683 * @atomicservice 684 * @since 11 685 */ 686 static create(encoding?: string, options?: TextDecoderOptions): TextDecoder; 687 688 /** 689 * Returns the result of running encoding's decoder. 690 * 691 * @param { Uint8Array } input - Decoded numbers in accordance with the format 692 * @param { object } options - Options 693 * @returns { string } Return decoded text 694 * @syscap SystemCapability.Utils.Lang 695 * @since 7 696 * @deprecated since 9 697 * @useinstead ohos.util.decodeWithStream 698 */ 699 decode(input: Uint8Array, options?: { stream?: false }): string; 700 701 /** 702 * Decodes the input and returns a string. If options.stream is true, any incomplete byte sequences occurring 703 * at the end of the input are buffered internally and emitted after the next call to textDecoder.decode(). 704 * If textDecoder.fatal is true, decoding errors that occur will result in a TypeError being thrown. 705 * 706 * @param { Uint8Array } input - Decoded numbers in accordance with the format 707 * @param { object } options - Options 708 * @returns { string } Return decoded text 709 * @throws { BusinessError } 401 - Parameter error. Possible causes: 710 * 1.Mandatory parameters are left unspecified; 711 * 2.Incorrect parameter types. 712 * @syscap SystemCapability.Utils.Lang 713 * @since 9 714 */ 715 /** 716 * Decodes the input and returns a string. If options.stream is true, any incomplete byte sequences occurring 717 * at the end of the input are buffered internally and emitted after the next call to textDecoder.decode(). 718 * If textDecoder.fatal is true, decoding errors that occur will result in a TypeError being thrown. 719 * 720 * @param { Uint8Array } input - Decoded numbers in accordance with the format 721 * @param { object } options - Options 722 * @returns { string } Return decoded text 723 * @throws { BusinessError } 401 - Parameter error. Possible causes: 724 * 1.Mandatory parameters are left unspecified; 725 * 2.Incorrect parameter types. 726 * @syscap SystemCapability.Utils.Lang 727 * @crossplatform 728 * @since 10 729 */ 730 /** 731 * Decodes the input and returns a string. If options.stream is true, any incomplete byte sequences occurring 732 * at the end of the input are buffered internally and emitted after the next call to textDecoder.decode(). 733 * If textDecoder.fatal is true, decoding errors that occur will result in a TypeError being thrown. 734 * 735 * @param { Uint8Array } input - Decoded numbers in accordance with the format 736 * @param { DecodeWithStreamOptions } [options] - Options 737 * @returns { string } Return decoded text 738 * @throws { BusinessError } 401 - Parameter error. Possible causes: 739 * 1.Mandatory parameters are left unspecified; 740 * 2.Incorrect parameter types. 741 * @syscap SystemCapability.Utils.Lang 742 * @crossplatform 743 * @atomicservice 744 * @since 11 745 * @deprecated since 12 746 * @useinstead ohos.util.decodeToString 747 */ 748 decodeWithStream(input: Uint8Array, options?: DecodeWithStreamOptions): string; 749 /** 750 * Decodes the input content into a string. 751 * 752 * @param { Uint8Array } input - Uint8Array object to decode. 753 * @param { DecodeToStringOptions } [options] -Decoding-related options. The default value is undefined. 754 * @returns { string } Return decoded text 755 * @throws { BusinessError } 401 - Parameter error. Possible causes: 756 * 1.Mandatory parameters are left unspecified; 757 * 2.Incorrect parameter types. 758 * @syscap SystemCapability.Utils.Lang 759 * @crossplatform 760 * @atomicservice 761 * @since 12 762 */ 763 decodeToString(input: Uint8Array, options?: DecodeToStringOptions): string; 764 } 765 766 /** 767 * Return encoded text. 768 * 769 * @interface EncodeIntoUint8ArrayInfo 770 * @syscap SystemCapability.Utils.Lang 771 * @crossplatform 772 * @atomicservice 773 * @since 11 774 */ 775 interface EncodeIntoUint8ArrayInfo { 776 /** 777 * The read represents the number of characters that have been encoded. 778 * @type { number } 779 * @syscap SystemCapability.Utils.Lang 780 * @crossplatform 781 * @atomicservice 782 * @since 11 783 */ 784 read: number; 785 /** 786 * The written represents the number of bytes occupied by the encoded characters. 787 * @type { number } 788 * @syscap SystemCapability.Utils.Lang 789 * @crossplatform 790 * @atomicservice 791 * @since 11 792 */ 793 written: number; 794 } 795 796 /** 797 * The TextEncoder interface represents a text encoder. 798 * The encoder takes the byte stream as the input and outputs the String string. 799 * 800 * @syscap SystemCapability.Utils.Lang 801 * @since 7 802 */ 803 /** 804 * The TextEncoder interface represents a text encoder. 805 * The encoder takes the byte stream as the input and outputs the String string. 806 * 807 * @syscap SystemCapability.Utils.Lang 808 * @crossplatform 809 * @since 10 810 */ 811 /** 812 * The TextEncoder interface represents a text encoder. 813 * The encoder takes the byte stream as the input and outputs the String string. 814 * 815 * @syscap SystemCapability.Utils.Lang 816 * @crossplatform 817 * @atomicservice 818 * @since 11 819 */ 820 class TextEncoder { 821 /** 822 * Encoding format. 823 * 824 * @type { 'utf-8' } 825 * @syscap SystemCapability.Utils.Lang 826 * @since 7 827 */ 828 /** 829 * Encoding format. 830 * 831 * @type { 'utf-8' } 832 * @syscap SystemCapability.Utils.Lang 833 * @crossplatform 834 * @since 10 835 */ 836 /** 837 * Encoding format. 838 * 839 * @type { 'utf-8' } 840 * @syscap SystemCapability.Utils.Lang 841 * @crossplatform 842 * @atomicservice 843 * @since 12 844 */ 845 readonly encoding = 'utf-8'; 846 847 /** 848 * The textEncoder constructor. 849 * 850 * @syscap SystemCapability.Utils.Lang 851 * @since 7 852 */ 853 /** 854 * The textEncoder constructor. 855 * 856 * @syscap SystemCapability.Utils.Lang 857 * @crossplatform 858 * @since 10 859 */ 860 /** 861 * A constructor used to create a TextEncoder object. 862 * 863 * @syscap SystemCapability.Utils.Lang 864 * @crossplatform 865 * @atomicservice 866 * @since 11 867 */ 868 constructor(); 869 870 /** 871 * The textEncoder constructor. 872 * 873 * @param { string } [encoding] - The string for encoding format. 874 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 875 * @syscap SystemCapability.Utils.Lang 876 * @since 9 877 */ 878 /** 879 * The textEncoder constructor. 880 * 881 * @param { string } [encoding] - The string for encoding format. 882 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 883 * @syscap SystemCapability.Utils.Lang 884 * @crossplatform 885 * @since 10 886 */ 887 /** 888 * A constructor used to create a TextEncoder object. 889 * 890 * @param { string } [encoding] - Encoding format. The default format is 'utf-8'. 891 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 892 * @syscap SystemCapability.Utils.Lang 893 * @crossplatform 894 * @atomicservice 895 * @since 11 896 */ 897 constructor(encoding?: string); 898 899 /** 900 * Creates a TextEncoder object. 901 * 902 * @param { string } [encoding] - Encoding format. The default format is 'utf-8'. 903 * @returns { TextEncoder } 904 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 905 * @syscap SystemCapability.Utils.Lang 906 * @crossplatform 907 * @atomicservice 908 * @since 12 909 */ 910 static create(encoding?: string): TextEncoder; 911 912 /** 913 * Returns the result of encoder. 914 * 915 * @param { string } [input] - The string to be encoded. 916 * @returns { Uint8Array } Returns the encoded text. 917 * @syscap SystemCapability.Utils.Lang 918 * @since 7 919 * @deprecated since 9 920 * @useinstead ohos.util.encodeInto 921 */ 922 encode(input?: string): Uint8Array; 923 924 /** 925 * UTF-8 encodes the input string and returns a Uint8Array containing the encoded bytes. 926 * 927 * @param { string } [input] - The string to be encoded. 928 * @returns { Uint8Array } Returns the encoded text. 929 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 930 * @syscap SystemCapability.Utils.Lang 931 * @since 9 932 */ 933 /** 934 * UTF-8 encodes the input string and returns a Uint8Array containing the encoded bytes. 935 * 936 * @param { string } [input] - The string to be encoded. 937 * @returns { Uint8Array } Returns the encoded text. 938 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 939 * @syscap SystemCapability.Utils.Lang 940 * @crossplatform 941 * @since 10 942 */ 943 /** 944 * Encodes the input content into a Uint8Array object. 945 * 946 * @param { string } [input] - String to encode. The default value is an empty string. 947 * @returns { Uint8Array } Returns the encoded text. 948 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 949 * @syscap SystemCapability.Utils.Lang 950 * @crossplatform 951 * @atomicservice 952 * @since 11 953 */ 954 encodeInto(input?: string): Uint8Array; 955 956 /** 957 * Encode string, write the result to dest array. 958 * 959 * @param { string } input - The string to be encoded. 960 * @param { Uint8Array } dest - Encoded numbers in accordance with the format 961 * @returns { object } Return the object, where read represents 962 * the number of characters that have been encoded, and written 963 * represents the number of bytes occupied by the encoded characters. 964 * @syscap SystemCapability.Utils.Lang 965 * @since 7 966 * @deprecated since 9 967 * @useinstead ohos.util.encodeIntoUint8Array 968 */ 969 encodeInto(input: string, dest: Uint8Array): { read: number; written: number }; 970 971 /** 972 * Encode string, write the result to dest array. 973 * 974 * @param { string } input - The string to be encoded. 975 * @param { Uint8Array } dest - Encoded numbers in accordance with the format 976 * @returns { object } Return the object, where read represents 977 * the number of characters that have been encoded, and written 978 * represents the number of bytes occupied by the encoded characters. 979 * @throws { BusinessError } 401 - Parameter error. Possible causes: 980 * 1.Mandatory parameters are left unspecified; 981 * 2.Incorrect parameter types. 982 * @syscap SystemCapability.Utils.Lang 983 * @since 9 984 */ 985 /** 986 * Encode string, write the result to dest array. 987 * 988 * @param { string } input - The string to be encoded. 989 * @param { Uint8Array } dest - Encoded numbers in accordance with the format 990 * @returns { object } Return the object, where read represents 991 * the number of characters that have been encoded, and written 992 * represents the number of bytes occupied by the encoded characters. 993 * @throws { BusinessError } 401 - Parameter error. Possible causes: 994 * 1.Mandatory parameters are left unspecified; 995 * 2.Incorrect parameter types. 996 * @syscap SystemCapability.Utils.Lang 997 * @crossplatform 998 * @since 10 999 */ 1000 /** 1001 * Encodes the input content into a Uint8Array object. 1002 * 1003 * @param { string } input - String to encode. 1004 * @param { Uint8Array } dest - Uint8Array object used to store the UTF-8 encoded text. 1005 * @returns { EncodeIntoUint8ArrayInfo } Return the object, where read represents 1006 * the number of characters that have been encoded, and written 1007 * represents the number of bytes occupied by the encoded characters. 1008 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1009 * 1.Mandatory parameters are left unspecified; 1010 * 2.Incorrect parameter types. 1011 * @syscap SystemCapability.Utils.Lang 1012 * @crossplatform 1013 * @atomicservice 1014 * @since 11 1015 */ 1016 encodeIntoUint8Array(input: string, dest: Uint8Array): EncodeIntoUint8ArrayInfo; 1017 } 1018 1019 /** 1020 * The rational number is mainly to compare rational numbers and obtain the numerator and denominator. 1021 * 1022 * @syscap SystemCapability.Utils.Lang 1023 * @since 8 1024 */ 1025 /** 1026 * The rational number is mainly to compare rational numbers and obtain the numerator and denominator. 1027 * 1028 * @syscap SystemCapability.Utils.Lang 1029 * @crossplatform 1030 * @since 10 1031 */ 1032 /** 1033 * The rational number is mainly to compare rational numbers and obtain the numerator and denominator. 1034 * 1035 * @syscap SystemCapability.Utils.Lang 1036 * @crossplatform 1037 * @atomicservice 1038 * @since 12 1039 */ 1040 class RationalNumber { 1041 /** 1042 * A constructor used to create a RationalNumber instance with a given numerator and denominator. 1043 * 1044 * @param { number } numerator - An integer number 1045 * @param { number } denominator - An integer number 1046 * @syscap SystemCapability.Utils.Lang 1047 * @since 8 1048 * @deprecated since 9 1049 * @useinstead ohos.util.RationalNumber.parseRationalNumber 1050 */ 1051 constructor(numerator: number, denominator: number); 1052 1053 /** 1054 * A constructor used to create a RationalNumber instance with a given numerator and denominator. 1055 * 1056 * @syscap SystemCapability.Utils.Lang 1057 * @since 9 1058 */ 1059 /** 1060 * A constructor used to create a RationalNumber instance with a given numerator and denominator. 1061 * 1062 * @syscap SystemCapability.Utils.Lang 1063 * @crossplatform 1064 * @since 10 1065 */ 1066 /** 1067 * A constructor used to create a RationalNumber object. 1068 * 1069 * @syscap SystemCapability.Utils.Lang 1070 * @crossplatform 1071 * @atomicservice 1072 * @since 12 1073 */ 1074 constructor(); 1075 1076 /** 1077 * Used to create a RationalNumber instance with a given numerator and denominator. 1078 * 1079 * @param { number } numerator - An integer number 1080 * @param { number } denominator - An integer number 1081 * @returns { RationalNumber } 1082 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1083 * 1.Mandatory parameters are left unspecified; 1084 * 2.Incorrect parameter types. 1085 * @syscap SystemCapability.Utils.Lang 1086 * @since 9 1087 */ 1088 /** 1089 * Used to create a RationalNumber instance with a given numerator and denominator. 1090 * 1091 * @param { number } numerator - An integer number 1092 * @param { number } denominator - An integer number 1093 * @returns { RationalNumber } 1094 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1095 * 1.Mandatory parameters are left unspecified; 1096 * 2.Incorrect parameter types. 1097 * @syscap SystemCapability.Utils.Lang 1098 * @crossplatform 1099 * @since 10 1100 */ 1101 /** 1102 * Create a RationalNumber instance with a given numerator and denominator. 1103 * The numerator and denominator parameters must be integers. If a decimal number is passed in, the function is not 1104 * intercepted, but the error message "parseRationalNumber: The type of Parameter must be integer" is displayed. 1105 * 1106 * @param { number } numerator - Numerator, which is an integer. 1107 * @param { number } denominator - Denominator, which is an integer. 1108 * @returns { RationalNumber } 1109 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1110 * 1.Mandatory parameters are left unspecified; 1111 * 2.Incorrect parameter types. 1112 * @syscap SystemCapability.Utils.Lang 1113 * @crossplatform 1114 * @atomicservice 1115 * @since 12 1116 */ 1117 static parseRationalNumber(numerator: number, denominator: number): RationalNumber; 1118 1119 /** 1120 * Creates a RationalNumber object based on a given string. 1121 * 1122 * @param { string } rationalString - String Expression of Rational Numbers 1123 * @returns { RationalNumber } Returns a RationalNumber object generated based on the given string. 1124 * @throws { BusinessError } 401 - The type of rationalString must be string. 1125 * @syscap SystemCapability.Utils.Lang 1126 * @since 8 1127 */ 1128 /** 1129 * Creates a RationalNumber object based on a given string. 1130 * 1131 * @param { string } rationalString - String Expression of Rational Numbers 1132 * @returns { RationalNumber } Returns a RationalNumber object generated based on the given string. 1133 * @throws { BusinessError } 401 - The type of rationalString must be string. 1134 * @syscap SystemCapability.Utils.Lang 1135 * @crossplatform 1136 * @since 10 1137 */ 1138 /** 1139 * Creates a RationalNumber object based on the given string. 1140 * The rationalString parameter must be a string. If a decimal string is passed in, the function is not intercepted, 1141 * but the error message "createRationalFromString: The type of Parameter must be integer string" is displayed. 1142 * 1143 * @param { string } rationalString - String used to create the RationalNumber object. 1144 * @returns { RationalNumber } Returns a RationalNumber object generated based on the given string. 1145 * @throws { BusinessError } 401 - The type of rationalString must be string. 1146 * @syscap SystemCapability.Utils.Lang 1147 * @crossplatform 1148 * @atomicservice 1149 * @since 12 1150 */ 1151 static createRationalFromString(rationalString: string): RationalNumber; 1152 1153 /** 1154 * Compares the current RationalNumber object to the given object. 1155 * 1156 * @param { RationalNumber } another - An object of other rational numbers 1157 * @returns { number } Returns 0 or 1, or -1, depending on the comparison. 1158 * @syscap SystemCapability.Utils.Lang 1159 * @since 8 1160 * @deprecated since 9 1161 * @useinstead ohos.util.compare 1162 */ 1163 compareTo(another: RationalNumber): number; 1164 1165 /** 1166 * Compares the current RationalNumber object to the given object. 1167 * 1168 * @param { RationalNumber } another - An object of other rational numbers 1169 * @returns { number } Returns 0 or 1, or -1, depending on the comparison. 1170 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1171 * 1.Mandatory parameters are left unspecified; 1172 * 2.Incorrect parameter types. 1173 * @syscap SystemCapability.Utils.Lang 1174 * @since 9 1175 */ 1176 /** 1177 * Compares the current RationalNumber object to the given object. 1178 * 1179 * @param { RationalNumber } another - An object of other rational numbers 1180 * @returns { number } Returns 0 or 1, or -1, depending on the comparison. 1181 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1182 * 1.Mandatory parameters are left unspecified; 1183 * 2.Incorrect parameter types. 1184 * @syscap SystemCapability.Utils.Lang 1185 * @crossplatform 1186 * @since 10 1187 */ 1188 /** 1189 * Compares this RationalNumber object with another RationalNumber object. 1190 * 1191 * @param { RationalNumber } another - Object used to compare with this RationalNumber object. 1192 * @returns { number } Returns 0 or 1, or -1, depending on the comparison. 1193 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1194 * 1.Mandatory parameters are left unspecified; 1195 * 2.Incorrect parameter types. 1196 * @syscap SystemCapability.Utils.Lang 1197 * @crossplatform 1198 * @atomicservice 1199 * @since 12 1200 */ 1201 compare(another: RationalNumber): number; 1202 1203 /** 1204 * Compares two objects for equality. 1205 * 1206 * @param { Object } obj - An object 1207 * @returns { boolean } Returns true if the given object is the same as the current object; Otherwise, false is returned. 1208 * @syscap SystemCapability.Utils.Lang 1209 * @since 8 1210 */ 1211 /** 1212 * Compares two objects for equality. 1213 * 1214 * @param { Object } obj - An object 1215 * @returns { boolean } Returns true if the given object is the same as the current object; Otherwise, false is returned. 1216 * @syscap SystemCapability.Utils.Lang 1217 * @crossplatform 1218 * @since 10 1219 */ 1220 /** 1221 * Checks whether this RationalNumber object equals the given object. 1222 * 1223 * @param { Object } obj - Object used to compare with this RationalNumber object. 1224 * @returns { boolean } Returns true if the given object is the same as the current object; Otherwise, false is returned. 1225 * @syscap SystemCapability.Utils.Lang 1226 * @crossplatform 1227 * @atomicservice 1228 * @since 12 1229 */ 1230 equals(obj: Object): boolean; 1231 1232 /** 1233 * Gets integer and floating-point values of a rational number object. 1234 * 1235 * @returns { number } Returns the integer and floating-point values of a rational number object. 1236 * @syscap SystemCapability.Utils.Lang 1237 * @since 8 1238 */ 1239 /** 1240 * Gets integer and floating-point values of a rational number object. 1241 * 1242 * @returns { number } Returns the integer and floating-point values of a rational number object. 1243 * @syscap SystemCapability.Utils.Lang 1244 * @crossplatform 1245 * @since 10 1246 */ 1247 /** 1248 * Obtains the value of this RationalNumber object as an integer or a floating-point number. 1249 * 1250 * @returns { number } Returns the integer and floating-point values of a rational number object. 1251 * @syscap SystemCapability.Utils.Lang 1252 * @crossplatform 1253 * @atomicservice 1254 * @since 12 1255 */ 1256 valueOf(): number; 1257 1258 /** 1259 * Get the greatest common divisor of two integers. 1260 * 1261 * @param { number } number1 - Is an integer. 1262 * @param { number } number2 - Is an integer. 1263 * @returns { number } Returns the greatest common divisor of two integers, integer type. 1264 * @syscap SystemCapability.Utils.Lang 1265 * @since 8 1266 * @deprecated since 9 1267 * @useinstead ohos.util.getCommonFactor 1268 */ 1269 static getCommonDivisor(number1: number, number2: number): number; 1270 1271 /** 1272 * Get the greatest common factor of two integers. 1273 * 1274 * @param { number } number1 - Is an integer. 1275 * @param { number } number2 - Is an integer. 1276 * @returns { number } Returns the greatest common factor of two integers, integer type. 1277 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1278 * 1.Mandatory parameters are left unspecified; 1279 * 2.Incorrect parameter types. 1280 * @syscap SystemCapability.Utils.Lang 1281 * @since 9 1282 */ 1283 /** 1284 * Get the greatest common factor of two integers. 1285 * 1286 * @param { number } number1 - Is an integer. 1287 * @param { number } number2 - Is an integer. 1288 * @returns { number } Returns the greatest common factor of two integers, integer type. 1289 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1290 * 1.Mandatory parameters are left unspecified; 1291 * 2.Incorrect parameter types. 1292 * @syscap SystemCapability.Utils.Lang 1293 * @crossplatform 1294 * @since 10 1295 */ 1296 /** 1297 * Obtains the greatest common divisor of two specified integers. 1298 * 1299 * @param { number } number1 - The first integer used to get the greatest common divisor. 1300 * @param { number } number2 - The second integer used to get the greatest common divisor. 1301 * @returns { number } Returns the greatest common factor of two integers, integer type. 1302 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1303 * 1.Mandatory parameters are left unspecified; 1304 * 2.Incorrect parameter types. 1305 * @syscap SystemCapability.Utils.Lang 1306 * @crossplatform 1307 * @atomicservice 1308 * @since 12 1309 */ 1310 static getCommonFactor(number1: number, number2: number): number; 1311 1312 /** 1313 * Gets the denominator of the current object. 1314 * 1315 * @returns { number } Returns the denominator of the current object. 1316 * @syscap SystemCapability.Utils.Lang 1317 * @since 8 1318 */ 1319 /** 1320 * Gets the denominator of the current object. 1321 * 1322 * @returns { number } Returns the denominator of the current object. 1323 * @syscap SystemCapability.Utils.Lang 1324 * @crossplatform 1325 * @since 10 1326 */ 1327 /** 1328 * Obtains the denominator of this RationalNumber object. 1329 * 1330 * @returns { number } Returns the denominator of the current object. 1331 * @syscap SystemCapability.Utils.Lang 1332 * @crossplatform 1333 * @atomicservice 1334 * @since 12 1335 */ 1336 getDenominator(): number; 1337 1338 /** 1339 * Gets the numerator of the current object. 1340 * 1341 * @returns { number } Returns the numerator of the current object. 1342 * @syscap SystemCapability.Utils.Lang 1343 * @since 8 1344 */ 1345 /** 1346 * Gets the numerator of the current object. 1347 * 1348 * @returns { number } Returns the numerator of the current object. 1349 * @syscap SystemCapability.Utils.Lang 1350 * @crossplatform 1351 * @since 10 1352 */ 1353 /** 1354 * Obtains the numerator of this RationalNumber object. 1355 * 1356 * @returns { number } Returns the numerator of the current object. 1357 * @syscap SystemCapability.Utils.Lang 1358 * @crossplatform 1359 * @atomicservice 1360 * @since 12 1361 */ 1362 getNumerator(): number; 1363 1364 /** 1365 * Checks whether the current RationalNumber object represents an infinite value. 1366 * 1367 * @returns { boolean } If the denominator is not 0, true is returned. Otherwise, false is returned. 1368 * @syscap SystemCapability.Utils.Lang 1369 * @since 8 1370 */ 1371 /** 1372 * Checks whether the current RationalNumber object represents an infinite value. 1373 * 1374 * @returns { boolean } If the denominator is not 0, true is returned. Otherwise, false is returned. 1375 * @syscap SystemCapability.Utils.Lang 1376 * @crossplatform 1377 * @since 10 1378 */ 1379 /** 1380 * Checks whether this RationalNumber object represents a finite value. 1381 * 1382 * @returns { boolean } If the denominator is not 0, true is returned. Otherwise, false is returned. 1383 * @syscap SystemCapability.Utils.Lang 1384 * @crossplatform 1385 * @atomicservice 1386 * @since 12 1387 */ 1388 isFinite(): boolean; 1389 1390 /** 1391 * Checks whether the current RationalNumber object represents a Not-a-Number (NaN) value. 1392 * 1393 * @returns { boolean } If both the denominator and numerator are 0, true is returned. Otherwise, false is returned. 1394 * @syscap SystemCapability.Utils.Lang 1395 * @since 8 1396 */ 1397 /** 1398 * Checks whether the current RationalNumber object represents a Not-a-Number (NaN) value. 1399 * 1400 * @returns { boolean } If both the denominator and numerator are 0, true is returned. Otherwise, false is returned. 1401 * @syscap SystemCapability.Utils.Lang 1402 * @crossplatform 1403 * @since 10 1404 */ 1405 /** 1406 * Checks whether this RationalNumber object is a Not a Number (NaN). 1407 * @returns { boolean } If both the denominator and numerator are 0, true is returned. Otherwise, false is returned. 1408 * @syscap SystemCapability.Utils.Lang 1409 * @crossplatform 1410 * @atomicservice 1411 * @since 12 1412 */ 1413 isNaN(): boolean; 1414 1415 /** 1416 * Checks whether the current RationalNumber object represents the value 0. 1417 * 1418 * @returns { boolean } If the value represented by the current object is 0, true is returned. Otherwise, false is returned. 1419 * @syscap SystemCapability.Utils.Lang 1420 * @since 8 1421 */ 1422 /** 1423 * Checks whether the current RationalNumber object represents the value 0. 1424 * 1425 * @returns { boolean } If the value represented by the current object is 0, true is returned. Otherwise, false is returned. 1426 * @syscap SystemCapability.Utils.Lang 1427 * @crossplatform 1428 * @since 10 1429 */ 1430 /** 1431 * Checks whether this RationalNumber object is 0. 1432 * 1433 * @returns { boolean } If the value represented by the current object is 0, true is returned. Otherwise, false is returned. 1434 * @syscap SystemCapability.Utils.Lang 1435 * @crossplatform 1436 * @atomicservice 1437 * @since 12 1438 */ 1439 isZero(): boolean; 1440 1441 /** 1442 * Obtains a string representation of the current RationalNumber object. 1443 * 1444 * @returns { string } Returns a string representation of the current RationalNumber object. 1445 * @syscap SystemCapability.Utils.Lang 1446 * @since 8 1447 */ 1448 /** 1449 * Obtains a string representation of the current RationalNumber object. 1450 * 1451 * @returns { string } Returns a string representation of the current RationalNumber object. 1452 * @syscap SystemCapability.Utils.Lang 1453 * @crossplatform 1454 * @since 10 1455 */ 1456 /** 1457 * Obtains the string representation of this RationalNumber object. 1458 * 1459 * @returns { string } Returns a string representation of the current RationalNumber object. 1460 * @syscap SystemCapability.Utils.Lang 1461 * @crossplatform 1462 * @atomicservice 1463 * @since 12 1464 */ 1465 toString(): string; 1466 } 1467 1468 /** 1469 * The LruBuffer algorithm replaces the least used data with new data when the buffer space is insufficient. 1470 * 1471 * @syscap SystemCapability.Utils.Lang 1472 * @since 8 1473 * @deprecated since 9 1474 * @useinstead ohos.util.LRUCache 1475 */ 1476 class LruBuffer<K, V> { 1477 /** 1478 * Default constructor used to create a new LruBuffer instance with the default capacity of 64. 1479 * 1480 * @param { number } capacity - Indicates the capacity to customize for the buffer. 1481 * @syscap SystemCapability.Utils.Lang 1482 * @since 8 1483 * @deprecated since 9 1484 * @useinstead ohos.util.LRUCache.constructor 1485 */ 1486 constructor(capacity?: number); 1487 1488 /** 1489 * Updates the buffer capacity to a specified capacity. 1490 * 1491 * @param { number } newCapacity - Indicates the new capacity to set. 1492 * @syscap SystemCapability.Utils.Lang 1493 * @since 8 1494 * @deprecated since 9 1495 * @useinstead ohos.util.LRUCache.updateCapacity 1496 */ 1497 updateCapacity(newCapacity: number): void; 1498 1499 /** 1500 * Returns a string representation of the object. 1501 * 1502 * @returns { string } Returns the string representation of the object and outputs the string representation of the object. 1503 * @syscap SystemCapability.Utils.Lang 1504 * @since 8 1505 * @deprecated since 9 1506 * @useinstead ohos.util.LRUCache.toString 1507 */ 1508 toString(): string; 1509 1510 /** 1511 * Obtains a list of all values in the current buffer. 1512 * 1513 * @type { number } 1514 * @syscap SystemCapability.Utils.Lang 1515 * @since 8 1516 * @deprecated since 9 1517 * @useinstead ohos.util.LRUCache.length 1518 */ 1519 length: number; 1520 1521 /** 1522 * Obtains the capacity of the current buffer. 1523 * 1524 * @returns { number } Returns the capacity of the current buffer. 1525 * @syscap SystemCapability.Utils.Lang 1526 * @since 8 1527 * @deprecated since 9 1528 * @useinstead ohos.util.LRUCache.getCapacity 1529 */ 1530 getCapacity(): number; 1531 1532 /** 1533 * Clears key-value pairs from the current buffer. 1534 * 1535 * @syscap SystemCapability.Utils.Lang 1536 * @since 8 1537 * @deprecated since 9 1538 * @useinstead ohos.util.LRUCache.clear 1539 */ 1540 clear(): void; 1541 1542 /** 1543 * Obtains the number of times createDefault(Object) returned a value. 1544 * 1545 * @returns { number } Returns the number of times createDefault(java.lang.Object) returned a value. 1546 * @syscap SystemCapability.Utils.Lang 1547 * @since 8 1548 * @deprecated since 9 1549 * @useinstead ohos.util.LRUCache.getCreateCount 1550 */ 1551 getCreateCount(): number; 1552 1553 /** 1554 * Obtains the number of times that the queried values are not matched. 1555 * 1556 * @returns { number } Returns the number of times that the queried values are not matched. 1557 * @syscap SystemCapability.Utils.Lang 1558 * @since 8 1559 * @deprecated since 9 1560 * @useinstead ohos.util.LRUCache.getMissCount 1561 */ 1562 getMissCount(): number; 1563 1564 /** 1565 * Obtains the number of times that values are evicted from the buffer. 1566 * 1567 * @returns { number } Returns the number of times that values are evicted from the buffer. 1568 * @syscap SystemCapability.Utils.Lang 1569 * @since 8 1570 * @deprecated since 9 1571 * @useinstead ohos.util.LRUCache.getRemovalCount 1572 */ 1573 getRemovalCount(): number; 1574 1575 /** 1576 * Obtains the number of times that the queried values are successfully matched. 1577 * 1578 * @returns { number } Returns the number of times that the queried values are successfully matched. 1579 * @syscap SystemCapability.Utils.Lang 1580 * @since 8 1581 * @deprecated since 9 1582 * @useinstead ohos.util.LRUCache.getMatchCount 1583 */ 1584 getMatchCount(): number; 1585 1586 /** 1587 * Obtains the number of times that values are added to the buffer. 1588 * 1589 * @returns { number } Returns the number of times that values are added to the buffer. 1590 * @syscap SystemCapability.Utils.Lang 1591 * @since 8 1592 * @deprecated since 9 1593 * @useinstead ohos.util.LRUCache.getPutCount 1594 */ 1595 getPutCount(): number; 1596 1597 /** 1598 * Checks whether the current buffer is empty. 1599 * 1600 * @returns { boolean } Returns true if the current buffer contains no value. 1601 * @syscap SystemCapability.Utils.Lang 1602 * @since 8 1603 * @deprecated since 9 1604 * @useinstead ohos.util.LRUCache.isEmpty 1605 */ 1606 isEmpty(): boolean; 1607 1608 /** 1609 * Obtains the value associated with a specified key. 1610 * 1611 * @param { K } key - Indicates the key to query. 1612 * @returns { V | undefined } Returns the value associated with the key if the specified key is present in the buffer; returns null otherwise. 1613 * @syscap SystemCapability.Utils.Lang 1614 * @since 8 1615 * @deprecated since 9 1616 * @useinstead ohos.util.LRUCache.get 1617 */ 1618 get(key: K): V | undefined; 1619 1620 /** 1621 * Adds a key-value pair to the buffer. 1622 * 1623 * @param { K } key - Indicates the key to add. 1624 * @param { V } value - Indicates the value associated with the key to add. 1625 * @returns { V } Returns the value associated with the added key; returns the original value if the key to add already exists. 1626 * @syscap SystemCapability.Utils.Lang 1627 * @since 8 1628 * @deprecated since 9 1629 * @useinstead ohos.util.LRUCache.put 1630 */ 1631 put(key: K, value: V): V; 1632 1633 /** 1634 * Obtains a list of all values in the current buffer. 1635 * 1636 * @returns { V[] } Returns the list of all values in the current buffer in ascending order, from the most recently accessed to least recently accessed. 1637 * @syscap SystemCapability.Utils.Lang 1638 * @since 8 1639 * @deprecated since 9 1640 * @useinstead ohos.util.LRUCache.values 1641 */ 1642 values(): V[]; 1643 1644 /** 1645 * Obtains a list of keys for the values in the current buffer. 1646 * 1647 * @returns { K[] } Returns a list of keys sorted from most recently accessed to least recently accessed. 1648 * @syscap SystemCapability.Utils.Lang 1649 * @since 8 1650 * @deprecated since 9 1651 * @useinstead ohos.util.LRUCache.keys 1652 */ 1653 keys(): K[]; 1654 1655 /** 1656 * Deletes a specified key and its associated value from the current buffer. 1657 * 1658 * @param { K } key - Indicates the key to delete. 1659 * @returns { V | undefined } Returns an Optional object containing the deleted key-value pair; returns an empty Optional object if the key does not exist. 1660 * @syscap SystemCapability.Utils.Lang 1661 * @since 8 1662 * @deprecated since 9 1663 * @useinstead ohos.util.LRUCache.remove 1664 */ 1665 remove(key: K): V | undefined; 1666 1667 /** 1668 * Executes subsequent operations after a value is deleted. 1669 * 1670 * @param { boolean } isEvict - The parameter value is true if this method is called due to insufficient capacity, 1671 * and the parameter value is false in other cases. 1672 * @param { K } key - Indicates the deleted key. 1673 * @param { V } value - Indicates the deleted value. 1674 * @param { V } newValue - The parameter value is the new value associated if the put(java.lang.Object,java.lang.Object) 1675 * method is called and the key to add already exists. The parameter value is null in other cases. 1676 * @syscap SystemCapability.Utils.Lang 1677 * @since 8 1678 * @deprecated since 9 1679 * @useinstead ohos.util.LRUCache.afterRemoval 1680 */ 1681 afterRemoval(isEvict: boolean, key: K, value: V, newValue: V): void; 1682 1683 /** 1684 * Checks whether the current buffer contains a specified key. 1685 * 1686 * @param { K } key - Indicates the key to check. 1687 * @returns { boolean } Returns true if the buffer contains the specified key. 1688 * @syscap SystemCapability.Utils.Lang 1689 * @since 8 1690 * @deprecated since 9 1691 * @useinstead ohos.util.LRUCache.contains 1692 */ 1693 contains(key: K): boolean; 1694 1695 /** 1696 * Called after a cache miss to compute a value for the corresponding key. 1697 * 1698 * @param { K } key - Indicates the missed key. 1699 * @returns { V } Returns the value associated with the key. 1700 * @syscap SystemCapability.Utils.Lang 1701 * @since 8 1702 * @deprecated since 9 1703 * @useinstead ohos.util.LRUCache.createDefault 1704 */ 1705 createDefault(key: K): V; 1706 1707 /** 1708 * Returns an array of key-value pairs of enumeratable properties of a given object. 1709 * 1710 * @returns { IterableIterator<[K, V]> } Returns an array of key-value pairs for the enumeratable properties of the given object itself. 1711 * @syscap SystemCapability.Utils.Lang 1712 * @since 8 1713 * @deprecated since 9 1714 * @useinstead ohos.util.LRUCache.entries 1715 */ 1716 entries(): IterableIterator<[K, V]>; 1717 1718 /** 1719 * Specifies the default iterator for an object. 1720 * @returns { IterableIterator<[K, V]> } Returns a two - dimensional array in the form of key - value pairs. 1721 * @syscap SystemCapability.Utils.Lang 1722 * @since 8 1723 * @deprecated since 9 1724 * @useinstead ohos.util.LRUCache.[Symbol.iterator] 1725 */ 1726 [Symbol.iterator](): IterableIterator<[K, V]>; 1727 } 1728 1729 /** 1730 * The LRUCache algorithm replaces the least used data with new data when the buffer space is insufficient. 1731 * 1732 * @syscap SystemCapability.Utils.Lang 1733 * @since 9 1734 */ 1735 /** 1736 * The LRUCache algorithm replaces the least used data with new data when the buffer space is insufficient. 1737 * 1738 * @syscap SystemCapability.Utils.Lang 1739 * @crossplatform 1740 * @since 10 1741 */ 1742 /** 1743 * Provides APIs to discard the least recently used data to make rooms for new elements when the cache is full. 1744 * This class uses the Least Recently Used (LRU) algorithm, which believes that the recently used data may be accessed 1745 * again in the near future and the least accessed data is the least valuable data and should be removed from the cache. 1746 * 1747 * @syscap SystemCapability.Utils.Lang 1748 * @crossplatform 1749 * @atomicservice 1750 * @since 12 1751 */ 1752 class LRUCache<K, V> { 1753 /** 1754 * Default constructor used to create a new LruBuffer instance with the default capacity of 64. 1755 * 1756 * @param { number } [capacity] - Indicates the capacity to customize for the buffer. 1757 * @syscap SystemCapability.Utils.Lang 1758 * @since 9 1759 */ 1760 /** 1761 * Default constructor used to create a new LruBuffer instance with the default capacity of 64. 1762 * 1763 * @param { number } [capacity] - Indicates the capacity to customize for the buffer. 1764 * @syscap SystemCapability.Utils.Lang 1765 * @crossplatform 1766 * @since 10 1767 */ 1768 /** 1769 * A constructor used to create a LRUCache instance. The default capacity of the cache is 64. 1770 * 1771 * @param { number } [capacity] - Capacity of the cache to create. The default value is 64. 1772 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1773 * @syscap SystemCapability.Utils.Lang 1774 * @crossplatform 1775 * @atomicservice 1776 * @since 12 1777 */ 1778 constructor(capacity?: number); 1779 1780 /** 1781 * Updates the buffer capacity to a specified capacity. 1782 * 1783 * @param { number } newCapacity - Indicates the new capacity to set. 1784 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 1785 * @syscap SystemCapability.Utils.Lang 1786 * @since 9 1787 */ 1788 /** 1789 * Updates the buffer capacity to a specified capacity. 1790 * 1791 * @param { number } newCapacity - Indicates the new capacity to set. 1792 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 1793 * @syscap SystemCapability.Utils.Lang 1794 * @crossplatform 1795 * @since 10 1796 */ 1797 /** 1798 * Changes the cache capacity. 1799 * 1800 * @param { number } newCapacity - New capacity of the cache. 1801 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 1802 * @syscap SystemCapability.Utils.Lang 1803 * @crossplatform 1804 * @atomicservice 1805 * @since 12 1806 */ 1807 updateCapacity(newCapacity: number): void; 1808 1809 /** 1810 * Returns a string representation of the object. 1811 * 1812 * @returns { string } Returns the string representation of the object and outputs the string representation of the object. 1813 * @syscap SystemCapability.Utils.Lang 1814 * @since 9 1815 */ 1816 /** 1817 * Returns a string representation of the object. 1818 * 1819 * @returns { string } Returns the string representation of the object and outputs the string representation of the object. 1820 * @syscap SystemCapability.Utils.Lang 1821 * @crossplatform 1822 * @since 10 1823 */ 1824 /** 1825 * Obtains the string representation of this cache. 1826 * 1827 * @returns { string } Returns the string representation of the object and outputs the string representation of the object. 1828 * @syscap SystemCapability.Utils.Lang 1829 * @crossplatform 1830 * @atomicservice 1831 * @since 12 1832 */ 1833 toString(): string; 1834 1835 /** 1836 * Obtains a list of all values in the current buffer. 1837 * 1838 * @type { number } 1839 * @syscap SystemCapability.Utils.Lang 1840 * @since 9 1841 */ 1842 /** 1843 * Obtains a list of all values in the current buffer. 1844 * 1845 * @type { number } 1846 * @syscap SystemCapability.Utils.Lang 1847 * @crossplatform 1848 * @since 10 1849 */ 1850 /** 1851 * Total number of values in this cache. 1852 * 1853 * @type { number } 1854 * @syscap SystemCapability.Utils.Lang 1855 * @crossplatform 1856 * @atomicservice 1857 * @since 12 1858 */ 1859 length: number; 1860 1861 /** 1862 * Obtains the capacity of the current buffer. 1863 * 1864 * @returns { number } Returns the capacity of the current buffer. 1865 * @syscap SystemCapability.Utils.Lang 1866 * @since 9 1867 */ 1868 /** 1869 * Obtains the capacity of the current buffer. 1870 * 1871 * @returns { number } Returns the capacity of the current buffer. 1872 * @syscap SystemCapability.Utils.Lang 1873 * @crossplatform 1874 * @since 10 1875 */ 1876 /** 1877 * Obtains the capacity of this cache. 1878 * 1879 * @returns { number } Returns the capacity of the current buffer. 1880 * @syscap SystemCapability.Utils.Lang 1881 * @crossplatform 1882 * @atomicservice 1883 * @since 12 1884 */ 1885 getCapacity(): number; 1886 1887 /** 1888 * Clears key-value pairs from the current buffer. 1889 * 1890 * @syscap SystemCapability.Utils.Lang 1891 * @since 9 1892 */ 1893 /** 1894 * Clears key-value pairs from the current buffer. 1895 * 1896 * @syscap SystemCapability.Utils.Lang 1897 * @crossplatform 1898 * @since 10 1899 */ 1900 /** 1901 * Clears key-value pairs from this cache. 1902 * 1903 * @syscap SystemCapability.Utils.Lang 1904 * @crossplatform 1905 * @atomicservice 1906 * @since 12 1907 */ 1908 clear(): void; 1909 1910 /** 1911 * Obtains the number of times createDefault(Object) returned a value. 1912 * 1913 * @returns { number } Returns the number of times createDefault(java.lang.Object) returned a value. 1914 * @syscap SystemCapability.Utils.Lang 1915 * @since 9 1916 */ 1917 /** 1918 * Obtains the number of times createDefault(Object) returned a value. 1919 * 1920 * @returns { number } Returns the number of times createDefault(java.lang.Object) returned a value. 1921 * @syscap SystemCapability.Utils.Lang 1922 * @crossplatform 1923 * @since 10 1924 */ 1925 /** 1926 * Obtains the number of times that an object is created. 1927 * 1928 * @returns { number } Returns the number of times createDefault(java.lang.Object) returned a value. 1929 * @syscap SystemCapability.Utils.Lang 1930 * @crossplatform 1931 * @atomicservice 1932 * @since 12 1933 */ 1934 getCreateCount(): number; 1935 1936 /** 1937 * Obtains the number of times that the queried values are not matched. 1938 * 1939 * @returns { number } Returns the number of times that the queried values are not matched. 1940 * @syscap SystemCapability.Utils.Lang 1941 * @since 9 1942 */ 1943 /** 1944 * Obtains the number of times that the queried values are not matched. 1945 * 1946 * @returns { number } Returns the number of times that the queried values are not matched. 1947 * @syscap SystemCapability.Utils.Lang 1948 * @crossplatform 1949 * @since 10 1950 */ 1951 /** 1952 * Obtains the number of times that the queried values are mismatched. 1953 * 1954 * @returns { number } Returns the number of times that the queried values are not matched. 1955 * @syscap SystemCapability.Utils.Lang 1956 * @crossplatform 1957 * @atomicservice 1958 * @since 12 1959 */ 1960 getMissCount(): number; 1961 1962 /** 1963 * Obtains the number of times that values are evicted from the buffer. 1964 * 1965 * @returns { number } Returns the number of times that values are evicted from the buffer. 1966 * @syscap SystemCapability.Utils.Lang 1967 * @since 9 1968 */ 1969 /** 1970 * Obtains the number of times that values are evicted from the buffer. 1971 * 1972 * @returns { number } Returns the number of times that values are evicted from the buffer. 1973 * @syscap SystemCapability.Utils.Lang 1974 * @crossplatform 1975 * @since 10 1976 */ 1977 /** 1978 * Obtains the number of times that key-value pairs in the cache are recycled. 1979 * 1980 * @returns { number } Returns the number of times that values are evicted from the buffer. 1981 * @syscap SystemCapability.Utils.Lang 1982 * @crossplatform 1983 * @atomicservice 1984 * @since 12 1985 */ 1986 getRemovalCount(): number; 1987 1988 /** 1989 * Obtains the number of times that the queried values are successfully matched. 1990 * 1991 * @returns { number } Returns the number of times that the queried values are successfully matched. 1992 * @syscap SystemCapability.Utils.Lang 1993 * @since 9 1994 */ 1995 /** 1996 * Obtains the number of times that the queried values are successfully matched. 1997 * 1998 * @returns { number } Returns the number of times that the queried values are successfully matched. 1999 * @syscap SystemCapability.Utils.Lang 2000 * @crossplatform 2001 * @since 10 2002 */ 2003 /** 2004 * Obtains the number of times that the queried values are matched. 2005 * 2006 * @returns { number } Returns the number of times that the queried values are successfully matched. 2007 * @syscap SystemCapability.Utils.Lang 2008 * @crossplatform 2009 * @atomicservice 2010 * @since 12 2011 */ 2012 getMatchCount(): number; 2013 2014 /** 2015 * Obtains the number of times that values are added to the buffer. 2016 * 2017 * @returns { number } Returns the number of times that values are added to the buffer. 2018 * @syscap SystemCapability.Utils.Lang 2019 * @since 9 2020 */ 2021 /** 2022 * Obtains the number of times that values are added to the buffer. 2023 * 2024 * @returns { number } Returns the number of times that values are added to the buffer. 2025 * @syscap SystemCapability.Utils.Lang 2026 * @crossplatform 2027 * @since 10 2028 */ 2029 /** 2030 * Obtains the number of additions to this cache. 2031 * 2032 * @returns { number } Returns the number of times that values are added to the buffer. 2033 * @syscap SystemCapability.Utils.Lang 2034 * @crossplatform 2035 * @atomicservice 2036 * @since 12 2037 */ 2038 getPutCount(): number; 2039 2040 /** 2041 * Checks whether the current buffer is empty. 2042 * 2043 * @returns { boolean } Returns true if the current buffer contains no value. 2044 * @syscap SystemCapability.Utils.Lang 2045 * @since 9 2046 */ 2047 /** 2048 * Checks whether the current buffer is empty. 2049 * 2050 * @returns { boolean } Returns true if the current buffer contains no value. 2051 * @syscap SystemCapability.Utils.Lang 2052 * @crossplatform 2053 * @since 10 2054 */ 2055 /** 2056 * Checks whether this cache is empty. 2057 * 2058 * @returns { boolean } Returns true if the current buffer contains no value. 2059 * @syscap SystemCapability.Utils.Lang 2060 * @crossplatform 2061 * @atomicservice 2062 * @since 12 2063 */ 2064 isEmpty(): boolean; 2065 2066 /** 2067 * Obtains the value associated with a specified key. 2068 * 2069 * @param { K } key - Indicates the key to query. 2070 * @returns { V | undefined } Returns the value associated with the key if the specified key is present in the buffer; returns null otherwise. 2071 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2072 * 1.Mandatory parameters are left unspecified; 2073 * 2.Incorrect parameter types. 2074 * @syscap SystemCapability.Utils.Lang 2075 * @since 9 2076 */ 2077 /** 2078 * Obtains the value associated with a specified key. 2079 * 2080 * @param { K } key - Indicates the key to query. 2081 * @returns { V | undefined } Returns the value associated with the key if the specified key is present in the buffer; returns null otherwise. 2082 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2083 * 1.Mandatory parameters are left unspecified; 2084 * 2.Incorrect parameter types. 2085 * @syscap SystemCapability.Utils.Lang 2086 * @crossplatform 2087 * @since 10 2088 */ 2089 /** 2090 * Obtains the value of a key. If the key is not in the cache, createDefault is called to create the key. 2091 * If the value specified in createDefault is not undefined, afterRemoval is called to return the value specified in createDefault. 2092 * 2093 * @param { K } key - Indicates the key to query. 2094 * @returns { V | undefined } Returns the value associated with the key if the specified key is present in the buffer; returns null otherwise. 2095 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2096 * 1.Mandatory parameters are left unspecified; 2097 * 2.Incorrect parameter types. 2098 * @syscap SystemCapability.Utils.Lang 2099 * @crossplatform 2100 * @atomicservice 2101 * @since 12 2102 */ 2103 get(key: K): V | undefined; 2104 2105 /** 2106 * Adds a key-value pair to the buffer. 2107 * 2108 * @param { K } key - Indicates the key to add. 2109 * @param { V } value - Indicates the value associated with the key to add. 2110 * @returns { V } Returns the value associated with the added key; returns the original value if the key to add already exists. 2111 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2112 * 1.Mandatory parameters are left unspecified; 2113 * 2.Incorrect parameter types. 2114 * @syscap SystemCapability.Utils.Lang 2115 * @since 9 2116 */ 2117 /** 2118 * Adds a key-value pair to the buffer. 2119 * 2120 * @param { K } key - Indicates the key to add. 2121 * @param { V } value - Indicates the value associated with the key to add. 2122 * @returns { V } Returns the value associated with the added key; returns the original value if the key to add already exists. 2123 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2124 * 1.Mandatory parameters are left unspecified; 2125 * 2.Incorrect parameter types. 2126 * @syscap SystemCapability.Utils.Lang 2127 * @crossplatform 2128 * @since 10 2129 */ 2130 /** 2131 * Adds a key-value pair to this cache and returns the value associated with the key. 2132 * If the total number of values in the cache is greater than the specified capacity, the deletion operation is performed. 2133 * 2134 * @param { K } key - Indicates the key to add. 2135 * @param { V } value - Indicates the value associated with the key to add. 2136 * @returns { V } Returns the value associated with the added key; returns the original value if the key to add already exists. 2137 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2138 * 1.Mandatory parameters are left unspecified; 2139 * 2.Incorrect parameter types. 2140 * @syscap SystemCapability.Utils.Lang 2141 * @crossplatform 2142 * @atomicservice 2143 * @since 12 2144 */ 2145 put(key: K, value: V): V; 2146 2147 /** 2148 * Obtains a list of all values in the current buffer. 2149 * 2150 * @returns { V[] } Returns the list of all values in the current buffer in ascending order, from the most recently accessed to least recently accessed. 2151 * @syscap SystemCapability.Utils.Lang 2152 * @since 9 2153 */ 2154 /** 2155 * Obtains a list of all values in the current buffer. 2156 * 2157 * @returns { V[] } Returns the list of all values in the current buffer in ascending order, from the most recently accessed to least recently accessed. 2158 * @syscap SystemCapability.Utils.Lang 2159 * @crossplatform 2160 * @since 10 2161 */ 2162 /** 2163 * Obtains all values in this cache, listed from the most to the least recently accessed. 2164 * 2165 * @returns { V[] } Returns the list of all values in the current buffer in ascending order, from the most recently accessed to least recently accessed. 2166 * @syscap SystemCapability.Utils.Lang 2167 * @crossplatform 2168 * @atomicservice 2169 * @since 12 2170 */ 2171 values(): V[]; 2172 2173 /** 2174 * Obtains a list of keys for the values in the current buffer. 2175 * since 9 2176 * 2177 * @returns { K[] } Returns a list of keys sorted from most recently accessed to least recently accessed. 2178 * @syscap SystemCapability.Utils.Lang 2179 * @since 9 2180 */ 2181 /** 2182 * Obtains a list of keys for the values in the current buffer. 2183 * since 9 2184 * 2185 * @returns { K[] } Returns a list of keys sorted from most recently accessed to least recently accessed. 2186 * @syscap SystemCapability.Utils.Lang 2187 * @crossplatform 2188 * @since 10 2189 */ 2190 /** 2191 * Obtains all keys in this cache, listed from the most to the least recently accessed. 2192 * since 9 2193 * 2194 * @returns { K[] } Returns a list of keys sorted from most recently accessed to least recently accessed. 2195 * @syscap SystemCapability.Utils.Lang 2196 * @crossplatform 2197 * @atomicservice 2198 * @since 12 2199 */ 2200 keys(): K[]; 2201 2202 /** 2203 * Deletes a specified key and its associated value from the current buffer. 2204 * 2205 * @param { K } key - Indicates the key to delete. 2206 * @returns { V | undefined } Returns an Optional object containing the deleted key-value pair; returns an empty Optional object if the key does not exist. 2207 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2208 * 1.Mandatory parameters are left unspecified; 2209 * 2.Incorrect parameter types. 2210 * @syscap SystemCapability.Utils.Lang 2211 * @since 9 2212 */ 2213 /** 2214 * Deletes a specified key and its associated value from the current buffer. 2215 * 2216 * @param { K } key - Indicates the key to delete. 2217 * @returns { V | undefined } Returns an Optional object containing the deleted key-value pair; returns an empty Optional object if the key does not exist. 2218 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2219 * 1.Mandatory parameters are left unspecified; 2220 * 2.Incorrect parameter types. 2221 * @syscap SystemCapability.Utils.Lang 2222 * @crossplatform 2223 * @since 10 2224 */ 2225 /** 2226 * Removes a key and its associated value from this cache and returns the value associated with the key. If the key does not exist, undefined is returned. 2227 * 2228 * @param { K } key - Key to remove. 2229 * @returns { V | undefined } Returns an Optional object containing the deleted key-value pair; returns an empty Optional object if the key does not exist. 2230 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2231 * 1.Mandatory parameters are left unspecified; 2232 * 2.Incorrect parameter types. 2233 * @syscap SystemCapability.Utils.Lang 2234 * @crossplatform 2235 * @atomicservice 2236 * @since 12 2237 */ 2238 remove(key: K): V | undefined; 2239 2240 /** 2241 * Executes subsequent operations after a value is deleted. 2242 * 2243 * @param { boolean } isEvict - The parameter value is true if this method is called due to insufficient capacity, 2244 * and the parameter value is false in other cases. 2245 * @param { K } key - Indicates the deleted key. 2246 * @param { V } value - Indicates the deleted value. 2247 * @param { V } newValue - The parameter value is the new value associated if the put(java.lang.Object,java.lang.Object) 2248 * method is called and the key to add already exists. The parameter value is null in other cases. 2249 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2250 * 1.Mandatory parameters are left unspecified; 2251 * 2.Incorrect parameter types. 2252 * @syscap SystemCapability.Utils.Lang 2253 * @since 9 2254 */ 2255 /** 2256 * Executes subsequent operations after a value is deleted. 2257 * 2258 * @param { boolean } isEvict - The parameter value is true if this method is called due to insufficient capacity, 2259 * and the parameter value is false in other cases. 2260 * @param { K } key - Indicates the deleted key. 2261 * @param { V } value - Indicates the deleted value. 2262 * @param { V } newValue - The parameter value is the new value associated if the put(java.lang.Object,java.lang.Object) 2263 * method is called and the key to add already exists. The parameter value is null in other cases. 2264 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2265 * 1.Mandatory parameters are left unspecified; 2266 * 2.Incorrect parameter types. 2267 * @syscap SystemCapability.Utils.Lang 2268 * @crossplatform 2269 * @since 10 2270 */ 2271 /** 2272 * Performs subsequent operations after a value is removed. 2273 * 2274 * @param { boolean } isEvict - The parameter value is true if this method is called due to insufficient capacity, 2275 * and the parameter value is false in other cases. 2276 * @param { K } key - Indicates the deleted key. 2277 * @param { V } value - Indicates the deleted value. 2278 * @param { V } newValue - The parameter value is the new value associated if the put(java.lang.Object,java.lang.Object) 2279 * method is called and the key to add already exists. The parameter value is null in other cases. 2280 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2281 * 1.Mandatory parameters are left unspecified; 2282 * 2.Incorrect parameter types. 2283 * @syscap SystemCapability.Utils.Lang 2284 * @crossplatform 2285 * @atomicservice 2286 * @since 12 2287 */ 2288 afterRemoval(isEvict: boolean, key: K, value: V, newValue: V): void; 2289 2290 /** 2291 * Checks whether the current buffer contains a specified key. 2292 * 2293 * @param { K } key - Indicates the key to check. 2294 * @returns { boolean } Returns true if the buffer contains the specified key. 2295 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2296 * 1.Mandatory parameters are left unspecified; 2297 * 2.Incorrect parameter types. 2298 * @syscap SystemCapability.Utils.Lang 2299 * @since 9 2300 */ 2301 /** 2302 * Checks whether the current buffer contains a specified key. 2303 * 2304 * @param { K } key - Indicates the key to check. 2305 * @returns { boolean } Returns true if the buffer contains the specified key. 2306 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2307 * 1.Mandatory parameters are left unspecified; 2308 * 2.Incorrect parameter types. 2309 * @syscap SystemCapability.Utils.Lang 2310 * @crossplatform 2311 * @since 10 2312 */ 2313 /** 2314 * Checks whether this cache contains the specified key. 2315 * 2316 * @param { K } key - Indicates the key to check. 2317 * @returns { boolean } Returns true if the buffer contains the specified key. 2318 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2319 * 1.Mandatory parameters are left unspecified; 2320 * 2.Incorrect parameter types. 2321 * @syscap SystemCapability.Utils.Lang 2322 * @crossplatform 2323 * @atomicservice 2324 * @since 12 2325 */ 2326 contains(key: K): boolean; 2327 2328 /** 2329 * Executes subsequent operations if miss to compute a value for the specific key. 2330 * 2331 * @param { K } key - Indicates the missed key. 2332 * @returns { V } Returns the value associated with the key. 2333 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2334 * 1.Mandatory parameters are left unspecified; 2335 * 2.Incorrect parameter types. 2336 * @syscap SystemCapability.Utils.Lang 2337 * @since 9 2338 */ 2339 /** 2340 * Executes subsequent operations if miss to compute a value for the specific key. 2341 * 2342 * @param { K } key - Indicates the missed key. 2343 * @returns { V } Returns the value associated with the key. 2344 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2345 * 1.Mandatory parameters are left unspecified; 2346 * 2.Incorrect parameter types. 2347 * @syscap SystemCapability.Utils.Lang 2348 * @crossplatform 2349 * @since 10 2350 */ 2351 /** 2352 * Performs subsequent operations if no key is matched in the cache and returns the value (undefined by default) associated with the key. 2353 * 2354 * @param { K } key - Indicates the missed key. 2355 * @returns { V } Returns the value associated with the key. 2356 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2357 * 1.Mandatory parameters are left unspecified; 2358 * 2.Incorrect parameter types. 2359 * @syscap SystemCapability.Utils.Lang 2360 * @crossplatform 2361 * @atomicservice 2362 * @since 12 2363 */ 2364 createDefault(key: K): V; 2365 2366 /** 2367 * Returns an array of key-value pairs of enumeratable properties of a given object. 2368 * 2369 * @returns { IterableIterator<[K, V]> } Returns an array of key-value pairs for the enumeratable properties of the given object itself. 2370 * @syscap SystemCapability.Utils.Lang 2371 * @since 9 2372 */ 2373 /** 2374 * Returns an array of key-value pairs of enumeratable properties of a given object. 2375 * 2376 * @returns { IterableIterator<[K, V]> } Returns an array of key-value pairs for the enumeratable properties of the given object itself. 2377 * @syscap SystemCapability.Utils.Lang 2378 * @crossplatform 2379 * @since 10 2380 */ 2381 /** 2382 * Obtains a new iterator object that contains all key-value pairs in this object. 2383 * 2384 * @returns { IterableIterator<[K, V]> } Returns an array of key-value pairs for the enumeratable properties of the given object itself. 2385 * @syscap SystemCapability.Utils.Lang 2386 * @crossplatform 2387 * @atomicservice 2388 * @since 12 2389 */ 2390 entries(): IterableIterator<[K, V]>; 2391 2392 /** 2393 * Specifies the default iterator for an object. 2394 * 2395 * @returns { IterableIterator<[K, V]> } Returns a two - dimensional array in the form of key - value pairs. 2396 * @syscap SystemCapability.Utils.Lang 2397 * @since 9 2398 */ 2399 /** 2400 * Specifies the default iterator for an object. 2401 * 2402 * @returns { IterableIterator<[K, V]> } Returns a two - dimensional array in the form of key - value pairs. 2403 * @syscap SystemCapability.Utils.Lang 2404 * @crossplatform 2405 * @since 10 2406 */ 2407 /** 2408 * Obtains a two-dimensional array in key-value pairs. 2409 * 2410 * @returns { IterableIterator<[K, V]> } Returns a two - dimensional array in the form of key - value pairs. 2411 * @syscap SystemCapability.Utils.Lang 2412 * @crossplatform 2413 * @atomicservice 2414 * @since 12 2415 */ 2416 [Symbol.iterator](): IterableIterator<[K, V]>; 2417 } 2418 2419 /** 2420 * The ScopeComparable contains comparison methods. 2421 * 2422 * @interface ScopeComparable 2423 * @syscap SystemCapability.Utils.Lang 2424 * @since 7 2425 */ 2426 /** 2427 * The ScopeComparable contains comparison methods. 2428 * 2429 * @interface ScopeComparable 2430 * @syscap SystemCapability.Utils.Lang 2431 * @crossplatform 2432 * @since 10 2433 */ 2434 /** 2435 * The values of the ScopeComparable type are used to implement the compareTo method. Therefore, 2436 * ensure that the input parameters are comparable. 2437 * 2438 * @interface ScopeComparable 2439 * @syscap SystemCapability.Utils.Lang 2440 * @crossplatform 2441 * @atomicservice 2442 * @since 12 2443 */ 2444 interface ScopeComparable { 2445 /** 2446 * The comparison function is used by the scope. 2447 * 2448 * @param { ScopeComparable } other - Other 2449 * @returns { boolean } Returns whether the current object is greater than or equal to the input object. 2450 * @syscap SystemCapability.Utils.Lang 2451 * @since 8 2452 */ 2453 /** 2454 * The comparison function is used by the scope. 2455 * 2456 * @param { ScopeComparable } other - Other 2457 * @returns { boolean } Returns whether the current object is greater than or equal to the input object. 2458 * @syscap SystemCapability.Utils.Lang 2459 * @crossplatform 2460 * @since 10 2461 */ 2462 /** 2463 * Compares two values and returns a Boolean value. 2464 * 2465 * @param { ScopeComparable } other - The other value to be compared with the current value. 2466 * @returns { boolean } Returns whether the current object is greater than or equal to the input object. 2467 * @syscap SystemCapability.Utils.Lang 2468 * @crossplatform 2469 * @atomicservice 2470 * @since 12 2471 */ 2472 compareTo(other: ScopeComparable): boolean; 2473 } 2474 2475 /** 2476 * A type used to denote ScopeComparable or number. 2477 * 2478 * @syscap SystemCapability.Utils.Lang 2479 * @since 8 2480 */ 2481 /** 2482 * A type used to denote ScopeComparable or number. 2483 * 2484 * @syscap SystemCapability.Utils.Lang 2485 * @crossplatform 2486 * @since 10 2487 */ 2488 /** 2489 * Defines the type of values in a Scope object. 2490 * 2491 * @typedef { ScopeComparable | number } 2492 * @syscap SystemCapability.Utils.Lang 2493 * @crossplatform 2494 * @atomicservice 2495 * @since 12 2496 */ 2497 type ScopeType = ScopeComparable | number; 2498 2499 /** 2500 * The Scope interface is used to describe the valid range of a field. 2501 * 2502 * @syscap SystemCapability.Utils.Lang 2503 * @since 8 2504 * @deprecated since 9 2505 * @useinstead ohos.util.ScopeHelper 2506 */ 2507 class Scope { 2508 /** 2509 * A constructor used to create a Scope instance with the lower and upper bounds specified. 2510 * 2511 * @param { ScopeType } lowerObj - A ScopeType value 2512 * @param { ScopeType } upperObj - A ScopeType value 2513 * @syscap SystemCapability.Utils.Lang 2514 * @since 8 2515 * @deprecated since 9 2516 * @useinstead ohos.util.ScopeHelper.constructor 2517 */ 2518 constructor(lowerObj: ScopeType, upperObj: ScopeType); 2519 2520 /** 2521 * Obtains a string representation of the current range. 2522 * 2523 * @returns { string } Returns a string representation of the current range object. 2524 * @syscap SystemCapability.Utils.Lang 2525 * @since 8 2526 * @deprecated since 9 2527 * @useinstead ohos.util.ScopeHelper.toString 2528 */ 2529 toString(): string; 2530 2531 /** 2532 * Returns the intersection of a given range and the current range. 2533 * 2534 * @param { Scope } range - A Scope range object 2535 * @returns { Scope } Returns the intersection of a given range and the current range. 2536 * @syscap SystemCapability.Utils.Lang 2537 * @since 8 2538 * @deprecated since 9 2539 * @useinstead ohos.util.ScopeHelper.intersect 2540 */ 2541 intersect(range: Scope): Scope; 2542 2543 /** 2544 * Returns the intersection of the current range and the range specified by the given lower and upper bounds. 2545 * 2546 * @param { ScopeType } lowerObj - A ScopeType value 2547 * @param { ScopeType } upperObj - A ScopeType value 2548 * @returns { Scope } Returns the intersection of the current range and the range specified by the given lower and upper bounds. 2549 * @syscap SystemCapability.Utils.Lang 2550 * @since 8 2551 * @deprecated since 9 2552 * @useinstead ohos.util.ScopeHelper.intersect 2553 */ 2554 intersect(lowerObj: ScopeType, upperObj: ScopeType): Scope; 2555 2556 /** 2557 * Obtains the upper bound of the current range. 2558 * 2559 * @returns { ScopeType } Returns the upper bound of the current range. 2560 * @syscap SystemCapability.Utils.Lang 2561 * @since 8 2562 * @deprecated since 9 2563 * @useinstead ohos.util.ScopeHelper.getUpper 2564 */ 2565 getUpper(): ScopeType; 2566 2567 /** 2568 * Obtains the lower bound of the current range. 2569 * 2570 * @returns { ScopeType } Returns the lower bound of the current range. 2571 * @syscap SystemCapability.Utils.Lang 2572 * @since 8 2573 * @deprecated since 9 2574 * @useinstead ohos.util.ScopeHelper.getLower 2575 */ 2576 getLower(): ScopeType; 2577 2578 /** 2579 * Creates the smallest range that includes the current range and the given lower and upper bounds. 2580 * 2581 * @param { ScopeType } lowerObj - A ScopeType value 2582 * @param { ScopeType } upperObj - A ScopeType value 2583 * @returns { Scope } Returns the smallest range that includes the current range and the given lower and upper bounds. 2584 * @syscap SystemCapability.Utils.Lang 2585 * @since 8 2586 * @deprecated since 9 2587 * @useinstead ohos.util.ScopeHelper.expand 2588 */ 2589 expand(lowerObj: ScopeType, upperObj: ScopeType): Scope; 2590 2591 /** 2592 * Creates the smallest range that includes the current range and a given range. 2593 * 2594 * @param { Scope } range - A Scope range object 2595 * @returns { Scope } Returns the smallest range that includes the current range and a given range. 2596 * @syscap SystemCapability.Utils.Lang 2597 * @since 8 2598 * @deprecated since 9 2599 * @useinstead ohos.util.ScopeHelper.expand 2600 */ 2601 expand(range: Scope): Scope; 2602 2603 /** 2604 * Creates the smallest range that includes the current range and a given value. 2605 * 2606 * @param { ScopeType } value - A ScopeType value 2607 * @returns { Scope } Returns the smallest range that includes the current range and a given value. 2608 * @syscap SystemCapability.Utils.Lang 2609 * @since 8 2610 * @deprecated since 9 2611 * @useinstead ohos.util.ScopeHelper.expand 2612 */ 2613 expand(value: ScopeType): Scope; 2614 2615 /** 2616 * Checks whether a given value is within the current range. 2617 * 2618 * @param { ScopeType } value - A ScopeType value 2619 * @returns { boolean } If the value is within the current range return true,otherwise return false. 2620 * @syscap SystemCapability.Utils.Lang 2621 * @since 8 2622 * @deprecated since 9 2623 * @useinstead ohos.util.ScopeHelper.contains 2624 */ 2625 contains(value: ScopeType): boolean; 2626 2627 /** 2628 * Checks whether a given range is within the current range. 2629 * 2630 * @param { Scope } range - A Scope range 2631 * @returns { boolean } If the current range is within the given range return true,otherwise return false. 2632 * @syscap SystemCapability.Utils.Lang 2633 * @since 8 2634 * @deprecated since 9 2635 * @useinstead ohos.util.ScopeHelper.contains 2636 */ 2637 contains(range: Scope): boolean; 2638 2639 /** 2640 * Clamps a given value to the current range. 2641 * 2642 * @param { ScopeType } value - A ScopeType value 2643 * @returns { ScopeType } Returns a ScopeType object that a given value is clamped to the current range.. 2644 * @syscap SystemCapability.Utils.Lang 2645 * @since 8 2646 * @deprecated since 9 2647 * @useinstead ohos.util.ScopeHelper.clamp 2648 */ 2649 clamp(value: ScopeType): ScopeType; 2650 } 2651 2652 /** 2653 * The ScopeHelper interface is used to describe the valid range of a field. 2654 * 2655 * @syscap SystemCapability.Utils.Lang 2656 * @since 9 2657 */ 2658 /** 2659 * The ScopeHelper interface is used to describe the valid range of a field. 2660 * 2661 * @syscap SystemCapability.Utils.Lang 2662 * @crossplatform 2663 * @since 10 2664 */ 2665 /** 2666 * Provides APIs to define the valid range of a field. The constructor of this class creates comparable objects 2667 * with lower and upper limits. 2668 * 2669 * @syscap SystemCapability.Utils.Lang 2670 * @crossplatform 2671 * @atomicservice 2672 * @since 12 2673 */ 2674 class ScopeHelper { 2675 /** 2676 * A constructor used to create a Scope instance with the lower and upper bounds specified. 2677 * 2678 * @param { ScopeType } lowerObj - A ScopeType value 2679 * @param { ScopeType } upperObj - A ScopeType value 2680 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2681 * 1.Mandatory parameters are left unspecified; 2682 * 2.Incorrect parameter types. 2683 * @syscap SystemCapability.Utils.Lang 2684 * @since 9 2685 */ 2686 /** 2687 * A constructor used to create a Scope instance with the lower and upper bounds specified. 2688 * 2689 * @param { ScopeType } lowerObj - A ScopeType value 2690 * @param { ScopeType } upperObj - A ScopeType value 2691 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2692 * 1.Mandatory parameters are left unspecified; 2693 * 2.Incorrect parameter types. 2694 * @syscap SystemCapability.Utils.Lang 2695 * @crossplatform 2696 * @since 10 2697 */ 2698 /** 2699 * A constructor used to create a ScopeHelper object with the specified upper and lower limits. 2700 * 2701 * @param { ScopeType } lowerObj - Lower limit of the Scope object. 2702 * @param { ScopeType } upperObj - Upper limit of the Scope object. 2703 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2704 * 1.Mandatory parameters are left unspecified; 2705 * 2.Incorrect parameter types. 2706 * @syscap SystemCapability.Utils.Lang 2707 * @crossplatform 2708 * @atomicservice 2709 * @since 12 2710 */ 2711 constructor(lowerObj: ScopeType, upperObj: ScopeType); 2712 2713 /** 2714 * Obtains a string representation of the current range. 2715 * 2716 * @returns { string } Returns a string representation of the current range object. 2717 * @syscap SystemCapability.Utils.Lang 2718 * @since 9 2719 */ 2720 /** 2721 * Obtains a string representation of the current range. 2722 * 2723 * @returns { string } Returns a string representation of the current range object. 2724 * @syscap SystemCapability.Utils.Lang 2725 * @crossplatform 2726 * @since 10 2727 */ 2728 /** 2729 * Obtains a string representation that contains this Scope. 2730 * 2731 * @returns { string } Returns a string representation of the current range object. 2732 * @syscap SystemCapability.Utils.Lang 2733 * @crossplatform 2734 * @atomicservice 2735 * @since 12 2736 */ 2737 toString(): string; 2738 2739 /** 2740 * Returns the intersection of a given range and the current range. 2741 * 2742 * @param { ScopeHelper } range - A Scope range object 2743 * @returns { ScopeHelper } Returns the intersection of a given range and the current range. 2744 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2745 * 1.Mandatory parameters are left unspecified; 2746 * 2.Incorrect parameter types. 2747 * @syscap SystemCapability.Utils.Lang 2748 * @since 9 2749 */ 2750 /** 2751 * Returns the intersection of a given range and the current range. 2752 * 2753 * @param { ScopeHelper } range - A Scope range object 2754 * @returns { ScopeHelper } Returns the intersection of a given range and the current range. 2755 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2756 * 1.Mandatory parameters are left unspecified; 2757 * 2.Incorrect parameter types. 2758 * @syscap SystemCapability.Utils.Lang 2759 * @crossplatform 2760 * @since 10 2761 */ 2762 /** 2763 * Obtains the intersection of this Scope and the given Scope. 2764 * 2765 * @param { ScopeHelper } range - Scope specified. 2766 * @returns { ScopeHelper } Returns the intersection of a given range and the current range. 2767 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2768 * 1.Mandatory parameters are left unspecified; 2769 * 2.Incorrect parameter types. 2770 * @syscap SystemCapability.Utils.Lang 2771 * @crossplatform 2772 * @atomicservice 2773 * @since 12 2774 */ 2775 intersect(range: ScopeHelper): ScopeHelper; 2776 2777 /** 2778 * Returns the intersection of the current range and the range specified by the given lower and upper bounds. 2779 * 2780 * @param { ScopeType } lowerObj - A ScopeType value 2781 * @param { ScopeType } upperObj - A ScopeType value 2782 * @returns { ScopeHelper } Returns the intersection of the current range and the range specified by the given lower and upper bounds. 2783 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2784 * 1.Mandatory parameters are left unspecified; 2785 * 2.Incorrect parameter types. 2786 * @syscap SystemCapability.Utils.Lang 2787 * @since 9 2788 */ 2789 /** 2790 * Returns the intersection of the current range and the range specified by the given lower and upper bounds. 2791 * 2792 * @param { ScopeType } lowerObj - A ScopeType value 2793 * @param { ScopeType } upperObj - A ScopeType value 2794 * @returns { ScopeHelper } Returns the intersection of the current range and the range specified by the given lower and upper bounds. 2795 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2796 * 1.Mandatory parameters are left unspecified; 2797 * 2.Incorrect parameter types. 2798 * @syscap SystemCapability.Utils.Lang 2799 * @crossplatform 2800 * @since 10 2801 */ 2802 /** 2803 * Obtains the intersection of this Scope and the given lower and upper limits. 2804 * 2805 * @param { ScopeType } lowerObj - Lower limit. 2806 * @param { ScopeType } upperObj - Upper limit. 2807 * @returns { ScopeHelper } Returns the intersection of the current range and the range specified by the given lower and upper bounds. 2808 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2809 * 1.Mandatory parameters are left unspecified; 2810 * 2.Incorrect parameter types. 2811 * @syscap SystemCapability.Utils.Lang 2812 * @crossplatform 2813 * @atomicservice 2814 * @since 12 2815 */ 2816 intersect(lowerObj: ScopeType, upperObj: ScopeType): ScopeHelper; 2817 2818 /** 2819 * Obtains the upper bound of the current range. 2820 * 2821 * @returns { ScopeType } Returns the upper bound of the current range. 2822 * @syscap SystemCapability.Utils.Lang 2823 * @since 9 2824 */ 2825 /** 2826 * Obtains the upper bound of the current range. 2827 * 2828 * @returns { ScopeType } Returns the upper bound of the current range. 2829 * @syscap SystemCapability.Utils.Lang 2830 * @crossplatform 2831 * @since 10 2832 */ 2833 /** 2834 * Obtains the upper limit of this Scope. 2835 * 2836 * @returns { ScopeType } Returns the upper bound of the current range. 2837 * @syscap SystemCapability.Utils.Lang 2838 * @crossplatform 2839 * @atomicservice 2840 * @since 12 2841 */ 2842 getUpper(): ScopeType; 2843 2844 /** 2845 * Obtains the lower bound of the current range. 2846 * 2847 * @returns { ScopeType } Returns the lower bound of the current range. 2848 * @syscap SystemCapability.Utils.Lang 2849 * @since 9 2850 */ 2851 /** 2852 * Obtains the lower bound of the current range. 2853 * 2854 * @returns { ScopeType } Returns the lower bound of the current range. 2855 * @syscap SystemCapability.Utils.Lang 2856 * @crossplatform 2857 * @since 10 2858 */ 2859 /** 2860 * Obtains the lower limit of this Scope. 2861 * 2862 * @returns { ScopeType } Returns the lower bound of the current range. 2863 * @syscap SystemCapability.Utils.Lang 2864 * @crossplatform 2865 * @atomicservice 2866 * @since 12 2867 */ 2868 getLower(): ScopeType; 2869 2870 /** 2871 * Creates the smallest range that includes the current range and the given lower and upper bounds. 2872 * 2873 * @param { ScopeType } lowerObj - A ScopeType value 2874 * @param { ScopeType } upperObj - A ScopeType value 2875 * @returns { ScopeHelper } Returns the smallest range that includes the current range and the given lower and upper bounds. 2876 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2877 * 1.Mandatory parameters are left unspecified; 2878 * 2.Incorrect parameter types. 2879 * @syscap SystemCapability.Utils.Lang 2880 * @since 9 2881 */ 2882 /** 2883 * Obtains the union set of this Scope and the given lower and upper limits. 2884 * 2885 * @param { ScopeType } lowerObj - A ScopeType value 2886 * @param { ScopeType } upperObj - A ScopeType value 2887 * @returns { ScopeHelper } Returns the smallest range that includes the current range and the given lower and upper bounds. 2888 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2889 * 1.Mandatory parameters are left unspecified; 2890 * 2.Incorrect parameter types. 2891 * @syscap SystemCapability.Utils.Lang 2892 * @atomicservice 2893 * @since 12 2894 */ 2895 expand(lowerObj: ScopeType, upperObj: ScopeType): ScopeHelper; 2896 2897 /** 2898 * Creates the smallest range that includes the current range and a given range. 2899 * 2900 * @param { ScopeHelper } range - A Scope range object 2901 * @returns { ScopeHelper } Returns the smallest range that includes the current range and a given range. 2902 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2903 * 1.Mandatory parameters are left unspecified; 2904 * 2.Incorrect parameter types. 2905 * @syscap SystemCapability.Utils.Lang 2906 * @since 9 2907 */ 2908 /** 2909 * Creates the smallest range that includes the current range and a given range. 2910 * 2911 * @param { ScopeHelper } range - A Scope range object 2912 * @returns { ScopeHelper } Returns the smallest range that includes the current range and a given range. 2913 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2914 * 1.Mandatory parameters are left unspecified; 2915 * 2.Incorrect parameter types. 2916 * @syscap SystemCapability.Utils.Lang 2917 * @crossplatform 2918 * @since 10 2919 */ 2920 /** 2921 * Obtains the union set of this Scope and the given Scope. 2922 * 2923 * @param { ScopeHelper } range - Scope specified. 2924 * @returns { ScopeHelper } Returns the smallest range that includes the current range and a given range. 2925 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2926 * 1.Mandatory parameters are left unspecified; 2927 * 2.Incorrect parameter types. 2928 * @syscap SystemCapability.Utils.Lang 2929 * @crossplatform 2930 * @atomicservice 2931 * @since 12 2932 */ 2933 expand(range: ScopeHelper): ScopeHelper; 2934 2935 /** 2936 * Creates the smallest range that includes the current range and a given value. 2937 * 2938 * @param { ScopeType } value - A ScopeType value 2939 * @returns { ScopeHelper } Returns the smallest range that includes the current range and a given value. 2940 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2941 * 1.Mandatory parameters are left unspecified; 2942 * 2.Incorrect parameter types. 2943 * @syscap SystemCapability.Utils.Lang 2944 * @since 9 2945 */ 2946 /** 2947 * Creates the smallest range that includes the current range and a given value. 2948 * 2949 * @param { ScopeType } value - A ScopeType value 2950 * @returns { ScopeHelper } Returns the smallest range that includes the current range and a given value. 2951 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2952 * 1.Mandatory parameters are left unspecified; 2953 * 2.Incorrect parameter types. 2954 * @syscap SystemCapability.Utils.Lang 2955 * @crossplatform 2956 * @since 10 2957 */ 2958 /** 2959 * Obtains the union set of this Scope and the given value. 2960 * 2961 * @param { ScopeType } value - A ScopeType value 2962 * @returns { ScopeHelper } Returns the smallest range that includes the current range and a given value. 2963 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2964 * 1.Mandatory parameters are left unspecified; 2965 * 2.Incorrect parameter types. 2966 * @syscap SystemCapability.Utils.Lang 2967 * @crossplatform 2968 * @atomicservice 2969 * @since 12 2970 */ 2971 expand(value: ScopeType): ScopeHelper; 2972 2973 /** 2974 * Checks whether a given value is within the current range. 2975 * 2976 * @param { ScopeType } value - A ScopeType value 2977 * @returns { boolean } If the value is within the current range return true,otherwise return false. 2978 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2979 * 1.Mandatory parameters are left unspecified; 2980 * 2.Incorrect parameter types. 2981 * @syscap SystemCapability.Utils.Lang 2982 * @since 9 2983 */ 2984 /** 2985 * Checks whether a given value is within the current range. 2986 * 2987 * @param { ScopeType } value - A ScopeType value 2988 * @returns { boolean } If the value is within the current range return true,otherwise return false. 2989 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2990 * 1.Mandatory parameters are left unspecified; 2991 * 2.Incorrect parameter types. 2992 * @syscap SystemCapability.Utils.Lang 2993 * @crossplatform 2994 * @since 10 2995 */ 2996 /** 2997 * Checks whether a value is within this Scope. 2998 * 2999 * @param { ScopeType } value - Value specified. 3000 * @returns { boolean } If the value is within the current range return true,otherwise return false. 3001 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3002 * 1.Mandatory parameters are left unspecified; 3003 * 2.Incorrect parameter types. 3004 * @syscap SystemCapability.Utils.Lang 3005 * @crossplatform 3006 * @atomicservice 3007 * @since 12 3008 */ 3009 contains(value: ScopeType): boolean; 3010 3011 /** 3012 * Checks whether a given range is within the current range. 3013 * 3014 * @param { ScopeHelper } range - A Scope range 3015 * @returns { boolean } If the current range is within the given range return true,otherwise return false. 3016 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3017 * 1.Mandatory parameters are left unspecified; 3018 * 2.Incorrect parameter types. 3019 * @syscap SystemCapability.Utils.Lang 3020 * @since 9 3021 */ 3022 /** 3023 * Checks whether a given range is within the current range. 3024 * 3025 * @param { ScopeHelper } range - A Scope range 3026 * @returns { boolean } If the current range is within the given range return true,otherwise return false. 3027 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3028 * 1.Mandatory parameters are left unspecified; 3029 * 2.Incorrect parameter types. 3030 * @syscap SystemCapability.Utils.Lang 3031 * @crossplatform 3032 * @since 10 3033 */ 3034 /** 3035 * Checks whether a range is within this Scope. 3036 * 3037 * @param { ScopeHelper } range - Scope specified. 3038 * @returns { boolean } If the current range is within the given range return true,otherwise return false. 3039 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3040 * 1.Mandatory parameters are left unspecified; 3041 * 2.Incorrect parameter types. 3042 * @syscap SystemCapability.Utils.Lang 3043 * @crossplatform 3044 * @atomicservice 3045 * @since 12 3046 */ 3047 contains(range: ScopeHelper): boolean; 3048 3049 /** 3050 * Clamps a given value to the current range. 3051 * 3052 * @param { ScopeType } value - A ScopeType value 3053 * @returns { ScopeType } Returns a ScopeType object that a given value is clamped to the current range. 3054 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3055 * 1.Mandatory parameters are left unspecified; 3056 * 2.Incorrect parameter types. 3057 * @syscap SystemCapability.Utils.Lang 3058 * @since 9 3059 */ 3060 /** 3061 * Clamps a given value to the current range. 3062 * 3063 * @param { ScopeType } value - A ScopeType value 3064 * @returns { ScopeType } Returns a ScopeType object that a given value is clamped to the current range. 3065 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3066 * 1.Mandatory parameters are left unspecified; 3067 * 2.Incorrect parameter types. 3068 * @syscap SystemCapability.Utils.Lang 3069 * @crossplatform 3070 * @since 10 3071 */ 3072 /** 3073 * Limits a value to this Scope. 3074 * 3075 * @param { ScopeType } value - Value specified. 3076 * @returns { ScopeType } Returns a ScopeType object that a given value is clamped to the current range. 3077 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3078 * 1.Mandatory parameters are left unspecified; 3079 * 2.Incorrect parameter types. 3080 * @syscap SystemCapability.Utils.Lang 3081 * @crossplatform 3082 * @atomicservice 3083 * @since 12 3084 */ 3085 clamp(value: ScopeType): ScopeType; 3086 } 3087 3088 /** 3089 * Decodes a Base64 encoded String or input u8 array into a newly-allocated 3090 * u8 array using the Base64 encoding scheme. 3091 * 3092 * @syscap SystemCapability.Utils.Lang 3093 * @since 8 3094 * @deprecated since 9 3095 * @useinstead ohos.util.Base64Helper 3096 */ 3097 class Base64 { 3098 /** 3099 * Constructor for creating base64 encoding and decoding 3100 * 3101 * @syscap SystemCapability.Utils.Lang 3102 * @since 8 3103 * @deprecated since 9 3104 * @useinstead ohos.util.Base64Helper.constructor 3105 */ 3106 constructor(); 3107 3108 /** 3109 * Encodes all bytes from the specified u8 array into a newly-allocated u8 array using the Base64 encoding scheme. 3110 * 3111 * @param { Uint8Array } src - A Uint8Array value 3112 * @returns { Uint8Array } Return the encoded new Uint8Array. 3113 * @syscap SystemCapability.Utils.Lang 3114 * @since 8 3115 * @deprecated since 9 3116 * @useinstead ohos.util.Base64Helper.encodeSync 3117 */ 3118 encodeSync(src: Uint8Array): Uint8Array; 3119 3120 /** 3121 * Encodes the specified byte array into a String using the Base64 encoding scheme. 3122 * 3123 * @param { Uint8Array } src - A Uint8Array value 3124 * @returns { string } Return the encoded string. 3125 * @syscap SystemCapability.Utils.Lang 3126 * @since 8 3127 * @deprecated since 9 3128 * @useinstead ohos.util.Base64Helper.encodeToStringSync 3129 */ 3130 encodeToStringSync(src: Uint8Array): string; 3131 3132 /** 3133 * Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme. 3134 * 3135 * @param { Uint8Array | string } src - A Uint8Array value or value A string value 3136 * @returns { Uint8Array } Return the decoded Uint8Array. 3137 * @syscap SystemCapability.Utils.Lang 3138 * @since 8 3139 * @deprecated since 9 3140 * @useinstead ohos.util.Base64Helper.decodeSync 3141 */ 3142 decodeSync(src: Uint8Array | string): Uint8Array; 3143 3144 /** 3145 * Asynchronously encodes all bytes in the specified u8 array into the newly allocated u8 array using the Base64 encoding scheme. 3146 * 3147 * @param { Uint8Array } src - A Uint8Array value 3148 * @returns { Promise<Uint8Array> } Return the encodes asynchronous new Uint8Array. 3149 * @syscap SystemCapability.Utils.Lang 3150 * @since 8 3151 * @deprecated since 9 3152 * @useinstead ohos.util.Base64Helper.encode 3153 */ 3154 encode(src: Uint8Array): Promise<Uint8Array>; 3155 3156 /** 3157 * Asynchronously encodes the specified byte array into a String using the Base64 encoding scheme. 3158 * 3159 * @param { Uint8Array } src - A Uint8Array value 3160 * @returns { Promise<string> } Returns the encoded asynchronous string. 3161 * @syscap SystemCapability.Utils.Lang 3162 * @since 8 3163 * @deprecated since 9 3164 * @useinstead ohos.util.Base64Helper.encodeToString 3165 */ 3166 encodeToString(src: Uint8Array): Promise<string>; 3167 3168 /** 3169 * Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 array into a newly allocated u8 array. 3170 * 3171 * @param { Uint8Array | string } src - A Uint8Array value or value A string value 3172 * @returns { Promise<Uint8Array> } Return the decoded asynchronous Uint8Array. 3173 * @syscap SystemCapability.Utils.Lang 3174 * @since 8 3175 * @deprecated since 9 3176 * @useinstead ohos.util.Base64Helper.decode 3177 */ 3178 decode(src: Uint8Array | string): Promise<Uint8Array>; 3179 } 3180 3181 /** 3182 * The Type represents two different encoding formats for base64 3183 * 3184 * @enum { number } Type 3185 * @syscap SystemCapability.Utils.Lang 3186 * @crossplatform 3187 * @since 10 3188 */ 3189 /** 3190 * The Type represents two different encoding formats for base64 3191 * 3192 * @enum { number } Type 3193 * @syscap SystemCapability.Utils.Lang 3194 * @crossplatform 3195 * @atomicservice 3196 * @since 11 3197 */ 3198 /** 3199 * The Type represents four different encoding formats for base64 3200 * 3201 * @enum { number } Type 3202 * @syscap SystemCapability.Utils.Lang 3203 * @crossplatform 3204 * @atomicservice 3205 * @since 12 3206 */ 3207 enum Type { 3208 /** 3209 * The value indicates that the encoding format of base64 is BASIC 3210 * @syscap SystemCapability.Utils.Lang 3211 * @crossplatform 3212 * @since 10 3213 */ 3214 /** 3215 * The value indicates that the encoding format of base64 is BASIC 3216 * @syscap SystemCapability.Utils.Lang 3217 * @crossplatform 3218 * @atomicservice 3219 * @since 11 3220 */ 3221 BASIC, 3222 /** 3223 * The value indicates that the encoding format of base64 is MIME 3224 * @syscap SystemCapability.Utils.Lang 3225 * @crossplatform 3226 * @since 10 3227 */ 3228 /** 3229 * The value indicates that the encoding format of base64 is MIME 3230 * @syscap SystemCapability.Utils.Lang 3231 * @crossplatform 3232 * @atomicservice 3233 * @since 11 3234 */ 3235 MIME, 3236 /** 3237 * The value indicates that the encoding format of base64 is BASIC_URL_SAFE 3238 * @syscap SystemCapability.Utils.Lang 3239 * @crossplatform 3240 * @atomicservice 3241 * @since 12 3242 */ 3243 BASIC_URL_SAFE, 3244 /** 3245 * The value indicates that the encoding format of base64 is MIME_URL_SAFE 3246 * @syscap SystemCapability.Utils.Lang 3247 * @crossplatform 3248 * @atomicservice 3249 * @since 12 3250 */ 3251 MIME_URL_SAFE 3252 } 3253 3254 /** 3255 * Decodes a Base64 encoded String or input u8 array into a newly-allocated 3256 * u8 array using the Base64 encoding scheme. 3257 * 3258 * @syscap SystemCapability.Utils.Lang 3259 * @since 9 3260 */ 3261 /** 3262 * Decodes a Base64 encoded String or input u8 array into a newly-allocated 3263 * u8 array using the Base64 encoding scheme. 3264 * 3265 * @syscap SystemCapability.Utils.Lang 3266 * @crossplatform 3267 * @since 10 3268 */ 3269 /** 3270 * Decodes a Base64 encoded String or input u8 array into a newly-allocated 3271 * u8 array using the Base64 encoding scheme. 3272 * 3273 * @syscap SystemCapability.Utils.Lang 3274 * @crossplatform 3275 * @atomicservice 3276 * @since 11 3277 */ 3278 class Base64Helper { 3279 /** 3280 * Constructor for creating base64 encoding and decoding 3281 * 3282 * @syscap SystemCapability.Utils.Lang 3283 * @since 9 3284 */ 3285 /** 3286 * Constructor for creating base64 encoding and decoding 3287 * 3288 * @syscap SystemCapability.Utils.Lang 3289 * @crossplatform 3290 * @since 10 3291 */ 3292 /** 3293 * A constructor used to create a Base64Helper instance. 3294 * 3295 * @syscap SystemCapability.Utils.Lang 3296 * @crossplatform 3297 * @atomicservice 3298 * @since 11 3299 */ 3300 constructor(); 3301 3302 /** 3303 * Encodes all bytes from the specified u8 array into a newly-allocated u8 array using the Base64 encoding scheme. 3304 * 3305 * @param { Uint8Array } src - A Uint8Array value 3306 * @returns { Uint8Array } Return the encoded new Uint8Array. 3307 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3308 * 1.Mandatory parameters are left unspecified; 3309 * 2.Incorrect parameter types. 3310 * @syscap SystemCapability.Utils.Lang 3311 * @since 9 3312 */ 3313 /** 3314 * Encodes all bytes from the specified u8 array into a newly-allocated u8 array using the Base64 encoding scheme. 3315 * 3316 * @param { Uint8Array } src - A Uint8Array value 3317 * @returns { Uint8Array } Return the encoded new Uint8Array. 3318 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3319 * 1.Mandatory parameters are left unspecified; 3320 * 2.Incorrect parameter types. 3321 * @syscap SystemCapability.Utils.Lang 3322 * @crossplatform 3323 * @since 10 3324 */ 3325 /** 3326 * Encodes all bytes from the specified u8 array into a newly-allocated u8 array using the Base64 encoding scheme. 3327 * 3328 * @param { Uint8Array } src - A Uint8Array value 3329 * @returns { Uint8Array } Return the encoded new Uint8Array. 3330 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3331 * 1.Mandatory parameters are left unspecified; 3332 * 2.Incorrect parameter types. 3333 * @syscap SystemCapability.Utils.Lang 3334 * @crossplatform 3335 * @atomicservice 3336 * @since 11 3337 */ 3338 /** 3339 * Encodes the input content into a Uint8Array object. 3340 * 3341 * @param { Uint8Array } src - Uint8Array object to encode. 3342 * @param { Type } [options] - Encoding format. The following values are available: 3343 * - util.Type.BASIC (default): Base64 encoding. 3344 * - util.Type.BASIC_URL_SAFE: Base64URL encoding. 3345 * @returns { Uint8Array } Return the encoded new Uint8Array. 3346 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3347 * 1.Mandatory parameters are left unspecified; 3348 * 2.Incorrect parameter types. 3349 * @syscap SystemCapability.Utils.Lang 3350 * @crossplatform 3351 * @atomicservice 3352 * @since 12 3353 */ 3354 encodeSync(src: Uint8Array, options?: Type): Uint8Array; 3355 3356 /** 3357 * Encodes the specified byte array into a String using the Base64 encoding scheme. 3358 * 3359 * @param { Uint8Array } src - A Uint8Array value 3360 * @returns { string } Return the encoded string. 3361 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3362 * 1.Mandatory parameters are left unspecified; 3363 * 2.Incorrect parameter types. 3364 * @syscap SystemCapability.Utils.Lang 3365 * @since 9 3366 */ 3367 /** 3368 * Encodes the specified byte array into a String using the Base64 encoding scheme. 3369 * 3370 * @param { Uint8Array } src - A Uint8Array value 3371 * @param { Type } [options] - Enumerating input parameters includes two encoding formats: BASIC and MIME 3372 * @returns { string } Return the encoded string. 3373 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3374 * 1.Mandatory parameters are left unspecified; 3375 * 2.Incorrect parameter types. 3376 * @syscap SystemCapability.Utils.Lang 3377 * @crossplatform 3378 * @since 10 3379 */ 3380 /** 3381 * Encodes the specified byte array into a String using the Base64 encoding scheme. 3382 * 3383 * @param { Uint8Array } src - A Uint8Array value 3384 * @param { Type } [options] - Enumerating input parameters includes two encoding formats: BASIC and MIME 3385 * @returns { string } Return the encoded string. 3386 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3387 * 1.Mandatory parameters are left unspecified; 3388 * 2.Incorrect parameter types. 3389 * @syscap SystemCapability.Utils.Lang 3390 * @crossplatform 3391 * @atomicservice 3392 * @since 11 3393 */ 3394 /** 3395 * Encodes the input content into a string. This API returns the result synchronously. 3396 * 3397 * @param { Uint8Array } src - Uint8Array object to encode. 3398 * @param { Type } [options] - Encoding format. The following values are available: 3399 * - util.Type.BASIC (default): Base64 encoding. The return value does not contain carriage return characters or newline characters. 3400 * - util.Type.MIME: Base64 encoding. Each line of the return value contains a maximum of 76 characters and ends with '\r\n'. 3401 * - util.Type.BASIC_URL_SAFE: Base64URL encoding. The return value does not contain carriage return characters or newline characters. 3402 * - util.Type.MIME_URL_SAFE: Base64URL encoding. Each line in the return value contains a maximum of 76 characters and ends with '\r\n'. 3403 * @returns { string } Return the encoded string. 3404 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3405 * 1.Mandatory parameters are left unspecified; 3406 * 2.Incorrect parameter types. 3407 * @syscap SystemCapability.Utils.Lang 3408 * @crossplatform 3409 * @atomicservice 3410 * @since 12 3411 */ 3412 encodeToStringSync(src: Uint8Array, options?: Type): string; 3413 3414 /** 3415 * Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme. 3416 * 3417 * @param { Uint8Array | string } src - A Uint8Array value or value A string value 3418 * @returns { Uint8Array } Return the decoded Uint8Array. 3419 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3420 * 1.Mandatory parameters are left unspecified; 3421 * 2.Incorrect parameter types. 3422 * @syscap SystemCapability.Utils.Lang 3423 * @since 9 3424 */ 3425 /** 3426 * Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme. 3427 * 3428 * @param { Uint8Array | string } src - A Uint8Array value or value A string value 3429 * @param { Type } [options] - Enumerating input parameters includes two encoding formats: BASIC and MIME 3430 * @returns { Uint8Array } Return the decoded Uint8Array. 3431 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3432 * 1.Mandatory parameters are left unspecified; 3433 * 2.Incorrect parameter types. 3434 * @syscap SystemCapability.Utils.Lang 3435 * @crossplatform 3436 * @since 10 3437 */ 3438 /** 3439 * Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme. 3440 * 3441 * @param { Uint8Array | string } src - A Uint8Array value or value A string value 3442 * @param { Type } [options] - Enumerating input parameters includes two encoding formats: BASIC and MIME 3443 * @returns { Uint8Array } Return the decoded Uint8Array. 3444 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3445 * 1.Mandatory parameters are left unspecified; 3446 * 2.Incorrect parameter types. 3447 * @syscap SystemCapability.Utils.Lang 3448 * @crossplatform 3449 * @atomicservice 3450 * @since 11 3451 */ 3452 /** 3453 * Decodes a string into a Uint8Array object. This API returns the result synchronously. 3454 * 3455 * @param { Uint8Array | string } src - Uint8Array object or string to decode. 3456 * @param { Type } [options] - Decoding format. The following values are available: 3457 * - util.Type.BASIC (default): Base64 decoding. 3458 * - util.Type.MIME: Base64 decoding. The input parameter src contains carriage return characters and newline characters. 3459 * - util.Type.BASIC_URL_SAFE: Base64URL decoding. 3460 * - util.Type.MIME_URL_SAFE: Base64 URL decoding. The input parameter src contains carriage return characters and newline characters. 3461 * @returns { Uint8Array } Return the decoded Uint8Array. 3462 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3463 * 1.Mandatory parameters are left unspecified; 3464 * 2.Incorrect parameter types. 3465 * @syscap SystemCapability.Utils.Lang 3466 * @crossplatform 3467 * @atomicservice 3468 * @since 12 3469 */ 3470 decodeSync(src: Uint8Array | string, options?: Type): Uint8Array; 3471 3472 /** 3473 * Asynchronously encodes all bytes in the specified u8 array into the newly allocated u8 array using the Base64 encoding scheme. 3474 * 3475 * @param { Uint8Array } src - A Uint8Array value 3476 * @returns { Promise<Uint8Array> } Return the encodes asynchronous new Uint8Array. 3477 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3478 * 1.Mandatory parameters are left unspecified; 3479 * 2.Incorrect parameter types. 3480 * @syscap SystemCapability.Utils.Lang 3481 * @since 9 3482 */ 3483 /** 3484 * Asynchronously encodes all bytes in the specified u8 array into the newly allocated u8 array using the Base64 encoding scheme. 3485 * 3486 * @param { Uint8Array } src - A Uint8Array value 3487 * @returns { Promise<Uint8Array> } Return the encodes asynchronous new Uint8Array. 3488 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3489 * 1.Mandatory parameters are left unspecified; 3490 * 2.Incorrect parameter types. 3491 * @syscap SystemCapability.Utils.Lang 3492 * @crossplatform 3493 * @since 10 3494 */ 3495 /** 3496 * Asynchronously encodes all bytes in the specified u8 array into the newly allocated u8 array using the Base64 encoding scheme. 3497 * 3498 * @param { Uint8Array } src - A Uint8Array value 3499 * @returns { Promise<Uint8Array> } Return the encodes asynchronous new Uint8Array. 3500 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3501 * 1.Mandatory parameters are left unspecified; 3502 * 2.Incorrect parameter types. 3503 * @syscap SystemCapability.Utils.Lang 3504 * @crossplatform 3505 * @atomicservice 3506 * @since 11 3507 */ 3508 /** 3509 * Encodes the input content into a Uint8Array object. This API uses a promise to return the result. 3510 * 3511 * @param { Uint8Array } src - Uint8Array object to encode. 3512 * @param { Type } [options] - Encoding format. The following values are available: 3513 * - util.Type.BASIC (default): Base64 encoding. 3514 * - util.Type.BASIC_URL_SAFE: Base64URL encoding. 3515 * @returns { Promise<Uint8Array> } Return the encodes asynchronous new Uint8Array. 3516 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3517 * 1.Mandatory parameters are left unspecified; 3518 * 2.Incorrect parameter types. 3519 * @syscap SystemCapability.Utils.Lang 3520 * @crossplatform 3521 * @atomicservice 3522 * @since 12 3523 */ 3524 encode(src: Uint8Array, options?: Type): Promise<Uint8Array>; 3525 3526 /** 3527 * Asynchronously encodes the specified byte array into a String using the Base64 encoding scheme. 3528 * 3529 * @param { Uint8Array } src - A Uint8Array value 3530 * @returns { Promise<string> } Returns the encoded asynchronous string. 3531 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3532 * 1.Mandatory parameters are left unspecified; 3533 * 2.Incorrect parameter types. 3534 * @syscap SystemCapability.Utils.Lang 3535 * @since 9 3536 */ 3537 /** 3538 * Asynchronously encodes the specified byte array into a String using the Base64 encoding scheme. 3539 * 3540 * @param { Uint8Array } src - A Uint8Array value 3541 * @param { Type } [options] - Enumerating input parameters includes two encoding formats: BASIC and MIME 3542 * @returns { Promise<string> } Returns the encoded asynchronous string. 3543 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3544 * 1.Mandatory parameters are left unspecified; 3545 * 2.Incorrect parameter types. 3546 * @syscap SystemCapability.Utils.Lang 3547 * @crossplatform 3548 * @since 10 3549 */ 3550 /** 3551 * Encodes the input content into a string. This API uses a promise to return the result. 3552 * 3553 * @param { Uint8Array } src - Uint8Array object to encode. 3554 * @param { Type } [options] - Encoding format. The following values are available: 3555 * - util.Type.BASIC (default): Base64 encoding. The return value does not contain carriage return characters or newline characters. 3556 * - util.Type.MIME: Base64 encoding. Each line of the return value contains a maximum of 76 characters and ends with '\r\n'. 3557 * - util.Type.BASIC_URL_SAFE: Base64URL encoding. The return value does not contain carriage return characters or newline characters. 3558 * - util.Type.MIME_URL_SAFE: Base64URL encoding. Each line in the return value contains a maximum of 76 characters and ends with '\r\n'. 3559 * @returns { Promise<string> } Returns the encoded asynchronous string. 3560 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3561 * 1.Mandatory parameters are left unspecified; 3562 * 2.Incorrect parameter types. 3563 * @syscap SystemCapability.Utils.Lang 3564 * @crossplatform 3565 * @atomicservice 3566 * @since 12 3567 */ 3568 encodeToString(src: Uint8Array, options?: Type): Promise<string>; 3569 3570 /** 3571 * Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or 3572 * input u8 array into a newly allocated u8 array. 3573 * 3574 * @param { Uint8Array | string } src - A Uint8Array value or value A string value 3575 * @returns { Promise<Uint8Array> } Return the decoded asynchronous Uint8Array. 3576 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3577 * 1.Mandatory parameters are left unspecified; 3578 * 2.Incorrect parameter types. 3579 * @syscap SystemCapability.Utils.Lang 3580 * @since 9 3581 */ 3582 /** 3583 * Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or 3584 * input u8 array into a newly allocated u8 array. 3585 * 3586 * @param { Uint8Array | string } src - A Uint8Array value or value A string value 3587 * @param { Type } [options] - Enumerating input parameters includes two encoding formats: BASIC and MIME 3588 * @returns { Promise<Uint8Array> } Return the decoded asynchronous Uint8Array. 3589 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3590 * 1.Mandatory parameters are left unspecified; 3591 * 2.Incorrect parameter types. 3592 * @syscap SystemCapability.Utils.Lang 3593 * @crossplatform 3594 * @since 10 3595 */ 3596 /** 3597 * Decodes the input content into a Uint8Array object. This API uses a promise to return the result. 3598 * 3599 * @param { Uint8Array | string } src - Uint8Array object or string to decode. 3600 * @param { Type } [options] - Decoding format. The following values are available: 3601 * - util.Type.BASIC (default): Base64 decoding. 3602 * - util.Type.MIME: Base64 decoding. The input parameter src contains carriage return characters and newline characters. 3603 * - util.Type.BASIC_URL_SAFE: Base64URL decoding. 3604 * - util.Type.MIME_URL_SAFE: Base64 URL decoding. The input parameter src contains carriage return characters and newline characters. 3605 * @returns { Promise<Uint8Array> } Return the decoded asynchronous Uint8Array. 3606 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3607 * 1.Mandatory parameters are left unspecified; 3608 * 2.Incorrect parameter types. 3609 * @syscap SystemCapability.Utils.Lang 3610 * @crossplatform 3611 * @atomicservice 3612 * @since 12 3613 */ 3614 decode(src: Uint8Array | string, options?: Type): Promise<Uint8Array>; 3615 } 3616 3617 /** 3618 * Check the type of parameter. 3619 * 3620 * @syscap SystemCapability.Utils.Lang 3621 * @since 8 3622 */ 3623 /** 3624 * Check the type of parameter. 3625 * 3626 * @syscap SystemCapability.Utils.Lang 3627 * @crossplatform 3628 * @since 10 3629 */ 3630 /** 3631 * Provides APIs to check different types of built-in objects, such as ArrayBuffer, Map, and Set, 3632 * so as to avoid exceptions or crashes caused by type errors. 3633 * 3634 * @syscap SystemCapability.Utils.Lang 3635 * @crossplatform 3636 * @atomicservice 3637 * @since 12 3638 */ 3639 class types { 3640 /** 3641 * The types constructor 3642 * 3643 * @syscap SystemCapability.Utils.Lang 3644 * @since 8 3645 */ 3646 /** 3647 * The types constructor 3648 * 3649 * @syscap SystemCapability.Utils.Lang 3650 * @crossplatform 3651 * @since 10 3652 */ 3653 /** 3654 * A constructor used to create a Types object. 3655 * 3656 * @syscap SystemCapability.Utils.Lang 3657 * @crossplatform 3658 * @atomicservice 3659 * @since 12 3660 */ 3661 constructor(); 3662 /** 3663 * Check whether the entered value is of arraybuffer or sharedarraybuffer type. 3664 * 3665 * @param { Object } value - A ArrayBuffer or SharedArrayBuffer value 3666 * @returns { boolean } Returns true if the value is a built-in ArrayBuffer or SharedArrayBuffer instance. 3667 * @syscap SystemCapability.Utils.Lang 3668 * @since 8 3669 */ 3670 /** 3671 * Check whether the entered value is of arraybuffer or sharedarraybuffer type. 3672 * 3673 * @param { Object } value - A ArrayBuffer or SharedArrayBuffer value 3674 * @returns { boolean } Returns true if the value is a built-in ArrayBuffer or SharedArrayBuffer instance. 3675 * @syscap SystemCapability.Utils.Lang 3676 * @crossplatform 3677 * @since 10 3678 */ 3679 /** 3680 * Checks whether the input value is of the ArrayBuffer or SharedArrayBuffer type. 3681 * 3682 * @param { Object } value - Object to check. 3683 * @returns { boolean } Returns true if the value is a built-in ArrayBuffer or SharedArrayBuffer instance. 3684 * @syscap SystemCapability.Utils.Lang 3685 * @crossplatform 3686 * @atomicservice 3687 * @since 12 3688 */ 3689 isAnyArrayBuffer(value: Object): boolean; 3690 /** 3691 * Check whether the type is included in the isAnyArrayBuffer. 3692 * 3693 * @param { Object } value - A included in the isAnyArrayBuffer value 3694 * @returns { boolean } Returns true if the value is an instance of one of the ArrayBuffer views, 3695 * such as typed array objects or DataView. 3696 * @syscap SystemCapability.Utils.Lang 3697 * @since 8 3698 */ 3699 /** 3700 * Check whether the type is included in the isAnyArrayBuffer. 3701 * 3702 * @param { Object } value - A included in the isAnyArrayBuffer value 3703 * @returns { boolean } Returns true if the value is an instance of one of the ArrayBuffer views, 3704 * such as typed array objects or DataView. 3705 * @syscap SystemCapability.Utils.Lang 3706 * @crossplatform 3707 * @since 10 3708 */ 3709 /** 3710 * Checks whether the input value is of the ArrayBufferView type. 3711 * 3712 * @param { Object } value - Object to check. 3713 * @returns { boolean } Returns true if the value is an instance of one of the ArrayBuffer views, 3714 * such as typed array objects or DataView. 3715 * @syscap SystemCapability.Utils.Lang 3716 * @crossplatform 3717 * @atomicservice 3718 * @since 12 3719 */ 3720 isArrayBufferView(value: Object): boolean; 3721 /** 3722 * Check whether the entered value is an arguments object type. 3723 * 3724 * @param { Object } value - A arguments value 3725 * @returns { boolean } Returns true if the value is an arguments object. 3726 * @syscap SystemCapability.Utils.Lang 3727 * @since 8 3728 */ 3729 /** 3730 * Check whether the entered value is an arguments object type. 3731 * 3732 * @param { Object } value - A arguments value 3733 * @returns { boolean } Returns true if the value is an arguments object. 3734 * @syscap SystemCapability.Utils.Lang 3735 * @crossplatform 3736 * @since 10 3737 */ 3738 /** 3739 * Checks whether the input value is an arguments object. 3740 * 3741 * @param { Object } value - Object to check. 3742 * @returns { boolean } Returns true if the value is an arguments object. 3743 * @syscap SystemCapability.Utils.Lang 3744 * @crossplatform 3745 * @atomicservice 3746 * @since 12 3747 */ 3748 isArgumentsObject(value: Object): boolean; 3749 /** 3750 * Check whether the entered value is of arraybuffer type. 3751 * 3752 * @param { Object } value - A arraybuffer value 3753 * @returns { boolean } Returns true if the value is a built-in ArrayBuffer instance. This does not include SharedArrayBuffer instances. 3754 * Usually, it is desirable to test for both; See isAnyArrayBuffer() for that. 3755 * @syscap SystemCapability.Utils.Lang 3756 * @since 8 3757 */ 3758 /** 3759 * Check whether the entered value is of arraybuffer type. 3760 * 3761 * @param { Object } value - A arraybuffer value 3762 * @returns { boolean } Returns true if the value is a built-in ArrayBuffer instance. This does not include SharedArrayBuffer instances. 3763 * Usually, it is desirable to test for both; See isAnyArrayBuffer() for that. 3764 * @syscap SystemCapability.Utils.Lang 3765 * @crossplatform 3766 * @since 10 3767 */ 3768 /** 3769 * Checks whether the input value is of the ArrayBuffer type. 3770 * 3771 * @param { Object } value - Object to check. 3772 * @returns { boolean } Returns true if the value is a built-in ArrayBuffer instance. This does not include SharedArrayBuffer instances. 3773 * Usually, it is desirable to test for both; See isAnyArrayBuffer() for that. 3774 * @syscap SystemCapability.Utils.Lang 3775 * @crossplatform 3776 * @atomicservice 3777 * @since 12 3778 */ 3779 isArrayBuffer(value: Object): boolean; 3780 /** 3781 * Check whether the value entered is an asynchronous function type. 3782 * 3783 * @param { Object } value - A async function value 3784 * @returns { boolean } Returns true if the value is an async function. This only reports back what the JavaScript engine is seeing; 3785 * in particular, the return value may not match the original source code if a transpilation tool was used. 3786 * @syscap SystemCapability.Utils.Lang 3787 * @since 8 3788 */ 3789 /** 3790 * Check whether the value entered is an asynchronous function type. 3791 * 3792 * @param { Object } value - A async function value 3793 * @returns { boolean } Returns true if the value is an async function. This only reports back what the JavaScript engine is seeing; 3794 * in particular, the return value may not match the original source code if a transpilation tool was used. 3795 * @syscap SystemCapability.Utils.Lang 3796 * @crossplatform 3797 * @since 10 3798 */ 3799 /** 3800 * Checks whether the input value is an asynchronous function. 3801 * 3802 * @param { Object } value - Object to check. 3803 * @returns { boolean } Returns true if the value is an async function. This only reports back what the JavaScript engine is seeing; 3804 * in particular, the return value may not match the original source code if a transpilation tool was used. 3805 * @syscap SystemCapability.Utils.Lang 3806 * @crossplatform 3807 * @atomicservice 3808 * @since 12 3809 */ 3810 isAsyncFunction(value: Object): boolean; 3811 /** 3812 * Check whether the entered value is of bigint64array array type. 3813 * 3814 * @param { Object } value - A BigInt64Array value 3815 * @returns { boolean } Returns true if the value is a BigInt64Array instance. 3816 * @syscap SystemCapability.Utils.Lang 3817 * @since 8 3818 */ 3819 /** 3820 * Check whether the entered value is of bigint64array array type. 3821 * 3822 * @param { Object } value - A BigInt64Array value 3823 * @returns { boolean } Returns true if the value is a BigInt64Array instance. 3824 * @syscap SystemCapability.Utils.Lang 3825 * @crossplatform 3826 * @since 10 3827 */ 3828 /** 3829 * Checks whether the input value is of the BigInt64Array type. 3830 * 3831 * @param { Object } value - Object to check. 3832 * @returns { boolean } Returns true if the value is a BigInt64Array instance. 3833 * @syscap SystemCapability.Utils.Lang 3834 * @crossplatform 3835 * @atomicservice 3836 * @since 12 3837 */ 3838 isBigInt64Array(value: Object): boolean; 3839 /** 3840 * Check whether the entered value is of biguint64array array array type. 3841 * 3842 * @param { Object } value - A BigUint64Array value 3843 * @returns { boolean } Returns true if the value is a BigUint64Array instance. 3844 * @syscap SystemCapability.Utils.Lang 3845 * @since 8 3846 */ 3847 /** 3848 * Check whether the entered value is of biguint64array array array type. 3849 * 3850 * @param { Object } value - A BigUint64Array value 3851 * @returns { boolean } Returns true if the value is a BigUint64Array instance. 3852 * @syscap SystemCapability.Utils.Lang 3853 * @crossplatform 3854 * @since 10 3855 */ 3856 /** 3857 * Checks whether the input value is of the BigUint64Array type. 3858 * 3859 * @param { Object } value - Object to check. 3860 * @returns { boolean } Returns true if the value is a BigUint64Array instance. 3861 * @syscap SystemCapability.Utils.Lang 3862 * @crossplatform 3863 * @atomicservice 3864 * @since 12 3865 */ 3866 isBigUint64Array(value: Object): boolean; 3867 /** 3868 * Check whether the entered value is a Boolean object type. 3869 * 3870 * @param { Object } value - A boolean object value 3871 * @returns { boolean } Returns true if the value is a boolean object, e.g. created by new Boolean(). 3872 * @syscap SystemCapability.Utils.Lang 3873 * @since 8 3874 */ 3875 /** 3876 * Check whether the entered value is a Boolean object type. 3877 * 3878 * @param { Object } value - A boolean object value 3879 * @returns { boolean } Returns true if the value is a boolean object, e.g. created by new Boolean(). 3880 * @syscap SystemCapability.Utils.Lang 3881 * @crossplatform 3882 * @since 10 3883 */ 3884 /** 3885 * Check whether the entered value is a Boolean object type. 3886 * 3887 * @param { Object } value - A boolean object value 3888 * @returns { boolean } Returns true if the value is a boolean object, e.g. created by new Boolean(). 3889 * @syscap SystemCapability.Utils.Lang 3890 * @crossplatform 3891 * @atomicservice 3892 * @since 12 3893 * @deprecated since 14 3894 */ 3895 isBooleanObject(value: Object): boolean; 3896 /** 3897 * Check whether the entered value is a Boolean or number or string or symbol object type. 3898 * 3899 * @param { Object } value - A boxed primitive object value 3900 * @returns { boolean } Returns true if the value is any boxed primitive object, e.g. created by new Boolean(), new String() or Object(Symbol()). 3901 * @syscap SystemCapability.Utils.Lang 3902 * @since 8 3903 */ 3904 /** 3905 * Check whether the entered value is a Boolean or number or string or symbol object type. 3906 * 3907 * @param { Object } value - A boxed primitive object value 3908 * @returns { boolean } Returns true if the value is any boxed primitive object, e.g. created by new Boolean(), new String() or Object(Symbol()). 3909 * @syscap SystemCapability.Utils.Lang 3910 * @crossplatform 3911 * @since 10 3912 */ 3913 /** 3914 * Check whether the entered value is a Boolean or number or string or symbol object type. 3915 * 3916 * @param { Object } value - A boxed primitive object value 3917 * @returns { boolean } Returns true if the value is any boxed primitive object, e.g. created by new Boolean(), new String() or Object(Symbol()). 3918 * @syscap SystemCapability.Utils.Lang 3919 * @crossplatform 3920 * @atomicservice 3921 * @since 12 3922 * @deprecated since 14 3923 */ 3924 isBoxedPrimitive(value: Object): boolean; 3925 /** 3926 * Check whether the entered value is of DataView type. 3927 * 3928 * @param { Object } value - A DataView value 3929 * @returns { boolean } Returns true if the value is a built-in DataView instance. 3930 * @syscap SystemCapability.Utils.Lang 3931 * @since 8 3932 */ 3933 /** 3934 * Check whether the entered value is of DataView type. 3935 * 3936 * @param { Object } value - A DataView value 3937 * @returns { boolean } Returns true if the value is a built-in DataView instance. 3938 * @syscap SystemCapability.Utils.Lang 3939 * @crossplatform 3940 * @since 10 3941 */ 3942 /** 3943 * Checks whether the input value is of the DataView type. 3944 * 3945 * @param { Object } value - Object to check. 3946 * @returns { boolean } Returns true if the value is a built-in DataView instance. 3947 * @syscap SystemCapability.Utils.Lang 3948 * @crossplatform 3949 * @atomicservice 3950 * @since 12 3951 */ 3952 isDataView(value: Object): boolean; 3953 /** 3954 * Check whether the entered value is of type date. 3955 * 3956 * @param { Object } value - A Date value 3957 * @returns { boolean } Returns true if the value is a built-in Date instance. 3958 * @syscap SystemCapability.Utils.Lang 3959 * @since 8 3960 */ 3961 /** 3962 * Check whether the entered value is of type date. 3963 * 3964 * @param { Object } value - A Date value 3965 * @returns { boolean } Returns true if the value is a built-in Date instance. 3966 * @syscap SystemCapability.Utils.Lang 3967 * @crossplatform 3968 * @since 10 3969 */ 3970 /** 3971 * Checks whether the input value is of the Date type. 3972 * 3973 * @param { Object } value -Object to check. 3974 * @returns { boolean } Returns true if the value is a built-in Date instance. 3975 * @syscap SystemCapability.Utils.Lang 3976 * @crossplatform 3977 * @atomicservice 3978 * @since 12 3979 */ 3980 isDate(value: Object): boolean; 3981 /** 3982 * Check whether the entered value is a native external value type. 3983 * 3984 * @param { Object } value - A External value 3985 * @returns { boolean } Returns true if the value is a native External value. 3986 * @syscap SystemCapability.Utils.Lang 3987 * @since 8 3988 */ 3989 /** 3990 * Check whether the entered value is a native external value type. 3991 * 3992 * @param { Object } value - A External value 3993 * @returns { boolean } Returns true if the value is a native External value. 3994 * @syscap SystemCapability.Utils.Lang 3995 * @crossplatform 3996 * @since 10 3997 */ 3998 /** 3999 * Checks whether the input value is of the native external type. 4000 * 4001 * @param { Object } value - Object to check. 4002 * @returns { boolean } Returns true if the value is a native External value. 4003 * @syscap SystemCapability.Utils.Lang 4004 * @crossplatform 4005 * @atomicservice 4006 * @since 12 4007 */ 4008 isExternal(value: Object): boolean; 4009 /** 4010 * Check whether the entered value is of float32array array type. 4011 * 4012 * @param { Object } value - A Float32Array value 4013 * @returns { boolean } Returns true if the value is a built-in Float32Array instance. 4014 * @syscap SystemCapability.Utils.Lang 4015 * @since 8 4016 */ 4017 /** 4018 * Check whether the entered value is of float32array array type. 4019 * 4020 * @param { Object } value - A Float32Array value 4021 * @returns { boolean } Returns true if the value is a built-in Float32Array instance. 4022 * @syscap SystemCapability.Utils.Lang 4023 * @crossplatform 4024 * @since 10 4025 */ 4026 /** 4027 * Checks whether the input value is of the Float32Array type. 4028 * 4029 * @param { Object } value - Object to check. 4030 * @returns { boolean } Returns true if the value is a built-in Float32Array instance. 4031 * @syscap SystemCapability.Utils.Lang 4032 * @crossplatform 4033 * @atomicservice 4034 * @since 12 4035 */ 4036 isFloat32Array(value: Object): boolean; 4037 /** 4038 * Check whether the entered value is of float64array array type. 4039 * 4040 * @param { Object } value - A Float64Array value 4041 * @returns { boolean } Returns true if the value is a built-in Float64Array instance. 4042 * @syscap SystemCapability.Utils.Lang 4043 * @since 8 4044 */ 4045 /** 4046 * Check whether the entered value is of float64array array type. 4047 * 4048 * @param { Object } value - A Float64Array value 4049 * @returns { boolean } Returns true if the value is a built-in Float64Array instance. 4050 * @syscap SystemCapability.Utils.Lang 4051 * @crossplatform 4052 * @since 10 4053 */ 4054 /** 4055 * Checks whether the input value is of the Float64Array type. 4056 * 4057 * @param { Object } value - Object to check. 4058 * @returns { boolean } Returns true if the value is a built-in Float64Array instance. 4059 * @syscap SystemCapability.Utils.Lang 4060 * @crossplatform 4061 * @atomicservice 4062 * @since 12 4063 */ 4064 isFloat64Array(value: Object): boolean; 4065 /** 4066 * Check whether the input value is a generator function type. 4067 * 4068 * @param { Object } value - A generator function value 4069 * @returns { boolean } Returns true if the value is a generator function. This only reports back what the JavaScript engine is seeing; in particular, 4070 * the return value may not match the original source code if a transpilation tool was used. 4071 * @syscap SystemCapability.Utils.Lang 4072 * @since 8 4073 */ 4074 /** 4075 * Check whether the input value is a generator function type. 4076 * 4077 * @param { Object } value - A generator function value 4078 * @returns { boolean } Returns true if the value is a generator function. This only reports back what the JavaScript engine is seeing; in particular, 4079 * the return value may not match the original source code if a transpilation tool was used. 4080 * @syscap SystemCapability.Utils.Lang 4081 * @crossplatform 4082 * @since 10 4083 */ 4084 /** 4085 * Checks whether the input value is a generator function. 4086 * 4087 * @param { Object } value - Object to check. 4088 * @returns { boolean } Returns true if the value is a generator function. This only reports back what the JavaScript engine is seeing; in particular, 4089 * the return value may not match the original source code if a transpilation tool was used. 4090 * @syscap SystemCapability.Utils.Lang 4091 * @crossplatform 4092 * @atomicservice 4093 * @since 12 4094 */ 4095 isGeneratorFunction(value: Object): boolean; 4096 /** 4097 * Check whether the entered value is a generator object type. 4098 * 4099 * @param { Object } value - A generator object value 4100 * @returns { boolean } Returns true if the value is a generator object as returned from a built-in generator function. 4101 * This only reports back what the JavaScript engine is seeing; in particular, 4102 *the return value may not match the original source code if a transpilation tool was used. 4103 * @syscap SystemCapability.Utils.Lang 4104 * @since 8 4105 */ 4106 /** 4107 * Check whether the entered value is a generator object type. 4108 * 4109 * @param { Object } value - A generator object value 4110 * @returns { boolean } Returns true if the value is a generator object as returned from a built-in generator function. 4111 * This only reports back what the JavaScript engine is seeing; in particular, 4112 *the return value may not match the original source code if a transpilation tool was used. 4113 * @syscap SystemCapability.Utils.Lang 4114 * @crossplatform 4115 * @since 10 4116 */ 4117 /** 4118 * Checks whether the input value is a generator object. 4119 * 4120 * @param { Object } value - Object to check. 4121 * @returns { boolean } Returns true if the value is a generator object as returned from a built-in generator function. 4122 * This only reports back what the JavaScript engine is seeing; in particular, 4123 *the return value may not match the original source code if a transpilation tool was used. 4124 * @syscap SystemCapability.Utils.Lang 4125 * @crossplatform 4126 * @atomicservice 4127 * @since 12 4128 */ 4129 isGeneratorObject(value: Object): boolean; 4130 /** 4131 * Check whether the entered value is of int8array array type. 4132 * 4133 * @param { Object } value - A Int8Array value 4134 * @returns { boolean } Returns true if the value is a built-in Int8Array instance. 4135 * @syscap SystemCapability.Utils.Lang 4136 * @since 8 4137 */ 4138 /** 4139 * Check whether the entered value is of int8array array type. 4140 * 4141 * @param { Object } value - A Int8Array value 4142 * @returns { boolean } Returns true if the value is a built-in Int8Array instance. 4143 * @syscap SystemCapability.Utils.Lang 4144 * @crossplatform 4145 * @since 10 4146 */ 4147 /** 4148 * Checks whether the input value is of the Int8Array type. 4149 * 4150 * @param { Object } value - Object to check. 4151 * @returns { boolean } Returns true if the value is a built-in Int8Array instance. 4152 * @syscap SystemCapability.Utils.Lang 4153 * @crossplatform 4154 * @atomicservice 4155 * @since 12 4156 */ 4157 isInt8Array(value: Object): boolean; 4158 /** 4159 * Check whether the entered value is the int16array type. 4160 * 4161 * @param { Object } value - A Int16Array value 4162 * @returns { boolean } Returns true if the value is a built-in Int16Array instance. 4163 * @syscap SystemCapability.Utils.Lang 4164 * @since 8 4165 */ 4166 /** 4167 * Check whether the entered value is the int16array type. 4168 * 4169 * @param { Object } value - A Int16Array value 4170 * @returns { boolean } Returns true if the value is a built-in Int16Array instance. 4171 * @syscap SystemCapability.Utils.Lang 4172 * @crossplatform 4173 * @since 10 4174 */ 4175 /** 4176 * Checks whether the input value is of the Int16Array type. 4177 * 4178 * @param { Object } value - Object to check. 4179 * @returns { boolean } Returns true if the value is a built-in Int16Array instance. 4180 * @syscap SystemCapability.Utils.Lang 4181 * @crossplatform 4182 * @atomicservice 4183 * @since 12 4184 */ 4185 isInt16Array(value: Object): boolean; 4186 /** 4187 * Check whether the entered value is the int32array array type. 4188 * 4189 * @param { Object } value - A Int32Array value 4190 * @returns { boolean } Returns true if the value is a built-in Int32Array instance. 4191 * @syscap SystemCapability.Utils.Lang 4192 * @since 8 4193 */ 4194 /** 4195 * Check whether the entered value is the int32array array type. 4196 * 4197 * @param { Object } value - A Int32Array value 4198 * @returns { boolean } Returns true if the value is a built-in Int32Array instance. 4199 * @syscap SystemCapability.Utils.Lang 4200 * @crossplatform 4201 * @since 10 4202 */ 4203 /** 4204 * Checks whether the input value is of the Int32Array type. 4205 * 4206 * @param { Object } value - Object to check. 4207 * @returns { boolean } Returns true if the value is a built-in Int32Array instance. 4208 * @syscap SystemCapability.Utils.Lang 4209 * @crossplatform 4210 * @atomicservice 4211 * @since 12 4212 */ 4213 isInt32Array(value: Object): boolean; 4214 /** 4215 * Check whether the entered value is of map type. 4216 * 4217 * @param { Object } value - A Map value 4218 * @returns { boolean } Returns true if the value is a built-in Map instance. 4219 * @syscap SystemCapability.Utils.Lang 4220 * @since 8 4221 */ 4222 /** 4223 * Check whether the entered value is of map type. 4224 * 4225 * @param { Object } value - A Map value 4226 * @returns { boolean } Returns true if the value is a built-in Map instance. 4227 * @syscap SystemCapability.Utils.Lang 4228 * @crossplatform 4229 * @since 10 4230 */ 4231 /** 4232 * Checks whether the input value is of the Map type. 4233 * 4234 * @param { Object } value - Object to check. 4235 * @returns { boolean } Returns true if the value is a built-in Map instance. 4236 * @syscap SystemCapability.Utils.Lang 4237 * @crossplatform 4238 * @atomicservice 4239 * @since 12 4240 */ 4241 isMap(value: Object): boolean; 4242 /** 4243 * Check whether the entered value is the iterator type of map. 4244 * 4245 * @param { Object } value - A Map iterator value 4246 * @returns { boolean } Returns true if the value is an iterator returned for a built-in Map instance. 4247 * @syscap SystemCapability.Utils.Lang 4248 * @since 8 4249 */ 4250 /** 4251 * Check whether the entered value is the iterator type of map. 4252 * 4253 * @param { Object } value - A Map iterator value 4254 * @returns { boolean } Returns true if the value is an iterator returned for a built-in Map instance. 4255 * @syscap SystemCapability.Utils.Lang 4256 * @crossplatform 4257 * @since 10 4258 */ 4259 /** 4260 * Checks whether the input value is of the MapIterator type. 4261 * 4262 * @param { Object } value - Object to check. 4263 * @returns { boolean } Returns true if the value is an iterator returned for a built-in Map instance. 4264 * @syscap SystemCapability.Utils.Lang 4265 * @crossplatform 4266 * @atomicservice 4267 * @since 12 4268 */ 4269 isMapIterator(value: Object): boolean; 4270 /** 4271 * Check whether the entered value is the module namespace object object type. 4272 * 4273 * @param { Object } value - A Module Namespace Object value 4274 * @returns { boolean } Returns true if the value is an instance of a Module Namespace Object. 4275 * @syscap SystemCapability.Utils.Lang 4276 * @since 8 4277 */ 4278 /** 4279 * Check whether the entered value is the module namespace object object type. 4280 * 4281 * @param { Object } value - A Module Namespace Object value 4282 * @returns { boolean } Returns true if the value is an instance of a Module Namespace Object. 4283 * @syscap SystemCapability.Utils.Lang 4284 * @crossplatform 4285 * @since 10 4286 */ 4287 /** 4288 * Checks whether the input value is a module namespace object. 4289 * 4290 * @param { Object } value - Object to check. 4291 * @returns { boolean } Returns true if the value is an instance of a Module Namespace Object. 4292 * @syscap SystemCapability.Utils.Lang 4293 * @crossplatform 4294 * @atomicservice 4295 * @since 12 4296 */ 4297 isModuleNamespaceObject(value: Object): boolean; 4298 /** 4299 * Check whether the value entered is of type error. 4300 * 4301 * @param { Object } value - A Error value 4302 * @returns { boolean } Returns true if the value is an instance of a built-in Error type. 4303 * @syscap SystemCapability.Utils.Lang 4304 * @since 8 4305 */ 4306 /** 4307 * Check whether the value entered is of type error. 4308 * 4309 * @param { Object } value - A Error value 4310 * @returns { boolean } Returns true if the value is an instance of a built-in Error type. 4311 * @syscap SystemCapability.Utils.Lang 4312 * @crossplatform 4313 * @since 10 4314 */ 4315 /** 4316 * Checks whether the input value is of the Error type. 4317 * 4318 * @param { Object } value - Object to check. 4319 * @returns { boolean } Returns true if the value is an instance of a built-in Error type. 4320 * @syscap SystemCapability.Utils.Lang 4321 * @crossplatform 4322 * @atomicservice 4323 * @since 12 4324 */ 4325 isNativeError(value: Object): boolean; 4326 /** 4327 * Check whether the entered value is of the number object type. 4328 * 4329 * @param { Object } value - A number object value 4330 * @returns { boolean } Returns true if the value is a number object, e.g. created by new Number(). 4331 * @syscap SystemCapability.Utils.Lang 4332 * @since 8 4333 */ 4334 /** 4335 * Check whether the entered value is of the number object type. 4336 * 4337 * @param { Object } value - A number object value 4338 * @returns { boolean } Returns true if the value is a number object, e.g. created by new Number(). 4339 * @syscap SystemCapability.Utils.Lang 4340 * @crossplatform 4341 * @since 10 4342 */ 4343 /** 4344 * Check whether the entered value is of the number object type. 4345 * 4346 * @param { Object } value - A number object value 4347 * @returns { boolean } Returns true if the value is a number object, e.g. created by new Number(). 4348 * @syscap SystemCapability.Utils.Lang 4349 * @crossplatform 4350 * @atomicservice 4351 * @since 12 4352 * @deprecated since 14 4353 */ 4354 isNumberObject(value: Object): boolean; 4355 /** 4356 * Check whether the entered value is of promise type. 4357 * 4358 * @param { Object } value - A Promise value 4359 * @returns { boolean } Returns true if the value is a built-in Promise. 4360 * @syscap SystemCapability.Utils.Lang 4361 * @since 8 4362 */ 4363 /** 4364 * Check whether the entered value is of promise type. 4365 * 4366 * @param { Object } value - A Promise value 4367 * @returns { boolean } Returns true if the value is a built-in Promise. 4368 * @syscap SystemCapability.Utils.Lang 4369 * @crossplatform 4370 * @since 10 4371 */ 4372 /** 4373 * Checks whether the input value is a promise. 4374 * 4375 * @param { Object } value - Object to check. 4376 * @returns { boolean } Returns true if the value is a built-in Promise. 4377 * @syscap SystemCapability.Utils.Lang 4378 * @crossplatform 4379 * @atomicservice 4380 * @since 12 4381 */ 4382 isPromise(value: Object): boolean; 4383 /** 4384 * Check whether the value entered is of proxy type. 4385 * 4386 * @param { Object } value - A Proxy value 4387 * @returns { boolean } Returns true if the value is a Proxy instance. 4388 * @syscap SystemCapability.Utils.Lang 4389 * @since 8 4390 */ 4391 /** 4392 * Check whether the value entered is of proxy type. 4393 * 4394 * @param { Object } value - A Proxy value 4395 * @returns { boolean } Returns true if the value is a Proxy instance. 4396 * @syscap SystemCapability.Utils.Lang 4397 * @crossplatform 4398 * @since 10 4399 */ 4400 /** 4401 * Checks whether the input value is a proxy. 4402 * 4403 * @param { Object } value - Object to check. 4404 * @returns { boolean } Returns true if the value is a Proxy instance. 4405 * @syscap SystemCapability.Utils.Lang 4406 * @crossplatform 4407 * @atomicservice 4408 * @since 12 4409 */ 4410 isProxy(value: Object): boolean; 4411 /** 4412 * Check whether the entered value is of type regexp. 4413 * 4414 * @param { Object } value - A regular expression object value 4415 * @returns { boolean } Returns true if the value is a regular expression object. 4416 * @syscap SystemCapability.Utils.Lang 4417 * @since 8 4418 */ 4419 /** 4420 * Check whether the entered value is of type regexp. 4421 * 4422 * @param { Object } value - A regular expression object value 4423 * @returns { boolean } Returns true if the value is a regular expression object. 4424 * @syscap SystemCapability.Utils.Lang 4425 * @crossplatform 4426 * @since 10 4427 */ 4428 /** 4429 * Checks whether the input value is of the RegExp type. 4430 * 4431 * @param { Object } value - Object to check. 4432 * @returns { boolean } Returns true if the value is a regular expression object. 4433 * @syscap SystemCapability.Utils.Lang 4434 * @crossplatform 4435 * @atomicservice 4436 * @since 12 4437 */ 4438 isRegExp(value: Object): boolean; 4439 /** 4440 * Check whether the entered value is of type set. 4441 * 4442 * @param { Object } value - A Set instance value 4443 * @returns { boolean } Returns true if the value is a built-in Set instance. 4444 * @syscap SystemCapability.Utils.Lang 4445 * @since 8 4446 */ 4447 /** 4448 * Check whether the entered value is of type set. 4449 * 4450 * @param { Object } value - A Set instance value 4451 * @returns { boolean } Returns true if the value is a built-in Set instance. 4452 * @syscap SystemCapability.Utils.Lang 4453 * @crossplatform 4454 * @since 10 4455 */ 4456 /** 4457 * Checks whether the input value is of the Set type. 4458 * 4459 * @param { Object } value - Object to check. 4460 * @returns { boolean } Returns true if the value is a built-in Set instance. 4461 * @syscap SystemCapability.Utils.Lang 4462 * @crossplatform 4463 * @atomicservice 4464 * @since 12 4465 */ 4466 isSet(value: Object): boolean; 4467 /** 4468 * Check whether the entered value is the iterator type of set. 4469 * 4470 * @param { Object } value - A Set iterator value 4471 * @returns { boolean } Returns true if the value is an iterator returned for a built-in Set instance. 4472 * @syscap SystemCapability.Utils.Lang 4473 * @since 8 4474 */ 4475 /** 4476 * Check whether the entered value is the iterator type of set. 4477 * 4478 * @param { Object } value - A Set iterator value 4479 * @returns { boolean } Returns true if the value is an iterator returned for a built-in Set instance. 4480 * @syscap SystemCapability.Utils.Lang 4481 * @crossplatform 4482 * @since 10 4483 */ 4484 /** 4485 * Checks whether the input value is of the SetIterator type. 4486 * 4487 * @param { Object } value - Object to check. 4488 * @returns { boolean } Returns true if the value is an iterator returned for a built-in Set instance. 4489 * @syscap SystemCapability.Utils.Lang 4490 * @crossplatform 4491 * @atomicservice 4492 * @since 12 4493 */ 4494 isSetIterator(value: Object): boolean; 4495 /** 4496 * Check whether the entered value is of type sharedarraybuffer. 4497 * 4498 * @param { Object } value - A SharedArrayBuffer instance value 4499 * @returns { boolean } Returns true if the value is a built-in SharedArrayBuffer instance. This does not include ArrayBuffer instances. 4500 * Usually, it is desirable to test for both; See isAnyArrayBuffer() for that. 4501 * @syscap SystemCapability.Utils.Lang 4502 * @since 8 4503 */ 4504 /** 4505 * Check whether the entered value is of type sharedarraybuffer. 4506 * 4507 * @param { Object } value - A SharedArrayBuffer instance value 4508 * @returns { boolean } Returns true if the value is a built-in SharedArrayBuffer instance. This does not include ArrayBuffer instances. 4509 * Usually, it is desirable to test for both; See isAnyArrayBuffer() for that. 4510 * @syscap SystemCapability.Utils.Lang 4511 * @crossplatform 4512 * @since 10 4513 */ 4514 /** 4515 * Checks whether the input value is of the SharedArrayBuffer type. 4516 * 4517 * @param { Object } value - Object to check. 4518 * @returns { boolean } Returns true if the value is a built-in SharedArrayBuffer instance. This does not include ArrayBuffer instances. 4519 * Usually, it is desirable to test for both; See isAnyArrayBuffer() for that. 4520 * @syscap SystemCapability.Utils.Lang 4521 * @crossplatform 4522 * @atomicservice 4523 * @since 12 4524 */ 4525 isSharedArrayBuffer(value: Object): boolean; 4526 /** 4527 * Check whether the entered value is a string object type. 4528 * 4529 * @param { Object } value - A String object value 4530 * @returns { boolean } Returns true if the value is a string object, e.g. created by new String(). 4531 * @syscap SystemCapability.Utils.Lang 4532 * @since 8 4533 */ 4534 /** 4535 * Check whether the entered value is a string object type. 4536 * 4537 * @param { Object } value - A String object value 4538 * @returns { boolean } Returns true if the value is a string object, e.g. created by new String(). 4539 * @syscap SystemCapability.Utils.Lang 4540 * @crossplatform 4541 * @since 10 4542 */ 4543 /** 4544 * Check whether the entered value is a string object type. 4545 * 4546 * @param { Object } value - A String object value 4547 * @returns { boolean } Returns true if the value is a string object, e.g. created by new String(). 4548 * @syscap SystemCapability.Utils.Lang 4549 * @crossplatform 4550 * @atomicservice 4551 * @since 12 4552 * @deprecated since 14 4553 */ 4554 isStringObject(value: Object): boolean; 4555 /** 4556 * Check whether the entered value is a symbol object type. 4557 * 4558 * @param { Object } value - A symbol object value 4559 * @returns { boolean } Returns true if the value is a symbol object, created by calling Object() on a Symbol primitive. 4560 * @syscap SystemCapability.Utils.Lang 4561 * @since 8 4562 */ 4563 /** 4564 * Check whether the entered value is a symbol object type. 4565 * 4566 * @param { Object } value - A symbol object value 4567 * @returns { boolean } Returns true if the value is a symbol object, created by calling Object() on a Symbol primitive. 4568 * @syscap SystemCapability.Utils.Lang 4569 * @crossplatform 4570 * @since 10 4571 */ 4572 /** 4573 * Check whether the entered value is a symbol object type. 4574 * 4575 * @param { Object } value - A symbol object value 4576 * @returns { boolean } Returns true if the value is a symbol object, created by calling Object() on a Symbol primitive. 4577 * @syscap SystemCapability.Utils.Lang 4578 * @crossplatform 4579 * @atomicservice 4580 * @since 12 4581 * @deprecated since 14 4582 */ 4583 isSymbolObject(value: Object): boolean; 4584 /** 4585 * Check whether the entered value is a type contained in typedarray. 4586 * 4587 * @param { Object } value - A TypedArray instance value 4588 * @returns { boolean } Returns true if the value is a built-in TypedArray instance. 4589 * @syscap SystemCapability.Utils.Lang 4590 * @since 8 4591 */ 4592 /** 4593 * Check whether the entered value is a type contained in typedarray. 4594 * 4595 * @param { Object } value - A TypedArray instance value 4596 * @returns { boolean } Returns true if the value is a built-in TypedArray instance. 4597 * @syscap SystemCapability.Utils.Lang 4598 * @crossplatform 4599 * @since 10 4600 */ 4601 /** 4602 * Checks whether the input value is of the TypedArray type. 4603 * 4604 * @param { Object } value - Object to check. 4605 * @returns { boolean } Returns true if the value is a built-in TypedArray instance. 4606 * @syscap SystemCapability.Utils.Lang 4607 * @crossplatform 4608 * @atomicservice 4609 * @since 12 4610 */ 4611 isTypedArray(value: Object): boolean; 4612 /** 4613 * Check whether the entered value is the uint8array array type. 4614 * 4615 * @param { Object } value - A Uint8Array value 4616 * @returns { boolean } Returns true if the value is a built-in Uint8Array instance. 4617 * @syscap SystemCapability.Utils.Lang 4618 * @since 8 4619 */ 4620 /** 4621 * Check whether the entered value is the uint8array array type. 4622 * 4623 * @param { Object } value - A Uint8Array value 4624 * @returns { boolean } Returns true if the value is a built-in Uint8Array instance. 4625 * @syscap SystemCapability.Utils.Lang 4626 * @crossplatform 4627 * @since 10 4628 */ 4629 /** 4630 * Checks whether the input value is of the Uint8Array type. 4631 * 4632 * @param { Object } value - Object to check. 4633 * @returns { boolean } Returns true if the value is a built-in Uint8Array instance. 4634 * @syscap SystemCapability.Utils.Lang 4635 * @crossplatform 4636 * @atomicservice 4637 * @since 12 4638 */ 4639 isUint8Array(value: Object): boolean; 4640 /** 4641 * Check whether the entered value is the uint8clapedarray array type. 4642 * 4643 * @param { Object } value - A Uint8ClampedArray value 4644 * @returns { boolean } Returns true if the value is a built-in Uint8ClampedArray instance. 4645 * @syscap SystemCapability.Utils.Lang 4646 * @since 8 4647 */ 4648 /** 4649 * Check whether the entered value is the uint8clapedarray array type. 4650 * 4651 * @param { Object } value - A Uint8ClampedArray value 4652 * @returns { boolean } Returns true if the value is a built-in Uint8ClampedArray instance. 4653 * @syscap SystemCapability.Utils.Lang 4654 * @crossplatform 4655 * @since 10 4656 */ 4657 /** 4658 * Checks whether the input value is of the Uint8ClampedArray type. 4659 * 4660 * @param { Object } value - Object to check. 4661 * @returns { boolean } Returns true if the value is a built-in Uint8ClampedArray instance. 4662 * @syscap SystemCapability.Utils.Lang 4663 * @crossplatform 4664 * @atomicservice 4665 * @since 12 4666 */ 4667 isUint8ClampedArray(value: Object): boolean; 4668 /** 4669 * Check whether the entered value is the uint16array array array type. 4670 * 4671 * @param { Object } value - A Uint16Array value 4672 * @returns { boolean } Returns true if the value is a built-in Uint16Array instance. 4673 * @syscap SystemCapability.Utils.Lang 4674 * @since 8 4675 */ 4676 /** 4677 * Check whether the entered value is the uint16array array array type. 4678 * 4679 * @param { Object } value - A Uint16Array value 4680 * @returns { boolean } Returns true if the value is a built-in Uint16Array instance. 4681 * @syscap SystemCapability.Utils.Lang 4682 * @crossplatform 4683 * @since 10 4684 */ 4685 /** 4686 * Checks whether the input value is of the Uint16Array type. 4687 * 4688 * @param { Object } value - Object to check. 4689 * @returns { boolean } Returns true if the value is a built-in Uint16Array instance. 4690 * @syscap SystemCapability.Utils.Lang 4691 * @crossplatform 4692 * @atomicservice 4693 * @since 12 4694 */ 4695 isUint16Array(value: Object): boolean; 4696 /** 4697 * Check whether the entered value is the uint32array array type. 4698 * 4699 * @param { Object } value - A Uint32Array value 4700 * @returns { boolean } Returns true if the value is a built-in Uint32Array instance. 4701 * @syscap SystemCapability.Utils.Lang 4702 * @since 8 4703 */ 4704 /** 4705 * Check whether the entered value is the uint32array array type. 4706 * 4707 * @param { Object } value - A Uint32Array value 4708 * @returns { boolean } Returns true if the value is a built-in Uint32Array instance. 4709 * @syscap SystemCapability.Utils.Lang 4710 * @crossplatform 4711 * @since 10 4712 */ 4713 /** 4714 * Checks whether the input value is of the Uint32Array type. 4715 * 4716 * @param { Object } value - Object to check. 4717 * @returns { boolean } Returns true if the value is a built-in Uint32Array instance. 4718 * @syscap SystemCapability.Utils.Lang 4719 * @crossplatform 4720 * @atomicservice 4721 * @since 12 4722 */ 4723 isUint32Array(value: Object): boolean; 4724 /** 4725 * Check whether the entered value is of type weakmap. 4726 * 4727 * @param { Object } value - A WeakMap value 4728 * @returns { boolean } Returns true if the value is a built-in WeakMap instance. 4729 * @syscap SystemCapability.Utils.Lang 4730 * @since 8 4731 */ 4732 /** 4733 * Check whether the entered value is of type weakmap. 4734 * 4735 * @param { Object } value - A WeakMap value 4736 * @returns { boolean } Returns true if the value is a built-in WeakMap instance. 4737 * @syscap SystemCapability.Utils.Lang 4738 * @crossplatform 4739 * @since 10 4740 */ 4741 /** 4742 * Checks whether the input value is of the WeakMap type. 4743 * 4744 * @param { Object } value - Object to check. 4745 * @returns { boolean } Returns true if the value is a built-in WeakMap instance. 4746 * @syscap SystemCapability.Utils.Lang 4747 * @crossplatform 4748 * @atomicservice 4749 * @since 12 4750 */ 4751 isWeakMap(value: Object): boolean; 4752 /** 4753 * Check whether the entered value is of type weakset. 4754 * 4755 * @param { Object } value - A WeakSet value 4756 * @returns { boolean } Returns true if the value is a built-in WeakSet instance. 4757 * @syscap SystemCapability.Utils.Lang 4758 * @since 8 4759 */ 4760 /** 4761 * Check whether the entered value is of type weakset. 4762 * 4763 * @param { Object } value - A WeakSet value 4764 * @returns { boolean } Returns true if the value is a built-in WeakSet instance. 4765 * @syscap SystemCapability.Utils.Lang 4766 * @crossplatform 4767 * @since 10 4768 */ 4769 /** 4770 * Checks whether the input value is of the WeakSet type. 4771 * 4772 * @param { Object } value - Object to check. 4773 * @returns { boolean } Returns true if the value is a built-in WeakSet instance. 4774 * @syscap SystemCapability.Utils.Lang 4775 * @crossplatform 4776 * @atomicservice 4777 * @since 12 4778 */ 4779 isWeakSet(value: Object): boolean; 4780 } 4781 /** 4782 * Insert before/after logic into a class method or replace implementation for a class method. 4783 * 4784 * @syscap SystemCapability.Utils.Lang 4785 * @crossplatform 4786 * @since 11 4787 */ 4788 /** 4789 * Insert before/after logic into a class method or replace implementation for a class method. 4790 * 4791 * @syscap SystemCapability.Utils.Lang 4792 * @crossplatform 4793 * @atomicservice 4794 * @since 12 4795 */ 4796 class Aspect { 4797 /** 4798 * Insert some logic before the method. In implementation the method will be replaced with a new function, 4799 * which will execute 'before' with the args 'this' and the args of the original method, and then execute 4800 * the original method. The return value of the new function is returned by the original method. 4801 * 4802 * @param { Object } targetClass - The operated class. 4803 * @param { string } methodName - The name of the operated method. 4804 * @param { boolean } isStatic - The flag whether the method is static. 4805 * @param { Function } before - The logic inserted before the method. 4806 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4807 * 1.Mandatory parameters are left unspecified; 4808 * 2.Incorrect parameter types. 4809 * @syscap SystemCapability.Utils.Lang 4810 * @crossplatform 4811 * @since 11 4812 */ 4813 /** 4814 * Inserts a function before a method of a class object. The inserted function is executed in prior to the original method of the class object. 4815 * 4816 * @param { Object } targetClass - Target class object. 4817 * @param { string } methodName - Name of the method. Read-only methods are not supported. 4818 * @param { boolean } isStatic - Whether the method is a static method. 4819 * @param { Function } before - Function to insert. 4820 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4821 * 1.Mandatory parameters are left unspecified; 4822 * 2.Incorrect parameter types. 4823 * @syscap SystemCapability.Utils.Lang 4824 * @crossplatform 4825 * @atomicservice 4826 * @since 12 4827 */ 4828 static addBefore(targetClass: Object, methodName: string, isStatic: boolean, before: Function): void; 4829 /** 4830 * Insert some logic after the method. In implementation the method will be replaced with a new function, 4831 * which will execute the original method, and then execute 'after' with the args 'this' and the return value of 4832 * the original method, and the args of the original method. The return value of the new function is returned by 'after'. 4833 * 4834 * @param { Object } targetClass - The operated class. 4835 * @param { string } methodName - The name of the operated method. 4836 * @param { boolean } isStatic - The flag whether the method is static. 4837 * @param { Function } after - The logic inserted after the method. 4838 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4839 * 1.Mandatory parameters are left unspecified; 4840 * 2.Incorrect parameter types. 4841 * @syscap SystemCapability.Utils.Lang 4842 * @crossplatform 4843 * @since 11 4844 */ 4845 /** 4846 * Inserts a function after a method of a class object. The final return value is the return value of the function inserted. 4847 * 4848 * @param { Object } targetClass - Target class object. 4849 * @param { string } methodName - Name of the method. Read-only methods are not supported. 4850 * @param { boolean } isStatic - Whether the method is a static method. 4851 * @param { Function } after - Function to insert. 4852 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4853 * 1.Mandatory parameters are left unspecified; 4854 * 2.Incorrect parameter types. 4855 * @syscap SystemCapability.Utils.Lang 4856 * @crossplatform 4857 * @atomicservice 4858 * @since 12 4859 */ 4860 static addAfter(targetClass: Object, methodName: string, isStatic: boolean, after: Function): void; 4861 /** 4862 * Replace the original method with a new function, which will execute 'instead' with the args 'this' and the args 4863 * of the original method. The return value of the new function is returned by 'instead'. 4864 * 4865 * @param { Object } targetClass - The operated class. 4866 * @param { string } methodName - The name of the operated method. 4867 * @param { boolean } isStatic - The flag whether the method is static. 4868 * @param { Function } instead - The logic replaced with the method. 4869 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4870 * 1.Mandatory parameters are left unspecified; 4871 * 2.Incorrect parameter types. 4872 * @syscap SystemCapability.Utils.Lang 4873 * @crossplatform 4874 * @since 11 4875 */ 4876 /** 4877 * Replaces a method of a class object with another function. After the replacement, only the new function logic 4878 * is executed. The final return value is the return value of the new function. 4879 * 4880 * @param { Object } targetClass - Target class object. 4881 * @param { string } methodName - Name of the method. Read-only methods are not supported. 4882 * @param { boolean } isStatic - Whether the method is a static method. 4883 * @param { Function } instead - Function to be used replacement. 4884 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4885 * 1.Mandatory parameters are left unspecified; 4886 * 2.Incorrect parameter types. 4887 * @syscap SystemCapability.Utils.Lang 4888 * @crossplatform 4889 * @atomicservice 4890 * @since 12 4891 */ 4892 static replace(targetClass: Object, methodName: string, isStatic: boolean, instead: Function) : void; 4893 } 4894 /** 4895 * Provide the ability to decode binary streams into strings. The supported encoding types include: utf-8, iso-8859-2, 4896 * koi8-r, macintosh, windows-1250, windows-1251, gbk, gb18030, big5, utf-16be, utf-16 le, etc. 4897 * 4898 * @syscap SystemCapability.Utils.Lang 4899 * @crossplatform 4900 * @atomicservice 4901 * @since 12 4902 */ 4903 class StringDecoder { 4904 /** 4905 * Constructor used to create a StringDecoder instance. 4906 * 4907 * @param { string } [encoding] - Encoding type of the input data. The default value is utf-8. 4908 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4909 * 1.Mandatory parameters are left unspecified; 4910 * 2.Incorrect parameter types; 4911 * @syscap SystemCapability.Utils.Lang 4912 * @crossplatform 4913 * @atomicservice 4914 * @since 12 4915 */ 4916 constructor(encoding?: string); 4917 /** 4918 * Returns a decoded string, Any incomplete multi-byte characters at the end of Uint8Array are filtered out from the 4919 * returned string and stored in an internal buffer for the next call. 4920 * 4921 * @param { string | Uint8Array } chunk - String to decode. Decoding is performed based on the input encoding type. If the input is of the Uint8Array type, 4922 * decoding is performed normally. If the input is of the string type, decoding is performed in the original path. 4923 * @returns { string } Returns a decoded string. 4924 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4925 * 1.Mandatory parameters are left unspecified; 4926 * 2.Incorrect parameter types; 4927 * @syscap SystemCapability.Utils.Lang 4928 * @crossplatform 4929 * @atomicservice 4930 * @since 12 4931 */ 4932 write(chunk: string | Uint8Array): string; 4933 /** 4934 * Ends the decoding process and returns any remaining input stored in the internal buffer as a string. 4935 * 4936 * @param { string | Uint8Array } [chunk] - String to decode. The default value is undefined. 4937 * @returns { string } Returns any remaining input stored in the internal buffer as a string. 4938 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4939 * 1.Mandatory parameters are left unspecified; 4940 * 2.Incorrect parameter types; 4941 * @syscap SystemCapability.Utils.Lang 4942 * @crossplatform 4943 * @atomicservice 4944 * @since 12 4945 */ 4946 end(chunk?: string | Uint8Array): string; 4947 } 4948} 4949export default util; 4950