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