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