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