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 * TextDecoder support full encoding in ICU data utf-8 utf-16 iso8859 must support in all device, TextEncoder takes a 40 * stream of code points as input and emits a stream of UTF-8 bytes, and system help function. 41 * 42 * @namespace util 43 * @syscap SystemCapability.Utils.Lang 44 * @crossplatform 45 * @atomicservice 46 * @since 11 47 */ 48declare namespace util { 49 /** 50 * %s: String will be used to convert all values except BigInt, Object and -0. BigInt values will be represented 51 * with an n and Objects that have no user defined toString function are inspected using util.inspect() with 52 * options { depth: 0, colors: false, compact: 3 }. 53 * %d: Number will be used to convert all values except BigInt and Symbol. 54 * %i: parseInt(value, 10) is used for all values except BigInt and Symbol. 55 * %f: parseFloat(value) is used for all values except Bigint and Symbol. 56 * %j: JSON. Replaced with the string '[Circular]' if the argument contains circular references. 57 * %o: Object. A string representation of an object with generic JavaScript object formatting.Similar to 58 * util.inspect() with options { showHidden: true, showProxy: true}. This will show the full object including 59 * non-enumerable properties and proxies. 60 * %O: Object. A string representation of an object with generic JavaScript object formatting. 61 * %O: Object. A string representation of an object with generic JavaScript object formatting.Similar to 62 * util.inspect() without options. This will show the full object not including non-enumerable properties and 63 * proxies. 64 * %c: CSS. This specifier is ignored and will skip any CSS passed in. 65 * %%: single percent sign ('%'). This does not consume an argument.Returns: <string> The formatted string. 66 * 67 * @param { string } format - Styled string 68 * @param { Object[] } args - Data to be formatted 69 * @returns { string } Return the character string formatted in a specific format 70 * @syscap SystemCapability.Utils.Lang 71 * @since 7 72 * @deprecated since 9 73 * @useinstead ohos.util.format 74 */ 75 function printf(format: string, ...args: Object[]): string; 76 77 /** 78 * %s: String will be used to convert all values except BigInt, Object and -0. BigInt values will be represented 79 * with an n and Objects that have no user defined toString function are inspected using util.inspect() with 80 * options { depth: 0, colors: false, compact: 3 }. 81 * %d: Number will be used to convert all values except BigInt and Symbol. 82 * %i: parseInt(value, 10) is used for all values except BigInt and Symbol. 83 * %f: parseFloat(value) is used for all values except Bigint and Symbol. 84 * %j: JSON. Replaced with the string '[Circular]' if the argument contains circular references. 85 * %o: Object. A string representation of an object with generic JavaScript object formatting.Similar to 86 * util.inspect() with options { showHidden: true, showProxy: true}. This will show the full object including 87 * non-enumerable properties and proxies. 88 * %O: Object. A string representation of an object with generic JavaScript object formatting. 89 * %O: Object. A string representation of an object with generic JavaScript object formatting.Similar to 90 * util.inspect() without options. This will show the full object not including non-enumerable properties and 91 * proxies. 92 * %c: CSS. This specifier is ignored and will skip any CSS passed in. 93 * %%: single percent sign ('%'). This does not consume an argument.Returns: <string> The formatted string. 94 * 95 * @param { string } format - Styled string 96 * @param { Object[] } args - Data to be formatted 97 * @returns { string } Return the character string formatted in a specific format 98 * @throws { BusinessError } 401 - if the input parameters are invalid. 99 * @syscap SystemCapability.Utils.Lang 100 * @since 9 101 */ 102 /** 103 * %s: String will be used to convert all values except BigInt, Object and -0. BigInt values will be represented 104 * with an n and Objects that have no user defined toString function are inspected using util.inspect() with 105 * options { depth: 0, colors: false, compact: 3 }. 106 * %d: Number will be used to convert all values except BigInt and Symbol. 107 * %i: parseInt(value, 10) is used for all values except BigInt and Symbol. 108 * %f: parseFloat(value) is used for all values except Bigint and Symbol. 109 * %j: JSON. Replaced with the string '[Circular]' if the argument contains circular references. 110 * %o: Object. A string representation of an object with generic JavaScript object formatting.Similar to 111 * util.inspect() with options { showHidden: true, showProxy: true}. This will show the full object including 112 * non-enumerable properties and proxies. 113 * %O: Object. A string representation of an object with generic JavaScript object formatting. 114 * %O: Object. A string representation of an object with generic JavaScript object formatting.Similar to 115 * util.inspect() without options. This will show the full object not including non-enumerable properties and 116 * proxies. 117 * %c: CSS. This specifier is ignored and will skip any CSS passed in. 118 * %%: single percent sign ('%'). This does not consume an argument.Returns: <string> The formatted string. 119 * 120 * @param { string } format - Styled string 121 * @param { Object[] } args - Data to be formatted 122 * @returns { string } a string formatted in a specific format. 123 * @throws { BusinessError } 401 - if the input parameters are invalid. 124 * @syscap SystemCapability.Utils.Lang 125 * @crossplatform 126 * @since 10 127 */ 128 function format(format: string, ...args: Object[]): string; 129 130 /** 131 * Get the string name of the system errno. 132 * 133 * @param { number } errno - The error code generated by an error in the system 134 * @returns { string } Return the string name of a system errno 135 * @syscap SystemCapability.Utils.Lang 136 * @since 7 137 * @deprecated since 9 138 * @useinstead ohos.util.errnoToString 139 */ 140 function getErrorString(errno: number): string; 141 142 /** 143 * Get the string name of the system errno. 144 * 145 * @param { number } errno - The error code generated by an error in the system 146 * @returns { string } Return the string name of a system errno 147 * @throws { BusinessError } 401 - The type of errno must be number. 148 * @syscap SystemCapability.Utils.Lang 149 * @since 9 150 */ 151 /** 152 * Get the string name of the system errno. 153 * 154 * @param { number } errno - The error code generated by an error in the system 155 * @returns { string } Return the string name of a system errno 156 * @throws { BusinessError } 401 - The type of errno must be number. 157 * @syscap SystemCapability.Utils.Lang 158 * @crossplatform 159 * @since 10 160 */ 161 function errnoToString(errno: number): string; 162 163 /** 164 * Takes an async function (or a function that returns a Promise) and returns a function following the 165 * error-first callback style. 166 * 167 * @param { Function } original - Asynchronous function 168 * @returns { function } Return a Asynchronous function 169 * @throws { BusinessError } 401 - The type of original must be Function. 170 * @syscap SystemCapability.Utils.Lang 171 * @since 7 172 */ 173 /** 174 * Takes an async function (or a function that returns a Promise) and returns a function following the 175 * error-first callback style. 176 * 177 * @param { Function } original - Asynchronous function 178 * @returns { function } Return a Asynchronous function 179 * @throws { BusinessError } 401 - The type of original must be Function. 180 * @syscap SystemCapability.Utils.Lang 181 * @crossplatform 182 * @since 10 183 */ 184 function callbackWrapper(original: Function): (err: Object, value: Object) => void; 185 186 /** 187 * Takes a function following the common error-first callback style, i.e taking an (err, value) => 188 * callback as the last argument, and return a function that returns promises. 189 * 190 * @param { function } original - Asynchronous function 191 * @returns { function } Return a function that returns promises 192 * @throws { BusinessError } 401 - The type of original must be Function. 193 * @syscap SystemCapability.Utils.Lang 194 * @since 9 195 */ 196 /** 197 * Takes a function following the common error-first callback style, i.e taking an (err, value) => 198 * callback as the last argument, and return a function that returns promises. 199 * 200 * @param { function } original - Asynchronous function 201 * @returns { Function } Return a function that returns promises 202 * @throws { BusinessError } 401 - The type of original must be Function. 203 * @syscap SystemCapability.Utils.Lang 204 * @crossplatform 205 * @since 10 206 */ 207 function promisify(original: (err: Object, value: Object) => void): Function; 208 209 /** 210 * Takes a function following the common error-first callback style, i.e taking an (err, value) => 211 * callback as the last argument, and return a version that returns promises. 212 * 213 * @param { function } original - Asynchronous function 214 * @returns { Object } Return a version that returns promises 215 * @syscap SystemCapability.Utils.Lang 216 * @since 7 217 * @deprecated since 9 218 * @useinstead ohos.util.promisify 219 */ 220 function promiseWrapper(original: (err: Object, value: Object) => void): Object; 221 222 /** 223 * Generate a random RFC 4122 version 4 UUID using a cryptographically secure random number generator. 224 * 225 * @param { boolean } [entropyCache] - Whether to generate the UUID with using the cache. Default: true. 226 * @returns { string } Return a string representing this UUID. 227 * @throws { BusinessError } 401 - The type of entropyCache must be boolean. 228 * @syscap SystemCapability.Utils.Lang 229 * @since 9 230 */ 231 /** 232 * Generate a random RFC 4122 version 4 UUID using a cryptographically secure random number generator. 233 * 234 * @param { boolean } [entropyCache] - Whether to generate the UUID with using the cache. Default: true. 235 * @returns { string } Return a string representing this UUID. 236 * @throws { BusinessError } 401 - The type of entropyCache must be boolean. 237 * @syscap SystemCapability.Utils.Lang 238 * @crossplatform 239 * @since 10 240 */ 241 function generateRandomUUID(entropyCache?: boolean): string; 242 243 /** 244 * Generate a random RFC 4122 version 4 binary UUID using a cryptographically secure random number generator. 245 * 246 * @param { boolean } [entropyCache] - Whether to generate the UUID with using the cache. Default: true. 247 * @returns { Uint8Array } Return a Uint8Array representing this UUID. 248 * @throws { BusinessError } 401 - The type of entropyCache must be boolean. 249 * @syscap SystemCapability.Utils.Lang 250 * @since 9 251 */ 252 /** 253 * Generate a random RFC 4122 version 4 binary UUID using a cryptographically secure random number generator. 254 * 255 * @param { boolean } [entropyCache] - Whether to generate the UUID with using the cache. Default: true. 256 * @returns { Uint8Array } Return a Uint8Array representing this UUID. 257 * @throws { BusinessError } 401 - The type of entropyCache must be boolean. 258 * @syscap SystemCapability.Utils.Lang 259 * @crossplatform 260 * @since 10 261 */ 262 function generateRandomBinaryUUID(entropyCache?: boolean): Uint8Array; 263 264 /** 265 * Parse a UUID from the string standard representation as described in the RFC 4122 version 4. 266 * 267 * @param { string } uuid - String that specifies a UUID 268 * @returns { Uint8Array } Return a Uint8Array representing this UUID. Throw SyntaxError if parsing fails. 269 * @throws { BusinessError } 401 - The type of uuid must be string. 270 * @syscap SystemCapability.Utils.Lang 271 * @since 9 272 */ 273 /** 274 * Parse a UUID from the string standard representation as described in the RFC 4122 version 4. 275 * 276 * @param { string } uuid - String that specifies a UUID 277 * @returns { Uint8Array } Return a Uint8Array representing this UUID. Throw SyntaxError if parsing fails. 278 * @throws { BusinessError } 401 - The type of uuid must be string. 279 * @syscap SystemCapability.Utils.Lang 280 * @crossplatform 281 * @since 10 282 */ 283 function parseUUID(uuid: string): Uint8Array; 284 285 286 /** 287 * Defines the TextDecoder related options parameters. 288 * 289 * @interface TextDecoderOptions 290 * @syscap SystemCapability.Utils.Lang 291 * @crossplatform 292 * @atomicservice 293 * @since 11 294 */ 295 interface TextDecoderOptions { 296 /** 297 * Is a fatal error displayed? The default value is false. 298 * @type { ?boolean } 299 * @syscap SystemCapability.Utils.Lang 300 * @crossplatform 301 * @atomicservice 302 * @since 11 303 */ 304 fatal?: boolean; 305 /** 306 * Do you want to ignore BOM tags? The default value is false. 307 * @type { ?boolean } 308 * @syscap SystemCapability.Utils.Lang 309 * @crossplatform 310 * @atomicservice 311 * @since 11 312 */ 313 ignoreBOM?: boolean; 314 } 315 316 /** 317 * Defines the decode with stream related options parameters. 318 * 319 * @interface DecodeWithStreamOptions 320 * @syscap SystemCapability.Utils.Lang 321 * @crossplatform 322 * @atomicservice 323 * @since 11 324 */ 325 interface DecodeWithStreamOptions { 326 /** 327 * Does the call follow additional data blocks. The default value is false. 328 * @type { ?boolean } 329 * @syscap SystemCapability.Utils.Lang 330 * @crossplatform 331 * @atomicservice 332 * @since 11 333 */ 334 stream?: boolean; 335 } 336 337 /** 338 * The TextDecoder represents a text decoder that accepts a string as input, 339 * decodes it in UTF-8 format, and outputs UTF-8 byte stream. 340 * 341 * @syscap SystemCapability.Utils.Lang 342 * @since 7 343 */ 344 /** 345 * The TextDecoder represents a text decoder that accepts a string as input, 346 * decodes it in UTF-8 format, and outputs UTF-8 byte stream. 347 * 348 * @syscap SystemCapability.Utils.Lang 349 * @crossplatform 350 * @since 10 351 */ 352 /** 353 * The TextDecoder represents a text decoder that accepts a string as input, 354 * decodes it in UTF-8 format, and outputs UTF-8 byte stream. 355 * 356 * @syscap SystemCapability.Utils.Lang 357 * @crossplatform 358 * @atomicservice 359 * @since 11 360 */ 361 class TextDecoder { 362 /** 363 * The source encoding's name, lowercased. 364 * 365 * @syscap SystemCapability.Utils.Lang 366 * @since 7 367 */ 368 /** 369 * The source encoding's name, lowercased. 370 * 371 * @syscap SystemCapability.Utils.Lang 372 * @crossplatform 373 * @since 10 374 */ 375 readonly encoding: string; 376 377 /** 378 * Returns `true` if error mode is "fatal", and `false` otherwise. 379 * 380 * @syscap SystemCapability.Utils.Lang 381 * @since 7 382 */ 383 /** 384 * Returns `true` if error mode is "fatal", and `false` otherwise. 385 * 386 * @syscap SystemCapability.Utils.Lang 387 * @crossplatform 388 * @since 10 389 */ 390 readonly fatal: boolean; 391 392 /** 393 * Returns `true` if ignore BOM flag is set, and `false` otherwise. 394 * 395 * @syscap SystemCapability.Utils.Lang 396 * @since 7 397 */ 398 /** 399 * Returns `true` if ignore BOM flag is set, and `false` otherwise. 400 * 401 * @syscap SystemCapability.Utils.Lang 402 * @crossplatform 403 * @since 10 404 */ 405 readonly ignoreBOM = false; 406 407 /** 408 * The textDecoder constructor. 409 * 410 * @param { string } encoding - Decoding format 411 * @param { object } options - Options 412 * @syscap SystemCapability.Utils.Lang 413 * @since 7 414 * @deprecated since 9 415 * @useinstead ohos.util.TextDecoder.create 416 */ 417 constructor(encoding?: string, options?: { fatal?: boolean; ignoreBOM?: boolean }); 418 419 /** 420 * The textDecoder constructor. 421 * 422 * @syscap SystemCapability.Utils.Lang 423 * @since 9 424 */ 425 /** 426 * The textDecoder constructor. 427 * 428 * @syscap SystemCapability.Utils.Lang 429 * @crossplatform 430 * @since 10 431 */ 432 constructor(); 433 434 /** 435 * Replaces the original constructor to process arguments and return a textDecoder object. 436 * 437 * @param { string } encoding - Decoding format 438 * @param { object } options - Options 439 * @returns { TextDecoder } 440 * @throws { BusinessError } 401 - if the input parameters are invalid. 441 * @syscap SystemCapability.Utils.Lang 442 * @since 9 443 */ 444 /** 445 * Replaces the original constructor to process arguments and return a textDecoder object. 446 * 447 * @param { string } encoding - Decoding format 448 * @param { object } options - Options 449 * @returns { TextDecoder } 450 * @throws { BusinessError } 401 - if the input parameters are invalid. 451 * @syscap SystemCapability.Utils.Lang 452 * @crossplatform 453 * @since 10 454 */ 455 /** 456 * Replaces the original constructor to process arguments and return a textDecoder object. 457 * 458 * @param { string } [encoding] - Decoding format 459 * @param { TextDecoderOptions } [options] - Options 460 * @returns { TextDecoder } 461 * @throws { BusinessError } 401 - if the input parameters are invalid. 462 * @syscap SystemCapability.Utils.Lang 463 * @crossplatform 464 * @atomicservice 465 * @since 11 466 */ 467 static create(encoding?: string, options?: TextDecoderOptions): TextDecoder; 468 469 /** 470 * Returns the result of running encoding's decoder. 471 * 472 * @param { Uint8Array } input - Decoded numbers in accordance with the format 473 * @param { object } options - Options 474 * @returns { string } Return decoded text 475 * @syscap SystemCapability.Utils.Lang 476 * @since 7 477 * @deprecated since 9 478 * @useinstead ohos.util.decodeWithStream 479 */ 480 decode(input: Uint8Array, options?: { stream?: false }): string; 481 482 /** 483 * Decodes the input and returns a string. If options.stream is true, any incomplete byte sequences occurring 484 * at the end of the input are buffered internally and emitted after the next call to textDecoder.decode(). 485 * If textDecoder.fatal is true, decoding errors that occur will result in a TypeError being thrown. 486 * 487 * @param { Uint8Array } input - Decoded numbers in accordance with the format 488 * @param { object } options - Options 489 * @returns { string } Return decoded text 490 * @throws { BusinessError } 401 - if the input parameters are invalid. 491 * @syscap SystemCapability.Utils.Lang 492 * @since 9 493 */ 494 /** 495 * Decodes the input and returns a string. If options.stream is true, any incomplete byte sequences occurring 496 * at the end of the input are buffered internally and emitted after the next call to textDecoder.decode(). 497 * If textDecoder.fatal is true, decoding errors that occur will result in a TypeError being thrown. 498 * 499 * @param { Uint8Array } input - Decoded numbers in accordance with the format 500 * @param { object } options - Options 501 * @returns { string } Return decoded text 502 * @throws { BusinessError } 401 - if the input parameters are invalid. 503 * @syscap SystemCapability.Utils.Lang 504 * @crossplatform 505 * @since 10 506 */ 507 /** 508 * Decodes the input and returns a string. If options.stream is true, any incomplete byte sequences occurring 509 * at the end of the input are buffered internally and emitted after the next call to textDecoder.decode(). 510 * If textDecoder.fatal is true, decoding errors that occur will result in a TypeError being thrown. 511 * 512 * @param { Uint8Array } input - Decoded numbers in accordance with the format 513 * @param { DecodeWithStreamOptions } [options] - Options 514 * @returns { string } Return decoded text 515 * @throws { BusinessError } 401 - if the input parameters are invalid. 516 * @syscap SystemCapability.Utils.Lang 517 * @crossplatform 518 * @atomicservice 519 * @since 11 520 */ 521 decodeWithStream(input: Uint8Array, options?: DecodeWithStreamOptions): string; 522 } 523 524 /** 525 * Return encoded text. 526 * 527 * @interface EncodeIntoUint8ArrayInfo 528 * @syscap SystemCapability.Utils.Lang 529 * @crossplatform 530 * @atomicservice 531 * @since 11 532 */ 533 interface EncodeIntoUint8ArrayInfo { 534 /** 535 * The read represents the number of characters that have been encoded. 536 * @type { number } 537 * @syscap SystemCapability.Utils.Lang 538 * @crossplatform 539 * @atomicservice 540 * @since 11 541 */ 542 read: number; 543 /** 544 * The written represents the number of bytes occupied by the encoded characters. 545 * @type { number } 546 * @syscap SystemCapability.Utils.Lang 547 * @crossplatform 548 * @atomicservice 549 * @since 11 550 */ 551 written: number; 552 } 553 554 /** 555 * The TextEncoder interface represents a text encoder. 556 * The encoder takes the byte stream as the input and outputs the String string. 557 * 558 * @syscap SystemCapability.Utils.Lang 559 * @since 7 560 */ 561 /** 562 * The TextEncoder interface represents a text encoder. 563 * The encoder takes the byte stream as the input and outputs the String string. 564 * 565 * @syscap SystemCapability.Utils.Lang 566 * @crossplatform 567 * @since 10 568 */ 569 /** 570 * The TextEncoder interface represents a text encoder. 571 * The encoder takes the byte stream as the input and outputs the String string. 572 * 573 * @syscap SystemCapability.Utils.Lang 574 * @crossplatform 575 * @atomicservice 576 * @since 11 577 */ 578 class TextEncoder { 579 /** 580 * Encoding format. 581 * 582 * @syscap SystemCapability.Utils.Lang 583 * @since 7 584 */ 585 /** 586 * Encoding format. 587 * 588 * @syscap SystemCapability.Utils.Lang 589 * @crossplatform 590 * @since 10 591 */ 592 readonly encoding = 'utf-8'; 593 594 /** 595 * The textEncoder constructor. 596 * 597 * @syscap SystemCapability.Utils.Lang 598 * @since 7 599 */ 600 /** 601 * The textEncoder constructor. 602 * 603 * @syscap SystemCapability.Utils.Lang 604 * @crossplatform 605 * @since 10 606 */ 607 /** 608 * The textEncoder constructor. 609 * 610 * @syscap SystemCapability.Utils.Lang 611 * @crossplatform 612 * @atomicservice 613 * @since 11 614 */ 615 constructor(); 616 617 /** 618 * The textEncoder constructor. 619 * 620 * @param { string } [encoding] - The string for encoding format. 621 * @throws { BusinessError } 401 - The type of encoding must be string. 622 * @syscap SystemCapability.Utils.Lang 623 * @since 9 624 */ 625 /** 626 * The textEncoder constructor. 627 * 628 * @param { string } [encoding] - The string for encoding format. 629 * @throws { BusinessError } 401 - The type of encoding must be string. 630 * @syscap SystemCapability.Utils.Lang 631 * @crossplatform 632 * @since 10 633 */ 634 /** 635 * The textEncoder constructor. 636 * 637 * @param { string } [encoding] - The string for encoding format. 638 * @throws { BusinessError } 401 - The type of encoding must be string. 639 * @syscap SystemCapability.Utils.Lang 640 * @crossplatform 641 * @atomicservice 642 * @since 11 643 */ 644 constructor(encoding?: string); 645 646 /** 647 * Returns the result of encoder. 648 * 649 * @param { string } [input] - The string to be encoded. 650 * @returns { Uint8Array } Returns the encoded text. 651 * @syscap SystemCapability.Utils.Lang 652 * @since 7 653 * @deprecated since 9 654 * @useinstead ohos.util.encodeInto 655 */ 656 encode(input?: string): Uint8Array; 657 658 /** 659 * UTF-8 encodes the input string and returns a Uint8Array containing the encoded bytes. 660 * 661 * @param { string } [input] - The string to be encoded. 662 * @returns { Uint8Array } Returns the encoded text. 663 * @throws { BusinessError } 401 - The type of input must be string. 664 * @syscap SystemCapability.Utils.Lang 665 * @since 9 666 */ 667 /** 668 * UTF-8 encodes the input string and returns a Uint8Array containing the encoded bytes. 669 * 670 * @param { string } [input] - The string to be encoded. 671 * @returns { Uint8Array } Returns the encoded text. 672 * @throws { BusinessError } 401 - The type of input must be string. 673 * @syscap SystemCapability.Utils.Lang 674 * @crossplatform 675 * @since 10 676 */ 677 /** 678 * UTF-8 encodes the input string and returns a Uint8Array containing the encoded bytes. 679 * 680 * @param { string } [input] - The string to be encoded. 681 * @returns { Uint8Array } Returns the encoded text. 682 * @throws { BusinessError } 401 - The type of input must be string. 683 * @syscap SystemCapability.Utils.Lang 684 * @crossplatform 685 * @atomicservice 686 * @since 11 687 */ 688 encodeInto(input?: string): Uint8Array; 689 690 /** 691 * Encode string, write the result to dest array. 692 * 693 * @param { string } input - The string to be encoded. 694 * @param { Uint8Array } dest - Encoded numbers in accordance with the format 695 * @returns { object } Return the object, where read represents 696 * the number of characters that have been encoded, and written 697 * represents the number of bytes occupied by the encoded characters. 698 * @syscap SystemCapability.Utils.Lang 699 * @since 7 700 * @deprecated since 9 701 * @useinstead ohos.util.encodeIntoUint8Array 702 */ 703 encodeInto(input: string, dest: Uint8Array): { read: number; written: number }; 704 705 /** 706 * Encode string, write the result to dest array. 707 * 708 * @param { string } input - The string to be encoded. 709 * @param { Uint8Array } dest - Encoded numbers in accordance with the format 710 * @returns { object } Return the object, where read represents 711 * the number of characters that have been encoded, and written 712 * represents the number of bytes occupied by the encoded characters. 713 * @throws { BusinessError } 401 - if the input parameters are invalid. 714 * @syscap SystemCapability.Utils.Lang 715 * @since 9 716 */ 717 /** 718 * Encode string, write the result to dest array. 719 * 720 * @param { string } input - The string to be encoded. 721 * @param { Uint8Array } dest - Encoded numbers in accordance with the format 722 * @returns { object } Return the object, where read represents 723 * the number of characters that have been encoded, and written 724 * represents the number of bytes occupied by the encoded characters. 725 * @throws { BusinessError } 401 - if the input parameters are invalid. 726 * @syscap SystemCapability.Utils.Lang 727 * @crossplatform 728 * @since 10 729 */ 730 /** 731 * Encode string, write the result to dest array. 732 * 733 * @param { string } input - The string to be encoded. 734 * @param { Uint8Array } dest - Encoded numbers in accordance with the format 735 * @returns { EncodeIntoUint8ArrayInfo } Return the object, where read represents 736 * the number of characters that have been encoded, and written 737 * represents the number of bytes occupied by the encoded characters. 738 * @throws { BusinessError } 401 - if the input parameters are invalid. 739 * @syscap SystemCapability.Utils.Lang 740 * @crossplatform 741 * @atomicservice 742 * @since 11 743 */ 744 encodeIntoUint8Array(input: string, dest: Uint8Array): EncodeIntoUint8ArrayInfo; 745 } 746 747 /** 748 * The rational number is mainly to compare rational numbers and obtain the numerator and denominator. 749 * 750 * @syscap SystemCapability.Utils.Lang 751 * @since 8 752 */ 753 /** 754 * The rational number is mainly to compare rational numbers and obtain the numerator and denominator. 755 * 756 * @syscap SystemCapability.Utils.Lang 757 * @crossplatform 758 * @since 10 759 */ 760 class RationalNumber { 761 /** 762 * A constructor used to create a RationalNumber instance with a given numerator and denominator. 763 * 764 * @param { number } numerator - An integer number 765 * @param { number } denominator - An integer number 766 * @syscap SystemCapability.Utils.Lang 767 * @since 8 768 * @deprecated since 9 769 * @useinstead ohos.util.RationalNumber.parseRationalNumber 770 */ 771 constructor(numerator: number, denominator: number); 772 773 /** 774 * A constructor used to create a RationalNumber instance with a given numerator and denominator. 775 * 776 * @syscap SystemCapability.Utils.Lang 777 * @since 9 778 */ 779 /** 780 * A constructor used to create a RationalNumber instance with a given numerator and denominator. 781 * 782 * @syscap SystemCapability.Utils.Lang 783 * @crossplatform 784 * @since 10 785 */ 786 constructor(); 787 788 /** 789 * Used to create a RationalNumber instance with a given numerator and denominator. 790 * 791 * @param { number } numerator - An integer number 792 * @param { number } denominator - An integer number 793 * @returns { RationalNumber } 794 * @throws { BusinessError } 401 - if the input parameters are invalid. 795 * @syscap SystemCapability.Utils.Lang 796 * @since 9 797 */ 798 /** 799 * Used to create a RationalNumber instance with a given numerator and denominator. 800 * 801 * @param { number } numerator - An integer number 802 * @param { number } denominator - An integer number 803 * @returns { RationalNumber } 804 * @throws { BusinessError } 401 - if the input parameters are invalid. 805 * @syscap SystemCapability.Utils.Lang 806 * @crossplatform 807 * @since 10 808 */ 809 static parseRationalNumber(numerator: number, denominator: number): RationalNumber; 810 811 /** 812 * Creates a RationalNumber object based on a given string. 813 * 814 * @param { string } rationalString - String Expression of Rational Numbers 815 * @returns { RationalNumber } Returns a RationalNumber object generated based on the given string. 816 * @throws { BusinessError } 401 - The type of rationalString must be string. 817 * @syscap SystemCapability.Utils.Lang 818 * @since 8 819 */ 820 /** 821 * Creates a RationalNumber object based on a given string. 822 * 823 * @param { string } rationalString - String Expression of Rational Numbers 824 * @returns { RationalNumber } Returns a RationalNumber object generated based on the given string. 825 * @throws { BusinessError } 401 - The type of rationalString must be string. 826 * @syscap SystemCapability.Utils.Lang 827 * @crossplatform 828 * @since 10 829 */ 830 static createRationalFromString(rationalString: string): RationalNumber; 831 832 /** 833 * Compares the current RationalNumber object to the given object. 834 * 835 * @param { RationalNumber } another - An object of other rational numbers 836 * @returns { number } Returns 0 or 1, or -1, depending on the comparison. 837 * @syscap SystemCapability.Utils.Lang 838 * @since 8 839 * @deprecated since 9 840 * @useinstead ohos.util.compare 841 */ 842 compareTo(another: RationalNumber): number; 843 844 /** 845 * Compares the current RationalNumber object to the given object. 846 * 847 * @param { RationalNumber } another - An object of other rational numbers 848 * @returns { number } Returns 0 or 1, or -1, depending on the comparison. 849 * @throws { BusinessError } 401 - The type of another must be RationalNumber. 850 * @syscap SystemCapability.Utils.Lang 851 * @since 9 852 */ 853 /** 854 * Compares the current RationalNumber object to the given object. 855 * 856 * @param { RationalNumber } another - An object of other rational numbers 857 * @returns { number } Returns 0 or 1, or -1, depending on the comparison. 858 * @throws { BusinessError } 401 - The type of another must be RationalNumber. 859 * @syscap SystemCapability.Utils.Lang 860 * @crossplatform 861 * @since 10 862 */ 863 compare(another: RationalNumber): number; 864 865 /** 866 * Compares two objects for equality. 867 * 868 * @param { Object } obj - An object 869 * @returns { boolean } Returns true if the given object is the same as the current object; Otherwise, false is returned. 870 * @syscap SystemCapability.Utils.Lang 871 * @since 8 872 */ 873 /** 874 * Compares two objects for equality. 875 * 876 * @param { Object } obj - An object 877 * @returns { boolean } Returns true if the given object is the same as the current object; Otherwise, false is returned. 878 * @syscap SystemCapability.Utils.Lang 879 * @crossplatform 880 * @since 10 881 */ 882 equals(obj: Object): boolean; 883 884 /** 885 * Gets integer and floating-point values of a rational number object. 886 * 887 * @returns { number } Returns the integer and floating-point values of a rational number object. 888 * @syscap SystemCapability.Utils.Lang 889 * @since 8 890 */ 891 /** 892 * Gets integer and floating-point values of a rational number object. 893 * 894 * @returns { number } Returns the integer and floating-point values of a rational number object. 895 * @syscap SystemCapability.Utils.Lang 896 * @crossplatform 897 * @since 10 898 */ 899 valueOf(): number; 900 901 /** 902 * Get the greatest common divisor of two integers. 903 * 904 * @param { number } number1 - Is an integer. 905 * @param { number } number2 - Is an integer. 906 * @returns { number } Returns the greatest common divisor of two integers, integer type. 907 * @syscap SystemCapability.Utils.Lang 908 * @since 8 909 * @deprecated since 9 910 * @useinstead ohos.util.getCommonFactor 911 */ 912 static getCommonDivisor(number1: number, number2: number): number; 913 914 /** 915 * Get the greatest common factor of two integers. 916 * 917 * @param { number } number1 - Is an integer. 918 * @param { number } number2 - Is an integer. 919 * @returns { number } Returns the greatest common factor of two integers, integer type. 920 * @throws { BusinessError } 401 - if the input parameters are invalid. 921 * @syscap SystemCapability.Utils.Lang 922 * @since 9 923 */ 924 /** 925 * Get the greatest common factor of two integers. 926 * 927 * @param { number } number1 - Is an integer. 928 * @param { number } number2 - Is an integer. 929 * @returns { number } Returns the greatest common factor of two integers, integer type. 930 * @throws { BusinessError } 401 - if the input parameters are invalid. 931 * @syscap SystemCapability.Utils.Lang 932 * @crossplatform 933 * @since 10 934 */ 935 static getCommonFactor(number1: number, number2: number): number; 936 937 /** 938 * Gets the denominator of the current object. 939 * 940 * @returns { number } Returns the denominator of the current object. 941 * @syscap SystemCapability.Utils.Lang 942 * @since 8 943 */ 944 /** 945 * Gets the denominator of the current object. 946 * 947 * @returns { number } Returns the denominator of the current object. 948 * @syscap SystemCapability.Utils.Lang 949 * @crossplatform 950 * @since 10 951 */ 952 getDenominator(): number; 953 954 /** 955 * Gets the numerator of the current object. 956 * 957 * @returns { number } Returns the numerator of the current object. 958 * @syscap SystemCapability.Utils.Lang 959 * @since 8 960 */ 961 /** 962 * Gets the numerator of the current object. 963 * 964 * @returns { number } Returns the numerator of the current object. 965 * @syscap SystemCapability.Utils.Lang 966 * @crossplatform 967 * @since 10 968 */ 969 getNumerator(): number; 970 971 /** 972 * Checks whether the current RationalNumber object represents an infinite value. 973 * 974 * @returns { boolean } If the denominator is not 0, true is returned. Otherwise, false is returned. 975 * @syscap SystemCapability.Utils.Lang 976 * @since 8 977 */ 978 /** 979 * Checks whether the current RationalNumber object represents an infinite value. 980 * 981 * @returns { boolean } If the denominator is not 0, true is returned. Otherwise, false is returned. 982 * @syscap SystemCapability.Utils.Lang 983 * @crossplatform 984 * @since 10 985 */ 986 isFinite(): boolean; 987 988 /** 989 * Checks whether the current RationalNumber object represents a Not-a-Number (NaN) value. 990 * 991 * @returns { boolean } If both the denominator and numerator are 0, true is returned. Otherwise, false is returned. 992 * @syscap SystemCapability.Utils.Lang 993 * @since 8 994 */ 995 /** 996 * Checks whether the current RationalNumber object represents a Not-a-Number (NaN) value. 997 * 998 * @returns { boolean } If both the denominator and numerator are 0, true is returned. Otherwise, false is returned. 999 * @syscap SystemCapability.Utils.Lang 1000 * @crossplatform 1001 * @since 10 1002 */ 1003 isNaN(): boolean; 1004 1005 /** 1006 * Checks whether the current RationalNumber object represents the value 0. 1007 * 1008 * @returns { boolean } If the value represented by the current object is 0, true is returned. Otherwise, false is returned. 1009 * @syscap SystemCapability.Utils.Lang 1010 * @since 8 1011 */ 1012 /** 1013 * Checks whether the current RationalNumber object represents the value 0. 1014 * 1015 * @returns { boolean } If the value represented by the current object is 0, true is returned. Otherwise, false is returned. 1016 * @syscap SystemCapability.Utils.Lang 1017 * @crossplatform 1018 * @since 10 1019 */ 1020 isZero(): boolean; 1021 1022 /** 1023 * Obtains a string representation of the current RationalNumber object. 1024 * 1025 * @returns { string } Returns a string representation of the current RationalNumber object. 1026 * @syscap SystemCapability.Utils.Lang 1027 * @since 8 1028 */ 1029 /** 1030 * Obtains a string representation of the current RationalNumber object. 1031 * 1032 * @returns { string } Returns a string representation of the current RationalNumber object. 1033 * @syscap SystemCapability.Utils.Lang 1034 * @crossplatform 1035 * @since 10 1036 */ 1037 toString(): string; 1038 } 1039 1040 /** 1041 * The LruBuffer algorithm replaces the least used data with new data when the buffer space is insufficient. 1042 * 1043 * @syscap SystemCapability.Utils.Lang 1044 * @since 8 1045 * @deprecated since 9 1046 * @useinstead ohos.util.LRUCache 1047 */ 1048 class LruBuffer<K, V> { 1049 /** 1050 * Default constructor used to create a new LruBuffer instance with the default capacity of 64. 1051 * 1052 * @param { number } capacity - Indicates the capacity to customize for the buffer. 1053 * @syscap SystemCapability.Utils.Lang 1054 * @since 8 1055 * @deprecated since 9 1056 * @useinstead ohos.util.LRUCache.constructor 1057 */ 1058 constructor(capacity?: number); 1059 1060 /** 1061 * Updates the buffer capacity to a specified capacity. 1062 * 1063 * @param { number } newCapacity - Indicates the new capacity to set. 1064 * @syscap SystemCapability.Utils.Lang 1065 * @since 8 1066 * @deprecated since 9 1067 * @useinstead ohos.util.LRUCache.updateCapacity 1068 */ 1069 updateCapacity(newCapacity: number): void; 1070 1071 /** 1072 * Returns a string representation of the object. 1073 * 1074 * @returns { string } Returns the string representation of the object and outputs the string representation of the object. 1075 * @syscap SystemCapability.Utils.Lang 1076 * @since 8 1077 * @deprecated since 9 1078 * @useinstead ohos.util.LRUCache.toString 1079 */ 1080 toString(): string; 1081 1082 /** 1083 * Obtains a list of all values in the current buffer. 1084 * 1085 * @syscap SystemCapability.Utils.Lang 1086 * @since 8 1087 * @deprecated since 9 1088 * @useinstead ohos.util.LRUCache.length 1089 */ 1090 length: number; 1091 1092 /** 1093 * Obtains the capacity of the current buffer. 1094 * 1095 * @returns { number } Returns the capacity of the current buffer. 1096 * @syscap SystemCapability.Utils.Lang 1097 * @since 8 1098 * @deprecated since 9 1099 * @useinstead ohos.util.LRUCache.getCapacity 1100 */ 1101 getCapacity(): number; 1102 1103 /** 1104 * Clears key-value pairs from the current buffer. 1105 * 1106 * @syscap SystemCapability.Utils.Lang 1107 * @since 8 1108 * @deprecated since 9 1109 * @useinstead ohos.util.LRUCache.clear 1110 */ 1111 clear(): void; 1112 1113 /** 1114 * Obtains the number of times createDefault(Object) returned a value. 1115 * 1116 * @returns { number } Returns the number of times createDefault(java.lang.Object) returned a value. 1117 * @syscap SystemCapability.Utils.Lang 1118 * @since 8 1119 * @deprecated since 9 1120 * @useinstead ohos.util.LRUCache.getCreateCount 1121 */ 1122 getCreateCount(): number; 1123 1124 /** 1125 * Obtains the number of times that the queried values are not matched. 1126 * 1127 * @returns { number } Returns the number of times that the queried values are not matched. 1128 * @syscap SystemCapability.Utils.Lang 1129 * @since 8 1130 * @deprecated since 9 1131 * @useinstead ohos.util.LRUCache.getMissCount 1132 */ 1133 getMissCount(): number; 1134 1135 /** 1136 * Obtains the number of times that values are evicted from the buffer. 1137 * 1138 * @returns { number } Returns the number of times that values are evicted from the buffer. 1139 * @syscap SystemCapability.Utils.Lang 1140 * @since 8 1141 * @deprecated since 9 1142 * @useinstead ohos.util.LRUCache.getRemovalCount 1143 */ 1144 getRemovalCount(): number; 1145 1146 /** 1147 * Obtains the number of times that the queried values are successfully matched. 1148 * 1149 * @returns { number } Returns the number of times that the queried values are successfully matched. 1150 * @syscap SystemCapability.Utils.Lang 1151 * @since 8 1152 * @deprecated since 9 1153 * @useinstead ohos.util.LRUCache.getMatchCount 1154 */ 1155 getMatchCount(): number; 1156 1157 /** 1158 * Obtains the number of times that values are added to the buffer. 1159 * 1160 * @returns { number } Returns the number of times that values are added to the buffer. 1161 * @syscap SystemCapability.Utils.Lang 1162 * @since 8 1163 * @deprecated since 9 1164 * @useinstead ohos.util.LRUCache.getPutCount 1165 */ 1166 getPutCount(): number; 1167 1168 /** 1169 * Checks whether the current buffer is empty. 1170 * 1171 * @returns { boolean } Returns true if the current buffer contains no value. 1172 * @syscap SystemCapability.Utils.Lang 1173 * @since 8 1174 * @deprecated since 9 1175 * @useinstead ohos.util.LRUCache.isEmpty 1176 */ 1177 isEmpty(): boolean; 1178 1179 /** 1180 * Obtains the value associated with a specified key. 1181 * 1182 * @param { K } key - Indicates the key to query. 1183 * @returns { V | undefined } Returns the value associated with the key if the specified key is present in the buffer; returns null otherwise. 1184 * @syscap SystemCapability.Utils.Lang 1185 * @since 8 1186 * @deprecated since 9 1187 * @useinstead ohos.util.LRUCache.get 1188 */ 1189 get(key: K): V | undefined; 1190 1191 /** 1192 * Adds a key-value pair to the buffer. 1193 * 1194 * @param { K } key - Indicates the key to add. 1195 * @param { V } value - Indicates the value associated with the key to add. 1196 * @returns { V } Returns the value associated with the added key; returns the original value if the key to add already exists. 1197 * @syscap SystemCapability.Utils.Lang 1198 * @since 8 1199 * @deprecated since 9 1200 * @useinstead ohos.util.LRUCache.put 1201 */ 1202 put(key: K, value: V): V; 1203 1204 /** 1205 * Obtains a list of all values in the current buffer. 1206 * 1207 * @returns { V[] } Returns the list of all values in the current buffer in ascending order, from the most recently accessed to least recently accessed. 1208 * @syscap SystemCapability.Utils.Lang 1209 * @since 8 1210 * @deprecated since 9 1211 * @useinstead ohos.util.LRUCache.values 1212 */ 1213 values(): V[]; 1214 1215 /** 1216 * Obtains a list of keys for the values in the current buffer. 1217 * 1218 * @returns { K[] } Returns a list of keys sorted from most recently accessed to least recently accessed. 1219 * @syscap SystemCapability.Utils.Lang 1220 * @since 8 1221 * @deprecated since 9 1222 * @useinstead ohos.util.LRUCache.keys 1223 */ 1224 keys(): K[]; 1225 1226 /** 1227 * Deletes a specified key and its associated value from the current buffer. 1228 * 1229 * @param { K } key - Indicates the key to delete. 1230 * @returns { V | undefined } Returns an Optional object containing the deleted key-value pair; returns an empty Optional object if the key does not exist. 1231 * @syscap SystemCapability.Utils.Lang 1232 * @since 8 1233 * @deprecated since 9 1234 * @useinstead ohos.util.LRUCache.remove 1235 */ 1236 remove(key: K): V | undefined; 1237 1238 /** 1239 * Executes subsequent operations after a value is deleted. 1240 * 1241 * @param { boolean } isEvict - The parameter value is true if this method is called due to insufficient capacity, 1242 * and the parameter value is false in other cases. 1243 * @param { K } key - Indicates the deleted key. 1244 * @param { V } value - Indicates the deleted value. 1245 * @param { V } newValue - The parameter value is the new value associated if the put(java.lang.Object,java.lang.Object) 1246 * method is called and the key to add already exists. The parameter value is null in other cases. 1247 * @syscap SystemCapability.Utils.Lang 1248 * @since 8 1249 * @deprecated since 9 1250 * @useinstead ohos.util.LRUCache.afterRemoval 1251 */ 1252 afterRemoval(isEvict: boolean, key: K, value: V, newValue: V): void; 1253 1254 /** 1255 * Checks whether the current buffer contains a specified key. 1256 * 1257 * @param { K } key - Indicates the key to check. 1258 * @returns { boolean } Returns true if the buffer contains the specified key. 1259 * @syscap SystemCapability.Utils.Lang 1260 * @since 8 1261 * @deprecated since 9 1262 * @useinstead ohos.util.LRUCache.contains 1263 */ 1264 contains(key: K): boolean; 1265 1266 /** 1267 * Called after a cache miss to compute a value for the corresponding key. 1268 * 1269 * @param { K } key - Indicates the missed key. 1270 * @returns { V } Returns the value associated with the key. 1271 * @syscap SystemCapability.Utils.Lang 1272 * @since 8 1273 * @deprecated since 9 1274 * @useinstead ohos.util.LRUCache.createDefault 1275 */ 1276 createDefault(key: K): V; 1277 1278 /** 1279 * Returns an array of key-value pairs of enumeratable properties of a given object. 1280 * 1281 * @returns { IterableIterator<[K, V]> } Returns an array of key-value pairs for the enumeratable properties of the given object itself. 1282 * @syscap SystemCapability.Utils.Lang 1283 * @since 8 1284 * @deprecated since 9 1285 * @useinstead ohos.util.LRUCache.entries 1286 */ 1287 entries(): IterableIterator<[K, V]>; 1288 1289 /** 1290 * Specifies the default iterator for an object. 1291 * @returns { IterableIterator<[K, V]> } Returns a two - dimensional array in the form of key - value pairs. 1292 * @syscap SystemCapability.Utils.Lang 1293 * @since 8 1294 * @deprecated since 9 1295 * @useinstead ohos.util.LRUCache.[Symbol.iterator] 1296 */ 1297 [Symbol.iterator](): IterableIterator<[K, V]>; 1298 } 1299 1300 /** 1301 * The LRUCache algorithm replaces the least used data with new data when the buffer space is insufficient. 1302 * 1303 * @syscap SystemCapability.Utils.Lang 1304 * @since 9 1305 */ 1306 /** 1307 * The LRUCache algorithm replaces the least used data with new data when the buffer space is insufficient. 1308 * 1309 * @syscap SystemCapability.Utils.Lang 1310 * @crossplatform 1311 * @since 10 1312 */ 1313 class LRUCache<K, V> { 1314 /** 1315 * Default constructor used to create a new LruBuffer instance with the default capacity of 64. 1316 * 1317 * @param { number } [capacity] - Indicates the capacity to customize for the buffer. 1318 * @syscap SystemCapability.Utils.Lang 1319 * @since 9 1320 */ 1321 /** 1322 * Default constructor used to create a new LruBuffer instance with the default capacity of 64. 1323 * 1324 * @param { number } [capacity] - Indicates the capacity to customize for the buffer. 1325 * @syscap SystemCapability.Utils.Lang 1326 * @crossplatform 1327 * @since 10 1328 */ 1329 constructor(capacity?: number); 1330 1331 /** 1332 * Updates the buffer capacity to a specified capacity. 1333 * 1334 * @param { number } newCapacity - Indicates the new capacity to set. 1335 * @throws { BusinessError } 401 - The type of newCapacity must be number. 1336 * @syscap SystemCapability.Utils.Lang 1337 * @since 9 1338 */ 1339 /** 1340 * Updates the buffer capacity to a specified capacity. 1341 * 1342 * @param { number } newCapacity - Indicates the new capacity to set. 1343 * @throws { BusinessError } 401 - The type of newCapacity must be number. 1344 * @syscap SystemCapability.Utils.Lang 1345 * @crossplatform 1346 * @since 10 1347 */ 1348 updateCapacity(newCapacity: number): void; 1349 1350 /** 1351 * Returns a string representation of the object. 1352 * 1353 * @returns { string } Returns the string representation of the object and outputs the string representation of the object. 1354 * @syscap SystemCapability.Utils.Lang 1355 * @since 9 1356 */ 1357 /** 1358 * Returns a string representation of the object. 1359 * 1360 * @returns { string } Returns the string representation of the object and outputs the string representation of the object. 1361 * @syscap SystemCapability.Utils.Lang 1362 * @crossplatform 1363 * @since 10 1364 */ 1365 toString(): string; 1366 1367 /** 1368 * Obtains a list of all values in the current buffer. 1369 * 1370 * @syscap SystemCapability.Utils.Lang 1371 * @since 9 1372 */ 1373 /** 1374 * Obtains a list of all values in the current buffer. 1375 * 1376 * @syscap SystemCapability.Utils.Lang 1377 * @crossplatform 1378 * @since 10 1379 */ 1380 length: number; 1381 1382 /** 1383 * Obtains the capacity of the current buffer. 1384 * 1385 * @returns { number } Returns the capacity of the current buffer. 1386 * @syscap SystemCapability.Utils.Lang 1387 * @since 9 1388 */ 1389 /** 1390 * Obtains the capacity of the current buffer. 1391 * 1392 * @returns { number } Returns the capacity of the current buffer. 1393 * @syscap SystemCapability.Utils.Lang 1394 * @crossplatform 1395 * @since 10 1396 */ 1397 getCapacity(): number; 1398 1399 /** 1400 * Clears key-value pairs from the current buffer. 1401 * 1402 * @syscap SystemCapability.Utils.Lang 1403 * @since 9 1404 */ 1405 /** 1406 * Clears key-value pairs from the current buffer. 1407 * 1408 * @syscap SystemCapability.Utils.Lang 1409 * @crossplatform 1410 * @since 10 1411 */ 1412 clear(): void; 1413 1414 /** 1415 * Obtains the number of times createDefault(Object) returned a value. 1416 * 1417 * @returns { number } Returns the number of times createDefault(java.lang.Object) returned a value. 1418 * @syscap SystemCapability.Utils.Lang 1419 * @since 9 1420 */ 1421 /** 1422 * Obtains the number of times createDefault(Object) returned a value. 1423 * 1424 * @returns { number } Returns the number of times createDefault(java.lang.Object) returned a value. 1425 * @syscap SystemCapability.Utils.Lang 1426 * @crossplatform 1427 * @since 10 1428 */ 1429 getCreateCount(): number; 1430 1431 /** 1432 * Obtains the number of times that the queried values are not matched. 1433 * 1434 * @returns { number } Returns the number of times that the queried values are not matched. 1435 * @syscap SystemCapability.Utils.Lang 1436 * @since 9 1437 */ 1438 /** 1439 * Obtains the number of times that the queried values are not matched. 1440 * 1441 * @returns { number } Returns the number of times that the queried values are not matched. 1442 * @syscap SystemCapability.Utils.Lang 1443 * @crossplatform 1444 * @since 10 1445 */ 1446 getMissCount(): number; 1447 1448 /** 1449 * Obtains the number of times that values are evicted from the buffer. 1450 * 1451 * @returns { number } Returns the number of times that values are evicted from the buffer. 1452 * @syscap SystemCapability.Utils.Lang 1453 * @since 9 1454 */ 1455 /** 1456 * Obtains the number of times that values are evicted from the buffer. 1457 * 1458 * @returns { number } Returns the number of times that values are evicted from the buffer. 1459 * @syscap SystemCapability.Utils.Lang 1460 * @crossplatform 1461 * @since 10 1462 */ 1463 getRemovalCount(): number; 1464 1465 /** 1466 * Obtains the number of times that the queried values are successfully matched. 1467 * 1468 * @returns { number } Returns the number of times that the queried values are successfully matched. 1469 * @syscap SystemCapability.Utils.Lang 1470 * @since 9 1471 */ 1472 /** 1473 * Obtains the number of times that the queried values are successfully matched. 1474 * 1475 * @returns { number } Returns the number of times that the queried values are successfully matched. 1476 * @syscap SystemCapability.Utils.Lang 1477 * @crossplatform 1478 * @since 10 1479 */ 1480 getMatchCount(): number; 1481 1482 /** 1483 * Obtains the number of times that values are added to the buffer. 1484 * 1485 * @returns { number } Returns the number of times that values are added to the buffer. 1486 * @syscap SystemCapability.Utils.Lang 1487 * @since 9 1488 */ 1489 /** 1490 * Obtains the number of times that values are added to the buffer. 1491 * 1492 * @returns { number } Returns the number of times that values are added to the buffer. 1493 * @syscap SystemCapability.Utils.Lang 1494 * @crossplatform 1495 * @since 10 1496 */ 1497 getPutCount(): number; 1498 1499 /** 1500 * Checks whether the current buffer is empty. 1501 * 1502 * @returns { boolean } Returns true if the current buffer contains no value. 1503 * @syscap SystemCapability.Utils.Lang 1504 * @since 9 1505 */ 1506 /** 1507 * Checks whether the current buffer is empty. 1508 * 1509 * @returns { boolean } Returns true if the current buffer contains no value. 1510 * @syscap SystemCapability.Utils.Lang 1511 * @crossplatform 1512 * @since 10 1513 */ 1514 isEmpty(): boolean; 1515 1516 /** 1517 * Obtains the value associated with a specified key. 1518 * 1519 * @param { K } key - Indicates the key to query. 1520 * @returns { V | undefined } Returns the value associated with the key if the specified key is present in the buffer; returns null otherwise. 1521 * @throws { BusinessError } 401 - The type of key must be object. 1522 * @syscap SystemCapability.Utils.Lang 1523 * @since 9 1524 */ 1525 /** 1526 * Obtains the value associated with a specified key. 1527 * 1528 * @param { K } key - Indicates the key to query. 1529 * @returns { V | undefined } Returns the value associated with the key if the specified key is present in the buffer; returns null otherwise. 1530 * @throws { BusinessError } 401 - The type of key must be object. 1531 * @syscap SystemCapability.Utils.Lang 1532 * @crossplatform 1533 * @since 10 1534 */ 1535 get(key: K): V | undefined; 1536 1537 /** 1538 * Adds a key-value pair to the buffer. 1539 * 1540 * @param { K } key - Indicates the key to add. 1541 * @param { V } value - Indicates the value associated with the key to add. 1542 * @returns { V } Returns the value associated with the added key; returns the original value if the key to add already exists. 1543 * @throws { BusinessError } 401 - if the input parameters are invalid. 1544 * @syscap SystemCapability.Utils.Lang 1545 * @since 9 1546 */ 1547 /** 1548 * Adds a key-value pair to the buffer. 1549 * 1550 * @param { K } key - Indicates the key to add. 1551 * @param { V } value - Indicates the value associated with the key to add. 1552 * @returns { V } Returns the value associated with the added key; returns the original value if the key to add already exists. 1553 * @throws { BusinessError } 401 - if the input parameters are invalid. 1554 * @syscap SystemCapability.Utils.Lang 1555 * @crossplatform 1556 * @since 10 1557 */ 1558 put(key: K, value: V): V; 1559 1560 /** 1561 * Obtains a list of all values in the current buffer. 1562 * 1563 * @returns { V[] } Returns the list of all values in the current buffer in ascending order, from the most recently accessed to least recently accessed. 1564 * @syscap SystemCapability.Utils.Lang 1565 * @since 9 1566 */ 1567 /** 1568 * Obtains a list of all values in the current buffer. 1569 * 1570 * @returns { V[] } Returns the list of all values in the current buffer in ascending order, from the most recently accessed to least recently accessed. 1571 * @syscap SystemCapability.Utils.Lang 1572 * @crossplatform 1573 * @since 10 1574 */ 1575 values(): V[]; 1576 1577 /** 1578 * Obtains a list of keys for the values in the current buffer. 1579 * since 9 1580 * 1581 * @returns { K[] } Returns a list of keys sorted from most recently accessed to least recently accessed. 1582 * @syscap SystemCapability.Utils.Lang 1583 * @since 9 1584 */ 1585 /** 1586 * Obtains a list of keys for the values in the current buffer. 1587 * since 9 1588 * 1589 * @returns { K[] } Returns a list of keys sorted from most recently accessed to least recently accessed. 1590 * @syscap SystemCapability.Utils.Lang 1591 * @crossplatform 1592 * @since 10 1593 */ 1594 keys(): K[]; 1595 1596 /** 1597 * Deletes a specified key and its associated value from the current buffer. 1598 * 1599 * @param { K } key - Indicates the key to delete. 1600 * @returns { V | undefined } Returns an Optional object containing the deleted key-value pair; returns an empty Optional object if the key does not exist. 1601 * @throws { BusinessError } 401 - The type of key must be object. 1602 * @syscap SystemCapability.Utils.Lang 1603 * @since 9 1604 */ 1605 /** 1606 * Deletes a specified key and its associated value from the current buffer. 1607 * 1608 * @param { K } key - Indicates the key to delete. 1609 * @returns { V | undefined } Returns an Optional object containing the deleted key-value pair; returns an empty Optional object if the key does not exist. 1610 * @throws { BusinessError } 401 - The type of key must be object. 1611 * @syscap SystemCapability.Utils.Lang 1612 * @crossplatform 1613 * @since 10 1614 */ 1615 remove(key: K): V | undefined; 1616 1617 /** 1618 * Executes subsequent operations after a value is deleted. 1619 * 1620 * @param { boolean } isEvict - The parameter value is true if this method is called due to insufficient capacity, 1621 * and the parameter value is false in other cases. 1622 * @param { K } key - Indicates the deleted key. 1623 * @param { V } value - Indicates the deleted value. 1624 * @param { V } newValue - The parameter value is the new value associated if the put(java.lang.Object,java.lang.Object) 1625 * method is called and the key to add already exists. The parameter value is null in other cases. 1626 * @throws { BusinessError } 401 - if the input parameters are invalid. 1627 * @syscap SystemCapability.Utils.Lang 1628 * @since 9 1629 */ 1630 /** 1631 * Executes subsequent operations after a value is deleted. 1632 * 1633 * @param { boolean } isEvict - The parameter value is true if this method is called due to insufficient capacity, 1634 * and the parameter value is false in other cases. 1635 * @param { K } key - Indicates the deleted key. 1636 * @param { V } value - Indicates the deleted value. 1637 * @param { V } newValue - The parameter value is the new value associated if the put(java.lang.Object,java.lang.Object) 1638 * method is called and the key to add already exists. The parameter value is null in other cases. 1639 * @throws { BusinessError } 401 - if the input parameters are invalid. 1640 * @syscap SystemCapability.Utils.Lang 1641 * @crossplatform 1642 * @since 10 1643 */ 1644 afterRemoval(isEvict: boolean, key: K, value: V, newValue: V): void; 1645 1646 /** 1647 * Checks whether the current buffer contains a specified key. 1648 * 1649 * @param { K } key - Indicates the key to check. 1650 * @returns { boolean } Returns true if the buffer contains the specified key. 1651 * @throws { BusinessError } 401 - The type of key must be object. 1652 * @syscap SystemCapability.Utils.Lang 1653 * @since 9 1654 */ 1655 /** 1656 * Checks whether the current buffer contains a specified key. 1657 * 1658 * @param { K } key - Indicates the key to check. 1659 * @returns { boolean } Returns true if the buffer contains the specified key. 1660 * @throws { BusinessError } 401 - The type of key must be object. 1661 * @syscap SystemCapability.Utils.Lang 1662 * @crossplatform 1663 * @since 10 1664 */ 1665 contains(key: K): boolean; 1666 1667 /** 1668 * Executes subsequent operations if miss to compute a value for the specific key. 1669 * 1670 * @param { K } key - Indicates the missed key. 1671 * @returns { V } Returns the value associated with the key. 1672 * @throws { BusinessError } 401 - The type of key must be object. 1673 * @syscap SystemCapability.Utils.Lang 1674 * @since 9 1675 */ 1676 /** 1677 * Executes subsequent operations if miss to compute a value for the specific key. 1678 * 1679 * @param { K } key - Indicates the missed key. 1680 * @returns { V } Returns the value associated with the key. 1681 * @throws { BusinessError } 401 - The type of key must be object. 1682 * @syscap SystemCapability.Utils.Lang 1683 * @crossplatform 1684 * @since 10 1685 */ 1686 createDefault(key: K): V; 1687 1688 /** 1689 * Returns an array of key-value pairs of enumeratable properties of a given object. 1690 * 1691 * @returns { IterableIterator<[K, V]> } Returns an array of key-value pairs for the enumeratable properties of the given object itself. 1692 * @syscap SystemCapability.Utils.Lang 1693 * @since 9 1694 */ 1695 /** 1696 * Returns an array of key-value pairs of enumeratable properties of a given object. 1697 * 1698 * @returns { IterableIterator<[K, V]> } Returns an array of key-value pairs for the enumeratable properties of the given object itself. 1699 * @syscap SystemCapability.Utils.Lang 1700 * @crossplatform 1701 * @since 10 1702 */ 1703 entries(): IterableIterator<[K, V]>; 1704 1705 /** 1706 * Specifies the default iterator for an object. 1707 * 1708 * @returns { IterableIterator<[K, V]> } Returns a two - dimensional array in the form of key - value pairs. 1709 * @syscap SystemCapability.Utils.Lang 1710 * @since 9 1711 */ 1712 /** 1713 * Specifies the default iterator for an object. 1714 * 1715 * @returns { IterableIterator<[K, V]> } Returns a two - dimensional array in the form of key - value pairs. 1716 * @syscap SystemCapability.Utils.Lang 1717 * @crossplatform 1718 * @since 10 1719 */ 1720 [Symbol.iterator](): IterableIterator<[K, V]>; 1721 } 1722 1723 /** 1724 * The ScopeComparable contains comparison methods. 1725 * 1726 * @interface ScopeComparable 1727 * @syscap SystemCapability.Utils.Lang 1728 * @since 7 1729 */ 1730 /** 1731 * The ScopeComparable contains comparison methods. 1732 * 1733 * @interface ScopeComparable 1734 * @syscap SystemCapability.Utils.Lang 1735 * @crossplatform 1736 * @since 10 1737 */ 1738 interface ScopeComparable { 1739 /** 1740 * The comparison function is used by the scope. 1741 * 1742 * @param { ScopeComparable } other - Other 1743 * @returns { boolean } Returns whether the current object is greater than or equal to the input object. 1744 * @syscap SystemCapability.Utils.Lang 1745 * @since 8 1746 */ 1747 /** 1748 * The comparison function is used by the scope. 1749 * 1750 * @param { ScopeComparable } other - Other 1751 * @returns { boolean } Returns whether the current object is greater than or equal to the input object. 1752 * @syscap SystemCapability.Utils.Lang 1753 * @crossplatform 1754 * @since 10 1755 */ 1756 compareTo(other: ScopeComparable): boolean; 1757 } 1758 1759 /** 1760 * A type used to denote ScopeComparable or number. 1761 * 1762 * @syscap SystemCapability.Utils.Lang 1763 * @since 8 1764 */ 1765 /** 1766 * A type used to denote ScopeComparable or number. 1767 * 1768 * @syscap SystemCapability.Utils.Lang 1769 * @crossplatform 1770 * @since 10 1771 */ 1772 type ScopeType = ScopeComparable | number; 1773 1774 /** 1775 * The Scope interface is used to describe the valid range of a field. 1776 * 1777 * @syscap SystemCapability.Utils.Lang 1778 * @since 8 1779 * @deprecated since 9 1780 * @useinstead ohos.util.ScopeHelper 1781 */ 1782 class Scope { 1783 /** 1784 * A constructor used to create a Scope instance with the lower and upper bounds specified. 1785 * 1786 * @param { ScopeType } lowerObj - A ScopeType value 1787 * @param { ScopeType } upperObj - A ScopeType value 1788 * @syscap SystemCapability.Utils.Lang 1789 * @since 8 1790 * @deprecated since 9 1791 * @useinstead ohos.util.ScopeHelper.constructor 1792 */ 1793 constructor(lowerObj: ScopeType, upperObj: ScopeType); 1794 1795 /** 1796 * Obtains a string representation of the current range. 1797 * 1798 * @returns { string } Returns a string representation of the current range object. 1799 * @syscap SystemCapability.Utils.Lang 1800 * @since 8 1801 * @deprecated since 9 1802 * @useinstead ohos.util.ScopeHelper.toString 1803 */ 1804 toString(): string; 1805 1806 /** 1807 * Returns the intersection of a given range and the current range. 1808 * 1809 * @param { Scope } range - A Scope range object 1810 * @returns { Scope } Returns the intersection of a given range and the current range. 1811 * @syscap SystemCapability.Utils.Lang 1812 * @since 8 1813 * @deprecated since 9 1814 * @useinstead ohos.util.ScopeHelper.intersect 1815 */ 1816 intersect(range: Scope): Scope; 1817 1818 /** 1819 * Returns the intersection of the current range and the range specified by the given lower and upper bounds. 1820 * 1821 * @param { ScopeType } lowerObj - A ScopeType value 1822 * @param { ScopeType } upperObj - A ScopeType value 1823 * @returns { Scope } Returns the intersection of the current range and the range specified by the given lower and upper bounds. 1824 * @syscap SystemCapability.Utils.Lang 1825 * @since 8 1826 * @deprecated since 9 1827 * @useinstead ohos.util.ScopeHelper.intersect 1828 */ 1829 intersect(lowerObj: ScopeType, upperObj: ScopeType): Scope; 1830 1831 /** 1832 * Obtains the upper bound of the current range. 1833 * 1834 * @returns { ScopeType } Returns the upper bound of the current range. 1835 * @syscap SystemCapability.Utils.Lang 1836 * @since 8 1837 * @deprecated since 9 1838 * @useinstead ohos.util.ScopeHelper.getUpper 1839 */ 1840 getUpper(): ScopeType; 1841 1842 /** 1843 * Obtains the lower bound of the current range. 1844 * 1845 * @returns { ScopeType } Returns the lower bound of the current range. 1846 * @syscap SystemCapability.Utils.Lang 1847 * @since 8 1848 * @deprecated since 9 1849 * @useinstead ohos.util.ScopeHelper.getLower 1850 */ 1851 getLower(): ScopeType; 1852 1853 /** 1854 * Creates the smallest range that includes the current range and the given lower and upper bounds. 1855 * 1856 * @param { ScopeType } lowerObj - A ScopeType value 1857 * @param { ScopeType } upperObj - A ScopeType value 1858 * @returns { Scope } Returns the smallest range that includes the current range and the given lower and upper bounds. 1859 * @syscap SystemCapability.Utils.Lang 1860 * @since 8 1861 * @deprecated since 9 1862 * @useinstead ohos.util.ScopeHelper.expand 1863 */ 1864 expand(lowerObj: ScopeType, upperObj: ScopeType): Scope; 1865 1866 /** 1867 * Creates the smallest range that includes the current range and a given range. 1868 * 1869 * @param { Scope } range - A Scope range object 1870 * @returns { Scope } Returns the smallest range that includes the current range and a given range. 1871 * @syscap SystemCapability.Utils.Lang 1872 * @since 8 1873 * @deprecated since 9 1874 * @useinstead ohos.util.ScopeHelper.expand 1875 */ 1876 expand(range: Scope): Scope; 1877 1878 /** 1879 * Creates the smallest range that includes the current range and a given value. 1880 * 1881 * @param { ScopeType } value - A ScopeType value 1882 * @returns { Scope } Returns the smallest range that includes the current range and a given value. 1883 * @syscap SystemCapability.Utils.Lang 1884 * @since 8 1885 * @deprecated since 9 1886 * @useinstead ohos.util.ScopeHelper.expand 1887 */ 1888 expand(value: ScopeType): Scope; 1889 1890 /** 1891 * Checks whether a given value is within the current range. 1892 * 1893 * @param { ScopeType } value - A ScopeType value 1894 * @returns { boolean } If the value is within the current range return true,otherwise return false. 1895 * @syscap SystemCapability.Utils.Lang 1896 * @since 8 1897 * @deprecated since 9 1898 * @useinstead ohos.util.ScopeHelper.contains 1899 */ 1900 contains(value: ScopeType): boolean; 1901 1902 /** 1903 * Checks whether a given range is within the current range. 1904 * 1905 * @param { Scope } range - A Scope range 1906 * @returns { boolean } If the current range is within the given range return true,otherwise return false. 1907 * @syscap SystemCapability.Utils.Lang 1908 * @since 8 1909 * @deprecated since 9 1910 * @useinstead ohos.util.ScopeHelper.contains 1911 */ 1912 contains(range: Scope): boolean; 1913 1914 /** 1915 * Clamps a given value to the current range. 1916 * 1917 * @param { ScopeType } value - A ScopeType value 1918 * @returns { ScopeType } Returns a ScopeType object that a given value is clamped to the current range.. 1919 * @syscap SystemCapability.Utils.Lang 1920 * @since 8 1921 * @deprecated since 9 1922 * @useinstead ohos.util.ScopeHelper.clamp 1923 */ 1924 clamp(value: ScopeType): ScopeType; 1925 } 1926 1927 /** 1928 * The ScopeHelper interface is used to describe the valid range of a field. 1929 * 1930 * @syscap SystemCapability.Utils.Lang 1931 * @since 9 1932 */ 1933 /** 1934 * The ScopeHelper interface is used to describe the valid range of a field. 1935 * 1936 * @syscap SystemCapability.Utils.Lang 1937 * @crossplatform 1938 * @since 10 1939 */ 1940 class ScopeHelper { 1941 /** 1942 * A constructor used to create a Scope instance with the lower and upper bounds specified. 1943 * 1944 * @param { ScopeType } lowerObj - A ScopeType value 1945 * @param { ScopeType } upperObj - A ScopeType value 1946 * @throws { BusinessError } 401 - if the input parameters are invalid. 1947 * @syscap SystemCapability.Utils.Lang 1948 * @since 9 1949 */ 1950 /** 1951 * A constructor used to create a Scope instance with the lower and upper bounds specified. 1952 * 1953 * @param { ScopeType } lowerObj - A ScopeType value 1954 * @param { ScopeType } upperObj - A ScopeType value 1955 * @throws { BusinessError } 401 - if the input parameters are invalid. 1956 * @syscap SystemCapability.Utils.Lang 1957 * @crossplatform 1958 * @since 10 1959 */ 1960 constructor(lowerObj: ScopeType, upperObj: ScopeType); 1961 1962 /** 1963 * Obtains a string representation of the current range. 1964 * 1965 * @returns { string } Returns a string representation of the current range object. 1966 * @syscap SystemCapability.Utils.Lang 1967 * @since 9 1968 */ 1969 /** 1970 * Obtains a string representation of the current range. 1971 * 1972 * @returns { string } Returns a string representation of the current range object. 1973 * @syscap SystemCapability.Utils.Lang 1974 * @crossplatform 1975 * @since 10 1976 */ 1977 toString(): string; 1978 1979 /** 1980 * Returns the intersection of a given range and the current range. 1981 * 1982 * @param { ScopeHelper } range - A Scope range object 1983 * @returns { ScopeHelper } Returns the intersection of a given range and the current range. 1984 * @throws { BusinessError } 401 - The type of range must be ScopeHelper. 1985 * @syscap SystemCapability.Utils.Lang 1986 * @since 9 1987 */ 1988 /** 1989 * Returns the intersection of a given range and the current range. 1990 * 1991 * @param { ScopeHelper } range - A Scope range object 1992 * @returns { ScopeHelper } Returns the intersection of a given range and the current range. 1993 * @throws { BusinessError } 401 - The type of range must be ScopeHelper. 1994 * @syscap SystemCapability.Utils.Lang 1995 * @crossplatform 1996 * @since 10 1997 */ 1998 intersect(range: ScopeHelper): ScopeHelper; 1999 2000 /** 2001 * Returns the intersection of the current range and the range specified by the given lower and upper bounds. 2002 * 2003 * @param { ScopeType } lowerObj - A ScopeType value 2004 * @param { ScopeType } upperObj - A ScopeType value 2005 * @returns { ScopeHelper } Returns the intersection of the current range and the range specified by the given lower and upper bounds. 2006 * @throws { BusinessError } 401 - if the input parameters are invalid. 2007 * @syscap SystemCapability.Utils.Lang 2008 * @since 9 2009 */ 2010 /** 2011 * Returns the intersection of the current range and the range specified by the given lower and upper bounds. 2012 * 2013 * @param { ScopeType } lowerObj - A ScopeType value 2014 * @param { ScopeType } upperObj - A ScopeType value 2015 * @returns { ScopeHelper } Returns the intersection of the current range and the range specified by the given lower and upper bounds. 2016 * @throws { BusinessError } 401 - if the input parameters are invalid. 2017 * @syscap SystemCapability.Utils.Lang 2018 * @crossplatform 2019 * @since 10 2020 */ 2021 intersect(lowerObj: ScopeType, upperObj: ScopeType): ScopeHelper; 2022 2023 /** 2024 * Obtains the upper bound of the current range. 2025 * 2026 * @returns { ScopeType } Returns the upper bound of the current range. 2027 * @syscap SystemCapability.Utils.Lang 2028 * @since 9 2029 */ 2030 /** 2031 * Obtains the upper bound of the current range. 2032 * 2033 * @returns { ScopeType } Returns the upper bound of the current range. 2034 * @syscap SystemCapability.Utils.Lang 2035 * @crossplatform 2036 * @since 10 2037 */ 2038 getUpper(): ScopeType; 2039 2040 /** 2041 * Obtains the lower bound of the current range. 2042 * 2043 * @returns { ScopeType } Returns the lower bound of the current range. 2044 * @syscap SystemCapability.Utils.Lang 2045 * @since 9 2046 */ 2047 /** 2048 * Obtains the lower bound of the current range. 2049 * 2050 * @returns { ScopeType } Returns the lower bound of the current range. 2051 * @syscap SystemCapability.Utils.Lang 2052 * @crossplatform 2053 * @since 10 2054 */ 2055 getLower(): ScopeType; 2056 2057 /** 2058 * Creates the smallest range that includes the current range and the given lower and upper bounds. 2059 * 2060 * @param { ScopeType } lowerObj - A ScopeType value 2061 * @param { ScopeType } upperObj - A ScopeType value 2062 * @returns { ScopeHelper } Returns the smallest range that includes the current range and the given lower and upper bounds. 2063 * @throws { BusinessError } 401 - if the input parameters are invalid. 2064 * @syscap SystemCapability.Utils.Lang 2065 * @since 9 2066 */ 2067 expand(lowerObj: ScopeType, upperObj: ScopeType): ScopeHelper; 2068 2069 /** 2070 * Creates the smallest range that includes the current range and a given range. 2071 * 2072 * @param { ScopeHelper } range - A Scope range object 2073 * @returns { ScopeHelper } Returns the smallest range that includes the current range and a given range. 2074 * @throws { BusinessError } 401 - The type of range must be ScopeHelper. 2075 * @syscap SystemCapability.Utils.Lang 2076 * @since 9 2077 */ 2078 /** 2079 * Creates the smallest range that includes the current range and a given range. 2080 * 2081 * @param { ScopeHelper } range - A Scope range object 2082 * @returns { ScopeHelper } Returns the smallest range that includes the current range and a given range. 2083 * @throws { BusinessError } 401 - The type of range must be ScopeHelper. 2084 * @syscap SystemCapability.Utils.Lang 2085 * @crossplatform 2086 * @since 10 2087 */ 2088 expand(range: ScopeHelper): ScopeHelper; 2089 2090 /** 2091 * Creates the smallest range that includes the current range and a given value. 2092 * 2093 * @param { ScopeType } value - A ScopeType value 2094 * @returns { ScopeHelper } Returns the smallest range that includes the current range and a given value. 2095 * @throws { BusinessError } 401 - The type of value must be object. 2096 * @syscap SystemCapability.Utils.Lang 2097 * @since 9 2098 */ 2099 /** 2100 * Creates the smallest range that includes the current range and a given value. 2101 * 2102 * @param { ScopeType } value - A ScopeType value 2103 * @returns { ScopeHelper } Returns the smallest range that includes the current range and a given value. 2104 * @throws { BusinessError } 401 - The type of value must be object. 2105 * @syscap SystemCapability.Utils.Lang 2106 * @crossplatform 2107 * @since 10 2108 */ 2109 expand(value: ScopeType): ScopeHelper; 2110 2111 /** 2112 * Checks whether a given value is within the current range. 2113 * 2114 * @param { ScopeType } value - A ScopeType value 2115 * @returns { boolean } If the value is within the current range return true,otherwise return false. 2116 * @throws { BusinessError } 401 - The type of value must be object. 2117 * @syscap SystemCapability.Utils.Lang 2118 * @since 9 2119 */ 2120 /** 2121 * Checks whether a given value is within the current range. 2122 * 2123 * @param { ScopeType } value - A ScopeType value 2124 * @returns { boolean } If the value is within the current range return true,otherwise return false. 2125 * @throws { BusinessError } 401 - The type of value must be object. 2126 * @syscap SystemCapability.Utils.Lang 2127 * @crossplatform 2128 * @since 10 2129 */ 2130 contains(value: ScopeType): boolean; 2131 2132 /** 2133 * Checks whether a given range is within the current range. 2134 * 2135 * @param { ScopeHelper } range - A Scope range 2136 * @returns { boolean } If the current range is within the given range return true,otherwise return false. 2137 * @throws { BusinessError } 401 - The type of range must be ScopeHelper. 2138 * @syscap SystemCapability.Utils.Lang 2139 * @since 9 2140 */ 2141 /** 2142 * Checks whether a given range is within the current range. 2143 * 2144 * @param { ScopeHelper } range - A Scope range 2145 * @returns { boolean } If the current range is within the given range return true,otherwise return false. 2146 * @throws { BusinessError } 401 - The type of range must be ScopeHelper. 2147 * @syscap SystemCapability.Utils.Lang 2148 * @crossplatform 2149 * @since 10 2150 */ 2151 contains(range: ScopeHelper): boolean; 2152 2153 /** 2154 * Clamps a given value to the current range. 2155 * 2156 * @param { ScopeType } value - A ScopeType value 2157 * @returns { ScopeType } Returns a ScopeType object that a given value is clamped to the current range. 2158 * @throws { BusinessError } 401 - The type of value must be object. 2159 * @syscap SystemCapability.Utils.Lang 2160 * @since 9 2161 */ 2162 /** 2163 * Clamps a given value to the current range. 2164 * 2165 * @param { ScopeType } value - A ScopeType value 2166 * @returns { ScopeType } Returns a ScopeType object that a given value is clamped to the current range. 2167 * @throws { BusinessError } 401 - The type of value must be object. 2168 * @syscap SystemCapability.Utils.Lang 2169 * @crossplatform 2170 * @since 10 2171 */ 2172 clamp(value: ScopeType): ScopeType; 2173 } 2174 2175 /** 2176 * Decodes a Base64 encoded String or input u8 array into a newly-allocated 2177 * u8 array using the Base64 encoding scheme. 2178 * 2179 * @syscap SystemCapability.Utils.Lang 2180 * @since 8 2181 * @deprecated since 9 2182 * @useinstead ohos.util.Base64Helper 2183 */ 2184 class Base64 { 2185 /** 2186 * Constructor for creating base64 encoding and decoding 2187 * 2188 * @syscap SystemCapability.Utils.Lang 2189 * @since 8 2190 * @deprecated since 9 2191 * @useinstead ohos.util.Base64Helper.constructor 2192 */ 2193 constructor(); 2194 2195 /** 2196 * Encodes all bytes from the specified u8 array into a newly-allocated u8 array using the Base64 encoding scheme. 2197 * 2198 * @param { Uint8Array } src - A Uint8Array value 2199 * @returns { Uint8Array } Return the encoded new Uint8Array. 2200 * @syscap SystemCapability.Utils.Lang 2201 * @since 8 2202 * @deprecated since 9 2203 * @useinstead ohos.util.Base64Helper.encodeSync 2204 */ 2205 encodeSync(src: Uint8Array): Uint8Array; 2206 2207 /** 2208 * Encodes the specified byte array into a String using the Base64 encoding scheme. 2209 * 2210 * @param { Uint8Array } src - A Uint8Array value 2211 * @returns { string } Return the encoded string. 2212 * @syscap SystemCapability.Utils.Lang 2213 * @since 8 2214 * @deprecated since 9 2215 * @useinstead ohos.util.Base64Helper.encodeToStringSync 2216 */ 2217 encodeToStringSync(src: Uint8Array): string; 2218 2219 /** 2220 * Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme. 2221 * 2222 * @param { Uint8Array | string } src - A Uint8Array value or value A string value 2223 * @returns { Uint8Array } Return the decoded Uint8Array. 2224 * @syscap SystemCapability.Utils.Lang 2225 * @since 8 2226 * @deprecated since 9 2227 * @useinstead ohos.util.Base64Helper.decodeSync 2228 */ 2229 decodeSync(src: Uint8Array | string): Uint8Array; 2230 2231 /** 2232 * Asynchronously encodes all bytes in the specified u8 array into the newly allocated u8 array using the Base64 encoding scheme. 2233 * 2234 * @param { Uint8Array } src - A Uint8Array value 2235 * @returns { Promise<Uint8Array> } Return the encodes asynchronous new Uint8Array. 2236 * @syscap SystemCapability.Utils.Lang 2237 * @since 8 2238 * @deprecated since 9 2239 * @useinstead ohos.util.Base64Helper.encode 2240 */ 2241 encode(src: Uint8Array): Promise<Uint8Array>; 2242 2243 /** 2244 * Asynchronously encodes the specified byte array into a String using the Base64 encoding scheme. 2245 * 2246 * @param { Uint8Array } src - A Uint8Array value 2247 * @returns { Promise<string> } Returns the encoded asynchronous string. 2248 * @syscap SystemCapability.Utils.Lang 2249 * @since 8 2250 * @deprecated since 9 2251 * @useinstead ohos.util.Base64Helper.encodeToString 2252 */ 2253 encodeToString(src: Uint8Array): Promise<string>; 2254 2255 /** 2256 * Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 array into a newly allocated u8 array. 2257 * 2258 * @param { Uint8Array | string } src - A Uint8Array value or value A string value 2259 * @returns { Promise<Uint8Array> } Return the decoded asynchronous Uint8Array. 2260 * @syscap SystemCapability.Utils.Lang 2261 * @since 8 2262 * @deprecated since 9 2263 * @useinstead ohos.util.Base64Helper.decode 2264 */ 2265 decode(src: Uint8Array | string): Promise<Uint8Array>; 2266 } 2267 2268 /** 2269 * The Type represents two different encoding formats for base64 2270 * 2271 * @enum { number } Type 2272 * @syscap SystemCapability.Utils.Lang 2273 * @crossplatform 2274 * @since 10 2275 */ 2276 /** 2277 * The Type represents two different encoding formats for base64 2278 * 2279 * @enum { number } Type 2280 * @syscap SystemCapability.Utils.Lang 2281 * @crossplatform 2282 * @atomicservice 2283 * @since 11 2284 */ 2285 enum Type { 2286 /** 2287 * The value indicates that the encoding format of base64 is BASIC 2288 * @syscap SystemCapability.Utils.Lang 2289 * @crossplatform 2290 * @since 10 2291 */ 2292 /** 2293 * The value indicates that the encoding format of base64 is BASIC 2294 * @syscap SystemCapability.Utils.Lang 2295 * @crossplatform 2296 * @atomicservice 2297 * @since 11 2298 */ 2299 BASIC, 2300 /** 2301 * The value indicates that the encoding format of base64 is MIME 2302 * @syscap SystemCapability.Utils.Lang 2303 * @crossplatform 2304 * @since 10 2305 */ 2306 /** 2307 * The value indicates that the encoding format of base64 is MIME 2308 * @syscap SystemCapability.Utils.Lang 2309 * @crossplatform 2310 * @atomicservice 2311 * @since 11 2312 */ 2313 MIME 2314 } 2315 2316 /** 2317 * Decodes a Base64 encoded String or input u8 array into a newly-allocated 2318 * u8 array using the Base64 encoding scheme. 2319 * 2320 * @syscap SystemCapability.Utils.Lang 2321 * @since 9 2322 */ 2323 /** 2324 * Decodes a Base64 encoded String or input u8 array into a newly-allocated 2325 * u8 array using the Base64 encoding scheme. 2326 * 2327 * @syscap SystemCapability.Utils.Lang 2328 * @crossplatform 2329 * @since 10 2330 */ 2331 /** 2332 * Decodes a Base64 encoded String or input u8 array into a newly-allocated 2333 * u8 array using the Base64 encoding scheme. 2334 * 2335 * @syscap SystemCapability.Utils.Lang 2336 * @crossplatform 2337 * @atomicservice 2338 * @since 11 2339 */ 2340 class Base64Helper { 2341 /** 2342 * Constructor for creating base64 encoding and decoding 2343 * 2344 * @syscap SystemCapability.Utils.Lang 2345 * @since 9 2346 */ 2347 /** 2348 * Constructor for creating base64 encoding and decoding 2349 * 2350 * @syscap SystemCapability.Utils.Lang 2351 * @crossplatform 2352 * @since 10 2353 */ 2354 /** 2355 * Constructor for creating base64 encoding and decoding 2356 * 2357 * @syscap SystemCapability.Utils.Lang 2358 * @crossplatform 2359 * @atomicservice 2360 * @since 11 2361 */ 2362 constructor(); 2363 2364 /** 2365 * Encodes all bytes from the specified u8 array into a newly-allocated u8 array using the Base64 encoding scheme. 2366 * 2367 * @param { Uint8Array } src - A Uint8Array value 2368 * @returns { Uint8Array } Return the encoded new Uint8Array. 2369 * @throws { BusinessError } 401 - The type of src must be Uint8Array. 2370 * @syscap SystemCapability.Utils.Lang 2371 * @since 9 2372 */ 2373 /** 2374 * Encodes all bytes from the specified u8 array into a newly-allocated u8 array using the Base64 encoding scheme. 2375 * 2376 * @param { Uint8Array } src - A Uint8Array value 2377 * @returns { Uint8Array } Return the encoded new Uint8Array. 2378 * @throws { BusinessError } 401 - The type of src must be Uint8Array. 2379 * @syscap SystemCapability.Utils.Lang 2380 * @crossplatform 2381 * @since 10 2382 */ 2383 /** 2384 * Encodes all bytes from the specified u8 array into a newly-allocated u8 array using the Base64 encoding scheme. 2385 * 2386 * @param { Uint8Array } src - A Uint8Array value 2387 * @returns { Uint8Array } Return the encoded new Uint8Array. 2388 * @throws { BusinessError } 401 - The type of src must be Uint8Array. 2389 * @syscap SystemCapability.Utils.Lang 2390 * @crossplatform 2391 * @atomicservice 2392 * @since 11 2393 */ 2394 encodeSync(src: Uint8Array): Uint8Array; 2395 2396 /** 2397 * Encodes the specified byte array into a String using the Base64 encoding scheme. 2398 * 2399 * @param { Uint8Array } src - A Uint8Array value 2400 * @returns { string } Return the encoded string. 2401 * @throws { BusinessError } 401 - The type of src must be Uint8Array. 2402 * @syscap SystemCapability.Utils.Lang 2403 * @since 9 2404 */ 2405 /** 2406 * Encodes the specified byte array into a String using the Base64 encoding scheme. 2407 * 2408 * @param { Uint8Array } src - A Uint8Array value 2409 * @param { Type } [options] - Enumerating input parameters includes two encoding formats: BASIC and MIME 2410 * @returns { string } Return the encoded string. 2411 * @throws { BusinessError } 401 - The type of src must be Uint8Array. 2412 * @syscap SystemCapability.Utils.Lang 2413 * @crossplatform 2414 * @since 10 2415 */ 2416 /** 2417 * Encodes the specified byte array into a String using the Base64 encoding scheme. 2418 * 2419 * @param { Uint8Array } src - A Uint8Array value 2420 * @param { Type } options - Enumerating input parameters includes two encoding formats: BASIC and MIME 2421 * @returns { string } Return the encoded string. 2422 * @throws { BusinessError } 401 - The type of src must be Uint8Array. 2423 * @syscap SystemCapability.Utils.Lang 2424 * @crossplatform 2425 * @atomicservice 2426 * @since 11 2427 */ 2428 encodeToStringSync(src: Uint8Array, options?: Type): string; 2429 2430 /** 2431 * Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme. 2432 * 2433 * @param { Uint8Array | string } src - A Uint8Array value or value A string value 2434 * @returns { Uint8Array } Return the decoded Uint8Array. 2435 * @throws { BusinessError } 401 - The type of src must be Uint8Array or string. 2436 * @syscap SystemCapability.Utils.Lang 2437 * @since 9 2438 */ 2439 /** 2440 * Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme. 2441 * 2442 * @param { Uint8Array | string } src - A Uint8Array value or value A string value 2443 * @param { Type } [options] - Enumerating input parameters includes two encoding formats: BASIC and MIME 2444 * @returns { Uint8Array } Return the decoded Uint8Array. 2445 * @throws { BusinessError } 401 - The type of src must be Uint8Array or string. 2446 * @syscap SystemCapability.Utils.Lang 2447 * @crossplatform 2448 * @since 10 2449 */ 2450 /** 2451 * Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme. 2452 * 2453 * @param { Uint8Array | string } src - A Uint8Array value or value A string value 2454 * @param { Type } [options] - Enumerating input parameters includes two encoding formats: BASIC and MIME 2455 * @returns { Uint8Array } Return the decoded Uint8Array. 2456 * @throws { BusinessError } 401 - The type of src must be Uint8Array or string. 2457 * @syscap SystemCapability.Utils.Lang 2458 * @crossplatform 2459 * @atomicservice 2460 * @since 11 2461 */ 2462 decodeSync(src: Uint8Array | string, options?: Type): Uint8Array; 2463 2464 /** 2465 * Asynchronously encodes all bytes in the specified u8 array into the newly allocated u8 array using the Base64 encoding scheme. 2466 * 2467 * @param { Uint8Array } src - A Uint8Array value 2468 * @returns { Promise<Uint8Array> } Return the encodes asynchronous new Uint8Array. 2469 * @throws { BusinessError } 401 - The type of src must be Uint8Array. 2470 * @syscap SystemCapability.Utils.Lang 2471 * @since 9 2472 */ 2473 /** 2474 * Asynchronously encodes all bytes in the specified u8 array into the newly allocated u8 array using the Base64 encoding scheme. 2475 * 2476 * @param { Uint8Array } src - A Uint8Array value 2477 * @returns { Promise<Uint8Array> } Return the encodes asynchronous new Uint8Array. 2478 * @throws { BusinessError } 401 - The type of src must be Uint8Array. 2479 * @syscap SystemCapability.Utils.Lang 2480 * @crossplatform 2481 * @since 10 2482 */ 2483 /** 2484 * Asynchronously encodes all bytes in the specified u8 array into the newly allocated u8 array using the Base64 encoding scheme. 2485 * 2486 * @param { Uint8Array } src - A Uint8Array value 2487 * @returns { Promise<Uint8Array> } Return the encodes asynchronous new Uint8Array. 2488 * @throws { BusinessError } 401 - The type of src must be Uint8Array. 2489 * @syscap SystemCapability.Utils.Lang 2490 * @crossplatform 2491 * @atomicservice 2492 * @since 11 2493 */ 2494 encode(src: Uint8Array): Promise<Uint8Array>; 2495 2496 /** 2497 * Asynchronously encodes the specified byte array into a String using the Base64 encoding scheme. 2498 * 2499 * @param { Uint8Array } src - A Uint8Array value 2500 * @returns { Promise<string> } Returns the encoded asynchronous string. 2501 * @throws { BusinessError } 401 - The type of src must be Uint8Array. 2502 * @syscap SystemCapability.Utils.Lang 2503 * @since 9 2504 */ 2505 /** 2506 * Asynchronously encodes the specified byte array into a String using the Base64 encoding scheme. 2507 * 2508 * @param { Uint8Array } src - A Uint8Array value 2509 * @param { Type } [options] - Enumerating input parameters includes two encoding formats: BASIC and MIME 2510 * @returns { Promise<string> } Returns the encoded asynchronous string. 2511 * @throws { BusinessError } 401 - The type of src must be Uint8Array. 2512 * @syscap SystemCapability.Utils.Lang 2513 * @crossplatform 2514 * @since 10 2515 */ 2516 encodeToString(src: Uint8Array, options?: Type): Promise<string>; 2517 2518 /** 2519 * Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or 2520 * input u8 array into a newly allocated u8 array. 2521 * 2522 * @param { Uint8Array | string } src - A Uint8Array value or value A string value 2523 * @returns { Promise<Uint8Array> } Return the decoded asynchronous Uint8Array. 2524 * @throws { BusinessError } 401 - The type of src must be Uint8Array or string. 2525 * @syscap SystemCapability.Utils.Lang 2526 * @since 9 2527 */ 2528 /** 2529 * Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or 2530 * input u8 array into a newly allocated u8 array. 2531 * 2532 * @param { Uint8Array | string } src - A Uint8Array value or value A string value 2533 * @param { Type } [options] - Enumerating input parameters includes two encoding formats: BASIC and MIME 2534 * @returns { Promise<Uint8Array> } Return the decoded asynchronous Uint8Array. 2535 * @throws { BusinessError } 401 - The type of src must be Uint8Array or string. 2536 * @syscap SystemCapability.Utils.Lang 2537 * @crossplatform 2538 * @since 10 2539 */ 2540 decode(src: Uint8Array | string, options?: Type): Promise<Uint8Array>; 2541 } 2542 2543 /** 2544 * Check the type of parameter. 2545 * 2546 * @syscap SystemCapability.Utils.Lang 2547 * @since 8 2548 */ 2549 /** 2550 * Check the type of parameter. 2551 * 2552 * @syscap SystemCapability.Utils.Lang 2553 * @crossplatform 2554 * @since 10 2555 */ 2556 class types { 2557 /** 2558 * The types constructor 2559 * 2560 * @syscap SystemCapability.Utils.Lang 2561 * @since 8 2562 */ 2563 /** 2564 * The types constructor 2565 * 2566 * @syscap SystemCapability.Utils.Lang 2567 * @crossplatform 2568 * @since 10 2569 */ 2570 constructor(); 2571 /** 2572 * Check whether the entered value is of arraybuffer or sharedarraybuffer type. 2573 * 2574 * @param { Object } value - A ArrayBuffer or SharedArrayBuffer value 2575 * @returns { boolean } Returns true if the value is a built-in ArrayBuffer or SharedArrayBuffer instance. 2576 * @syscap SystemCapability.Utils.Lang 2577 * @since 8 2578 */ 2579 /** 2580 * Check whether the entered value is of arraybuffer or sharedarraybuffer type. 2581 * 2582 * @param { Object } value - A ArrayBuffer or SharedArrayBuffer value 2583 * @returns { boolean } Returns true if the value is a built-in ArrayBuffer or SharedArrayBuffer instance. 2584 * @syscap SystemCapability.Utils.Lang 2585 * @crossplatform 2586 * @since 10 2587 */ 2588 isAnyArrayBuffer(value: Object): boolean; 2589 /** 2590 * Check whether the type is included in the isAnyArrayBuffer. 2591 * 2592 * @param { Object } value - A included in the isAnyArrayBuffer value 2593 * @returns { boolean } Returns true if the value is an instance of one of the ArrayBuffer views, 2594 * such as typed array objects or DataView. Equivalent to ArrayBuffer.isView(). 2595 * @syscap SystemCapability.Utils.Lang 2596 * @since 8 2597 */ 2598 /** 2599 * Check whether the type is included in the isAnyArrayBuffer. 2600 * 2601 * @param { Object } value - A included in the isAnyArrayBuffer value 2602 * @returns { boolean } Returns true if the value is an instance of one of the ArrayBuffer views, 2603 * such as typed array objects or DataView. Equivalent to ArrayBuffer.isView(). 2604 * @syscap SystemCapability.Utils.Lang 2605 * @crossplatform 2606 * @since 10 2607 */ 2608 isArrayBufferView(value: Object): boolean; 2609 /** 2610 * Check whether the entered value is an arguments object type. 2611 * 2612 * @param { Object } value - A arguments value 2613 * @returns { boolean } Returns true if the value is an arguments object. 2614 * @syscap SystemCapability.Utils.Lang 2615 * @since 8 2616 */ 2617 /** 2618 * Check whether the entered value is an arguments object type. 2619 * 2620 * @param { Object } value - A arguments value 2621 * @returns { boolean } Returns true if the value is an arguments object. 2622 * @syscap SystemCapability.Utils.Lang 2623 * @crossplatform 2624 * @since 10 2625 */ 2626 isArgumentsObject(value: Object): boolean; 2627 /** 2628 * Check whether the entered value is of arraybuffer type. 2629 * 2630 * @param { Object } value - A arraybuffer value 2631 * @returns { boolean } Returns true if the value is a built-in ArrayBuffer instance. This does not include SharedArrayBuffer instances. 2632 * Usually, it is desirable to test for both; See isAnyArrayBuffer() for that. 2633 * @syscap SystemCapability.Utils.Lang 2634 * @since 8 2635 */ 2636 /** 2637 * Check whether the entered value is of arraybuffer type. 2638 * 2639 * @param { Object } value - A arraybuffer value 2640 * @returns { boolean } Returns true if the value is a built-in ArrayBuffer instance. This does not include SharedArrayBuffer instances. 2641 * Usually, it is desirable to test for both; See isAnyArrayBuffer() for that. 2642 * @syscap SystemCapability.Utils.Lang 2643 * @crossplatform 2644 * @since 10 2645 */ 2646 isArrayBuffer(value: Object): boolean; 2647 /** 2648 * Check whether the value entered is an asynchronous function type. 2649 * 2650 * @param { Object } value - A async function value 2651 * @returns { boolean } Returns true if the value is an async function. This only reports back what the JavaScript engine is seeing; 2652 * in particular, the return value may not match the original source code if a transpilation tool was used. 2653 * @syscap SystemCapability.Utils.Lang 2654 * @since 8 2655 */ 2656 /** 2657 * Check whether the value entered is an asynchronous function type. 2658 * 2659 * @param { Object } value - A async function value 2660 * @returns { boolean } Returns true if the value is an async function. This only reports back what the JavaScript engine is seeing; 2661 * in particular, the return value may not match the original source code if a transpilation tool was used. 2662 * @syscap SystemCapability.Utils.Lang 2663 * @crossplatform 2664 * @since 10 2665 */ 2666 isAsyncFunction(value: Object): boolean; 2667 /** 2668 * Check whether the entered value is of bigint64array array type. 2669 * 2670 * @param { Object } value - A BigInt64Array value 2671 * @returns { boolean } Returns true if the value is a BigInt64Array instance. 2672 * @syscap SystemCapability.Utils.Lang 2673 * @since 8 2674 */ 2675 /** 2676 * Check whether the entered value is of bigint64array array type. 2677 * 2678 * @param { Object } value - A BigInt64Array value 2679 * @returns { boolean } Returns true if the value is a BigInt64Array instance. 2680 * @syscap SystemCapability.Utils.Lang 2681 * @crossplatform 2682 * @since 10 2683 */ 2684 isBigInt64Array(value: Object): boolean; 2685 /** 2686 * Check whether the entered value is of biguint64array array array type. 2687 * 2688 * @param { Object } value - A BigUint64Array value 2689 * @returns { boolean } Returns true if the value is a BigUint64Array instance. 2690 * @syscap SystemCapability.Utils.Lang 2691 * @since 8 2692 */ 2693 /** 2694 * Check whether the entered value is of biguint64array array array type. 2695 * 2696 * @param { Object } value - A BigUint64Array value 2697 * @returns { boolean } Returns true if the value is a BigUint64Array instance. 2698 * @syscap SystemCapability.Utils.Lang 2699 * @crossplatform 2700 * @since 10 2701 */ 2702 isBigUint64Array(value: Object): boolean; 2703 /** 2704 * Check whether the entered value is a Boolean object type. 2705 * 2706 * @param { Object } value - A boolean object value 2707 * @returns { boolean } Returns true if the value is a boolean object, e.g. created by new Boolean(). 2708 * @syscap SystemCapability.Utils.Lang 2709 * @since 8 2710 */ 2711 /** 2712 * Check whether the entered value is a Boolean object type. 2713 * 2714 * @param { Object } value - A boolean object value 2715 * @returns { boolean } Returns true if the value is a boolean object, e.g. created by new Boolean(). 2716 * @syscap SystemCapability.Utils.Lang 2717 * @crossplatform 2718 * @since 10 2719 */ 2720 isBooleanObject(value: Object): boolean; 2721 /** 2722 * Check whether the entered value is a Boolean or number or string or symbol object type. 2723 * 2724 * @param { Object } value - A boxed primitive object value 2725 * @returns { boolean } Returns true if the value is any boxed primitive object, e.g. created by new Boolean(), new String() or Object(Symbol()). 2726 * @syscap SystemCapability.Utils.Lang 2727 * @since 8 2728 */ 2729 /** 2730 * Check whether the entered value is a Boolean or number or string or symbol object type. 2731 * 2732 * @param { Object } value - A boxed primitive object value 2733 * @returns { boolean } Returns true if the value is any boxed primitive object, e.g. created by new Boolean(), new String() or Object(Symbol()). 2734 * @syscap SystemCapability.Utils.Lang 2735 * @crossplatform 2736 * @since 10 2737 */ 2738 isBoxedPrimitive(value: Object): boolean; 2739 /** 2740 * Check whether the entered value is of DataView type. 2741 * 2742 * @param { Object } value - A DataView value 2743 * @returns { boolean } Returns true if the value is a built-in DataView instance. 2744 * @syscap SystemCapability.Utils.Lang 2745 * @since 8 2746 */ 2747 /** 2748 * Check whether the entered value is of DataView type. 2749 * 2750 * @param { Object } value - A DataView value 2751 * @returns { boolean } Returns true if the value is a built-in DataView instance. 2752 * @syscap SystemCapability.Utils.Lang 2753 * @crossplatform 2754 * @since 10 2755 */ 2756 isDataView(value: Object): boolean; 2757 /** 2758 * Check whether the entered value is of type date. 2759 * 2760 * @param { Object } value - A Date value 2761 * @returns { boolean } Returns true if the value is a built-in Date instance. 2762 * @syscap SystemCapability.Utils.Lang 2763 * @since 8 2764 */ 2765 /** 2766 * Check whether the entered value is of type date. 2767 * 2768 * @param { Object } value - A Date value 2769 * @returns { boolean } Returns true if the value is a built-in Date instance. 2770 * @syscap SystemCapability.Utils.Lang 2771 * @crossplatform 2772 * @since 10 2773 */ 2774 isDate(value: Object): boolean; 2775 /** 2776 * Check whether the entered value is a native external value type. 2777 * 2778 * @param { Object } value - A External value 2779 * @returns { boolean } Returns true if the value is a native External value. 2780 * @syscap SystemCapability.Utils.Lang 2781 * @since 8 2782 */ 2783 /** 2784 * Check whether the entered value is a native external value type. 2785 * 2786 * @param { Object } value - A External value 2787 * @returns { boolean } Returns true if the value is a native External value. 2788 * @syscap SystemCapability.Utils.Lang 2789 * @crossplatform 2790 * @since 10 2791 */ 2792 isExternal(value: Object): boolean; 2793 /** 2794 * Check whether the entered value is of float32array array type. 2795 * 2796 * @param { Object } value - A Float32Array value 2797 * @returns { boolean } Returns true if the value is a built-in Float32Array instance. 2798 * @syscap SystemCapability.Utils.Lang 2799 * @since 8 2800 */ 2801 /** 2802 * Check whether the entered value is of float32array array type. 2803 * 2804 * @param { Object } value - A Float32Array value 2805 * @returns { boolean } Returns true if the value is a built-in Float32Array instance. 2806 * @syscap SystemCapability.Utils.Lang 2807 * @crossplatform 2808 * @since 10 2809 */ 2810 isFloat32Array(value: Object): boolean; 2811 /** 2812 * Check whether the entered value is of float64array array type. 2813 * 2814 * @param { Object } value - A Float64Array value 2815 * @returns { boolean } Returns true if the value is a built-in Float64Array instance. 2816 * @syscap SystemCapability.Utils.Lang 2817 * @since 8 2818 */ 2819 /** 2820 * Check whether the entered value is of float64array array type. 2821 * 2822 * @param { Object } value - A Float64Array value 2823 * @returns { boolean } Returns true if the value is a built-in Float64Array instance. 2824 * @syscap SystemCapability.Utils.Lang 2825 * @crossplatform 2826 * @since 10 2827 */ 2828 isFloat64Array(value: Object): boolean; 2829 /** 2830 * Check whether the input value is a generator function type. 2831 * 2832 * @param { Object } value - A generator function value 2833 * @returns { boolean } Returns true if the value is a generator function. This only reports back what the JavaScript engine is seeing; in particular, 2834 * the return value may not match the original source code if a transpilation tool was used. 2835 * @syscap SystemCapability.Utils.Lang 2836 * @since 8 2837 */ 2838 /** 2839 * Check whether the input value is a generator function type. 2840 * 2841 * @param { Object } value - A generator function value 2842 * @returns { boolean } Returns true if the value is a generator function. This only reports back what the JavaScript engine is seeing; in particular, 2843 * the return value may not match the original source code if a transpilation tool was used. 2844 * @syscap SystemCapability.Utils.Lang 2845 * @crossplatform 2846 * @since 10 2847 */ 2848 isGeneratorFunction(value: Object): boolean; 2849 /** 2850 * Check whether the entered value is a generator object type. 2851 * 2852 * @param { Object } value - A generator object value 2853 * @returns { boolean } Returns true if the value is a generator object as returned from a built-in generator function. 2854 * This only reports back what the JavaScript engine is seeing; in particular, 2855 *the return value may not match the original source code if a transpilation tool was used. 2856 * @syscap SystemCapability.Utils.Lang 2857 * @since 8 2858 */ 2859 /** 2860 * Check whether the entered value is a generator object type. 2861 * 2862 * @param { Object } value - A generator object value 2863 * @returns { boolean } Returns true if the value is a generator object as returned from a built-in generator function. 2864 * This only reports back what the JavaScript engine is seeing; in particular, 2865 *the return value may not match the original source code if a transpilation tool was used. 2866 * @syscap SystemCapability.Utils.Lang 2867 * @crossplatform 2868 * @since 10 2869 */ 2870 isGeneratorObject(value: Object): boolean; 2871 /** 2872 * Check whether the entered value is of int8array array type. 2873 * 2874 * @param { Object } value - A Int8Array value 2875 * @returns { boolean } Returns true if the value is a built-in Int8Array instance. 2876 * @syscap SystemCapability.Utils.Lang 2877 * @since 8 2878 */ 2879 /** 2880 * Check whether the entered value is of int8array array type. 2881 * 2882 * @param { Object } value - A Int8Array value 2883 * @returns { boolean } Returns true if the value is a built-in Int8Array instance. 2884 * @syscap SystemCapability.Utils.Lang 2885 * @crossplatform 2886 * @since 10 2887 */ 2888 isInt8Array(value: Object): boolean; 2889 /** 2890 * Check whether the entered value is the int16array type. 2891 * 2892 * @param { Object } value - A Int16Array value 2893 * @returns { boolean } Returns true if the value is a built-in Int16Array instance. 2894 * @syscap SystemCapability.Utils.Lang 2895 * @since 8 2896 */ 2897 /** 2898 * Check whether the entered value is the int16array type. 2899 * 2900 * @param { Object } value - A Int16Array value 2901 * @returns { boolean } Returns true if the value is a built-in Int16Array instance. 2902 * @syscap SystemCapability.Utils.Lang 2903 * @crossplatform 2904 * @since 10 2905 */ 2906 isInt16Array(value: Object): boolean; 2907 /** 2908 * Check whether the entered value is the int32array array type. 2909 * 2910 * @param { Object } value - A Int32Array value 2911 * @returns { boolean } Returns true if the value is a built-in Int32Array instance. 2912 * @syscap SystemCapability.Utils.Lang 2913 * @since 8 2914 */ 2915 /** 2916 * Check whether the entered value is the int32array array type. 2917 * 2918 * @param { Object } value - A Int32Array value 2919 * @returns { boolean } Returns true if the value is a built-in Int32Array instance. 2920 * @syscap SystemCapability.Utils.Lang 2921 * @crossplatform 2922 * @since 10 2923 */ 2924 isInt32Array(value: Object): boolean; 2925 /** 2926 * Check whether the entered value is of map type. 2927 * 2928 * @param { Object } value - A Map value 2929 * @returns { boolean } Returns true if the value is a built-in Map instance. 2930 * @syscap SystemCapability.Utils.Lang 2931 * @since 8 2932 */ 2933 /** 2934 * Check whether the entered value is of map type. 2935 * 2936 * @param { Object } value - A Map value 2937 * @returns { boolean } Returns true if the value is a built-in Map instance. 2938 * @syscap SystemCapability.Utils.Lang 2939 * @crossplatform 2940 * @since 10 2941 */ 2942 isMap(value: Object): boolean; 2943 /** 2944 * Check whether the entered value is the iterator type of map. 2945 * 2946 * @param { Object } value - A Map iterator value 2947 * @returns { boolean } Returns true if the value is an iterator returned for a built-in Map instance. 2948 * @syscap SystemCapability.Utils.Lang 2949 * @since 8 2950 */ 2951 /** 2952 * Check whether the entered value is the iterator type of map. 2953 * 2954 * @param { Object } value - A Map iterator value 2955 * @returns { boolean } Returns true if the value is an iterator returned for a built-in Map instance. 2956 * @syscap SystemCapability.Utils.Lang 2957 * @crossplatform 2958 * @since 10 2959 */ 2960 isMapIterator(value: Object): boolean; 2961 /** 2962 * Check whether the entered value is the module namespace object object type. 2963 * 2964 * @param { Object } value - A Module Namespace Object value 2965 * @returns { boolean } Returns true if the value is an instance of a Module Namespace Object. 2966 * @syscap SystemCapability.Utils.Lang 2967 * @since 8 2968 */ 2969 /** 2970 * Check whether the entered value is the module namespace object object type. 2971 * 2972 * @param { Object } value - A Module Namespace Object value 2973 * @returns { boolean } Returns true if the value is an instance of a Module Namespace Object. 2974 * @syscap SystemCapability.Utils.Lang 2975 * @crossplatform 2976 * @since 10 2977 */ 2978 isModuleNamespaceObject(value: Object): boolean; 2979 /** 2980 * Check whether the value entered is of type error. 2981 * 2982 * @param { Object } value - A Error value 2983 * @returns { boolean } Returns true if the value is an instance of a built-in Error type. 2984 * @syscap SystemCapability.Utils.Lang 2985 * @since 8 2986 */ 2987 /** 2988 * Check whether the value entered is of type error. 2989 * 2990 * @param { Object } value - A Error value 2991 * @returns { boolean } Returns true if the value is an instance of a built-in Error type. 2992 * @syscap SystemCapability.Utils.Lang 2993 * @crossplatform 2994 * @since 10 2995 */ 2996 isNativeError(value: Object): boolean; 2997 /** 2998 * Check whether the entered value is of the number object type. 2999 * 3000 * @param { Object } value - A number object value 3001 * @returns { boolean } Returns true if the value is a number object, e.g. created by new Number(). 3002 * @syscap SystemCapability.Utils.Lang 3003 * @since 8 3004 */ 3005 /** 3006 * Check whether the entered value is of the number object type. 3007 * 3008 * @param { Object } value - A number object value 3009 * @returns { boolean } Returns true if the value is a number object, e.g. created by new Number(). 3010 * @syscap SystemCapability.Utils.Lang 3011 * @crossplatform 3012 * @since 10 3013 */ 3014 isNumberObject(value: Object): boolean; 3015 /** 3016 * Check whether the entered value is of promise type. 3017 * 3018 * @param { Object } value - A Promise value 3019 * @returns { boolean } Returns true if the value is a built-in Promise. 3020 * @syscap SystemCapability.Utils.Lang 3021 * @since 8 3022 */ 3023 /** 3024 * Check whether the entered value is of promise type. 3025 * 3026 * @param { Object } value - A Promise value 3027 * @returns { boolean } Returns true if the value is a built-in Promise. 3028 * @syscap SystemCapability.Utils.Lang 3029 * @crossplatform 3030 * @since 10 3031 */ 3032 isPromise(value: Object): boolean; 3033 /** 3034 * Check whether the value entered is of proxy type. 3035 * 3036 * @param { Object } value - A Proxy value 3037 * @returns { boolean } Returns true if the value is a Proxy instance. 3038 * @syscap SystemCapability.Utils.Lang 3039 * @since 8 3040 */ 3041 /** 3042 * Check whether the value entered is of proxy type. 3043 * 3044 * @param { Object } value - A Proxy value 3045 * @returns { boolean } Returns true if the value is a Proxy instance. 3046 * @syscap SystemCapability.Utils.Lang 3047 * @crossplatform 3048 * @since 10 3049 */ 3050 isProxy(value: Object): boolean; 3051 /** 3052 * Check whether the entered value is of type regexp. 3053 * 3054 * @param { Object } value - A regular expression object value 3055 * @returns { boolean } Returns true if the value is a regular expression object. 3056 * @syscap SystemCapability.Utils.Lang 3057 * @since 8 3058 */ 3059 /** 3060 * Check whether the entered value is of type regexp. 3061 * 3062 * @param { Object } value - A regular expression object value 3063 * @returns { boolean } Returns true if the value is a regular expression object. 3064 * @syscap SystemCapability.Utils.Lang 3065 * @crossplatform 3066 * @since 10 3067 */ 3068 isRegExp(value: Object): boolean; 3069 /** 3070 * Check whether the entered value is of type set. 3071 * 3072 * @param { Object } value - A Set instance value 3073 * @returns { boolean } Returns true if the value is a built-in Set instance. 3074 * @syscap SystemCapability.Utils.Lang 3075 * @since 8 3076 */ 3077 /** 3078 * Check whether the entered value is of type set. 3079 * 3080 * @param { Object } value - A Set instance value 3081 * @returns { boolean } Returns true if the value is a built-in Set instance. 3082 * @syscap SystemCapability.Utils.Lang 3083 * @crossplatform 3084 * @since 10 3085 */ 3086 isSet(value: Object): boolean; 3087 /** 3088 * Check whether the entered value is the iterator type of set. 3089 * 3090 * @param { Object } value - A Set iterator value 3091 * @returns { boolean } Returns true if the value is an iterator returned for a built-in Set instance. 3092 * @syscap SystemCapability.Utils.Lang 3093 * @since 8 3094 */ 3095 /** 3096 * Check whether the entered value is the iterator type of set. 3097 * 3098 * @param { Object } value - A Set iterator value 3099 * @returns { boolean } Returns true if the value is an iterator returned for a built-in Set instance. 3100 * @syscap SystemCapability.Utils.Lang 3101 * @crossplatform 3102 * @since 10 3103 */ 3104 isSetIterator(value: Object): boolean; 3105 /** 3106 * Check whether the entered value is of type sharedarraybuffer. 3107 * 3108 * @param { Object } value - A SharedArrayBuffer instance value 3109 * @returns { boolean } Returns true if the value is a built-in SharedArrayBuffer instance. This does not include ArrayBuffer instances. 3110 * Usually, it is desirable to test for both; See isAnyArrayBuffer() for that. 3111 * @syscap SystemCapability.Utils.Lang 3112 * @since 8 3113 */ 3114 /** 3115 * Check whether the entered value is of type sharedarraybuffer. 3116 * 3117 * @param { Object } value - A SharedArrayBuffer instance value 3118 * @returns { boolean } Returns true if the value is a built-in SharedArrayBuffer instance. This does not include ArrayBuffer instances. 3119 * Usually, it is desirable to test for both; See isAnyArrayBuffer() for that. 3120 * @syscap SystemCapability.Utils.Lang 3121 * @crossplatform 3122 * @since 10 3123 */ 3124 isSharedArrayBuffer(value: Object): boolean; 3125 /** 3126 * Check whether the entered value is a string object type. 3127 * 3128 * @param { Object } value - A String object value 3129 * @returns { boolean } Returns true if the value is a string object, e.g. created by new String(). 3130 * @syscap SystemCapability.Utils.Lang 3131 * @since 8 3132 */ 3133 /** 3134 * Check whether the entered value is a string object type. 3135 * 3136 * @param { Object } value - A String object value 3137 * @returns { boolean } Returns true if the value is a string object, e.g. created by new String(). 3138 * @syscap SystemCapability.Utils.Lang 3139 * @crossplatform 3140 * @since 10 3141 */ 3142 isStringObject(value: Object): boolean; 3143 /** 3144 * Check whether the entered value is a symbol object type. 3145 * 3146 * @param { Object } value - A symbol object value 3147 * @returns { boolean } Returns true if the value is a symbol object, created by calling Object() on a Symbol primitive. 3148 * @syscap SystemCapability.Utils.Lang 3149 * @since 8 3150 */ 3151 /** 3152 * Check whether the entered value is a symbol object type. 3153 * 3154 * @param { Object } value - A symbol object value 3155 * @returns { boolean } Returns true if the value is a symbol object, created by calling Object() on a Symbol primitive. 3156 * @syscap SystemCapability.Utils.Lang 3157 * @crossplatform 3158 * @since 10 3159 */ 3160 isSymbolObject(value: Object): boolean; 3161 /** 3162 * Check whether the entered value is a type contained in typedarray. 3163 * 3164 * @param { Object } value - A TypedArray instance value 3165 * @returns { boolean } Returns true if the value is a built-in TypedArray instance. 3166 * @syscap SystemCapability.Utils.Lang 3167 * @since 8 3168 */ 3169 /** 3170 * Check whether the entered value is a type contained in typedarray. 3171 * 3172 * @param { Object } value - A TypedArray instance value 3173 * @returns { boolean } Returns true if the value is a built-in TypedArray instance. 3174 * @syscap SystemCapability.Utils.Lang 3175 * @crossplatform 3176 * @since 10 3177 */ 3178 isTypedArray(value: Object): boolean; 3179 /** 3180 * Check whether the entered value is the uint8array array type. 3181 * 3182 * @param { Object } value - A Uint8Array value 3183 * @returns { boolean } Returns true if the value is a built-in Uint8Array instance. 3184 * @syscap SystemCapability.Utils.Lang 3185 * @since 8 3186 */ 3187 /** 3188 * Check whether the entered value is the uint8array array type. 3189 * 3190 * @param { Object } value - A Uint8Array value 3191 * @returns { boolean } Returns true if the value is a built-in Uint8Array instance. 3192 * @syscap SystemCapability.Utils.Lang 3193 * @crossplatform 3194 * @since 10 3195 */ 3196 isUint8Array(value: Object): boolean; 3197 /** 3198 * Check whether the entered value is the uint8clapedarray array type. 3199 * 3200 * @param { Object } value - A Uint8ClampedArray value 3201 * @returns { boolean } Returns true if the value is a built-in Uint8ClampedArray instance. 3202 * @syscap SystemCapability.Utils.Lang 3203 * @since 8 3204 */ 3205 /** 3206 * Check whether the entered value is the uint8clapedarray array type. 3207 * 3208 * @param { Object } value - A Uint8ClampedArray value 3209 * @returns { boolean } Returns true if the value is a built-in Uint8ClampedArray instance. 3210 * @syscap SystemCapability.Utils.Lang 3211 * @crossplatform 3212 * @since 10 3213 */ 3214 isUint8ClampedArray(value: Object): boolean; 3215 /** 3216 * Check whether the entered value is the uint16array array array type. 3217 * 3218 * @param { Object } value - A Uint16Array value 3219 * @returns { boolean } Returns true if the value is a built-in Uint16Array instance. 3220 * @syscap SystemCapability.Utils.Lang 3221 * @since 8 3222 */ 3223 /** 3224 * Check whether the entered value is the uint16array array array type. 3225 * 3226 * @param { Object } value - A Uint16Array value 3227 * @returns { boolean } Returns true if the value is a built-in Uint16Array instance. 3228 * @syscap SystemCapability.Utils.Lang 3229 * @crossplatform 3230 * @since 10 3231 */ 3232 isUint16Array(value: Object): boolean; 3233 /** 3234 * Check whether the entered value is the uint32array array type. 3235 * 3236 * @param { Object } value - A Uint32Array value 3237 * @returns { boolean } Returns true if the value is a built-in Uint32Array instance. 3238 * @syscap SystemCapability.Utils.Lang 3239 * @since 8 3240 */ 3241 /** 3242 * Check whether the entered value is the uint32array array type. 3243 * 3244 * @param { Object } value - A Uint32Array value 3245 * @returns { boolean } Returns true if the value is a built-in Uint32Array instance. 3246 * @syscap SystemCapability.Utils.Lang 3247 * @crossplatform 3248 * @since 10 3249 */ 3250 isUint32Array(value: Object): boolean; 3251 /** 3252 * Check whether the entered value is of type weakmap. 3253 * 3254 * @param { Object } value - A WeakMap value 3255 * @returns { boolean } Returns true if the value is a built-in WeakMap instance. 3256 * @syscap SystemCapability.Utils.Lang 3257 * @since 8 3258 */ 3259 /** 3260 * Check whether the entered value is of type weakmap. 3261 * 3262 * @param { Object } value - A WeakMap value 3263 * @returns { boolean } Returns true if the value is a built-in WeakMap instance. 3264 * @syscap SystemCapability.Utils.Lang 3265 * @crossplatform 3266 * @since 10 3267 */ 3268 isWeakMap(value: Object): boolean; 3269 /** 3270 * Check whether the entered value is of type weakset. 3271 * 3272 * @param { Object } value - A WeakSet value 3273 * @returns { boolean } Returns true if the value is a built-in WeakSet instance. 3274 * @syscap SystemCapability.Utils.Lang 3275 * @since 8 3276 */ 3277 /** 3278 * Check whether the entered value is of type weakset. 3279 * 3280 * @param { Object } value - A WeakSet value 3281 * @returns { boolean } Returns true if the value is a built-in WeakSet instance. 3282 * @syscap SystemCapability.Utils.Lang 3283 * @crossplatform 3284 * @since 10 3285 */ 3286 isWeakSet(value: Object): boolean; 3287 } 3288 /** 3289 * Insert before/after logic into a class method or replace implementation for a class method. 3290 * 3291 * @syscap SystemCapability.Utils.Lang 3292 * @crossplatform 3293 * @since 11 3294 */ 3295 class Aspect { 3296 /** 3297 * Insert some logic before the method. In implementation the method will be replaced with a new function, 3298 * which will execute 'before' with the args 'this' and the args of the original method, and then execute 3299 * the original method. The return value of the new function is returned by the original method. 3300 * 3301 * @param { Object } targetClass - The operated class. 3302 * @param { string } methodName - The name of the operated method. 3303 * @param { boolean } isStatic - The flag whether the method is static. 3304 * @param { Function } before - The logic inserted before the method. 3305 * @throws { BusinessError } 401 - if the input parameters are invalid. 3306 * @syscap SystemCapability.Utils.Lang 3307 * @crossplatform 3308 * @since 11 3309 */ 3310 static addBefore(targetClass: Object, methodName: string, isStatic: boolean, before: Function): void; 3311 /** 3312 * Insert some logic after the method. In implementation the method will be replaced with a new function, 3313 * which will execute the original method, and then execute 'after' with the args 'this' and the return value of 3314 * the original method, and the args of the original method. The return value of the new function is returned by 'after'. 3315 * 3316 * @param { Object } targetClass - The operated class. 3317 * @param { string } methodName - The name of the operated method. 3318 * @param { boolean } isStatic - The flag whether the method is static. 3319 * @param { Function } after - The logic inserted after the method. 3320 * @throws { BusinessError } 401 - if the input parameters are invalid. 3321 * @syscap SystemCapability.Utils.Lang 3322 * @crossplatform 3323 * @since 11 3324 */ 3325 static addAfter(targetClass: Object, methodName: string, isStatic: boolean, after: Function): void; 3326 /** 3327 * Replace the original method with a new function, which will execute 'instead' with the args 'this' and the args 3328 * of the original method. The return value of the new function is returned by 'instead'. 3329 * 3330 * @param { Object } targetClass - The operated class. 3331 * @param { string } methodName - The name of the operated method. 3332 * @param { boolean } isStatic - The flag whether the method is static. 3333 * @param { Function } instead - The logic replaced with the method. 3334 * @throws { BusinessError } 401 - if the input parameters are invalid. 3335 * @syscap SystemCapability.Utils.Lang 3336 * @crossplatform 3337 * @since 11 3338 */ 3339 static replace(targetClass: Object, methodName: string, isStatic: boolean, instead: Function) : void; 3340 } 3341} 3342export default util; 3343