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