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