1/* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (The type of "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit ArkTS 19 */ 20 21/** 22 * The Buffer class is a global type for dealing with binary data directly. It can be constructed in a variety of ways. 23 * 24 * @namespace buffer 25 * @syscap SystemCapability.Utils.Lang 26 * @since 9 27 */ 28/** 29 * The Buffer class is a global type for dealing with binary data directly. It can be constructed in a variety of ways. 30 * 31 * @namespace buffer 32 * @syscap SystemCapability.Utils.Lang 33 * @crossplatform 34 * @since 10 35 */ 36/** 37 * The Buffer class is a global type for dealing with binary data directly. It can be constructed in a variety of ways. 38 * 39 * @namespace buffer 40 * @syscap SystemCapability.Utils.Lang 41 * @crossplatform 42 * @atomicservice 43 * @since 11 44 */ 45declare namespace buffer { 46 /** 47 * This parameter specifies the type of a common encoding format. 48 * 49 * @syscap SystemCapability.Utils.Lang 50 * @since 9 51 */ 52 /** 53 * This parameter specifies the type of a common encoding format. 54 * 55 * @syscap SystemCapability.Utils.Lang 56 * @crossplatform 57 * @since 10 58 */ 59 /** 60 * This parameter specifies the type of a common encoding format. 61 * 62 * @syscap SystemCapability.Utils.Lang 63 * @crossplatform 64 * @atomicservice 65 * @since 11 66 */ 67 type BufferEncoding = 68 | 'ascii' 69 | 'utf8' 70 | 'utf-8' 71 | 'utf16le' 72 | 'ucs2' 73 | 'ucs-2' 74 | 'base64' 75 | 'base64url' 76 | 'latin1' 77 | 'binary' 78 | 'hex'; 79 /** 80 * TypedArray inherits the features and methods of Int8Array 81 * 82 * @syscap SystemCapability.Utils.Lang 83 * @since 9 84 */ 85 /** 86 * TypedArray inherits the features and methods of Int8Array 87 * 88 * @syscap SystemCapability.Utils.Lang 89 * @crossplatform 90 * @since 10 91 */ 92 /** 93 * TypedArray inherits the features and methods of Int8Array 94 * @interface TypedArray 95 * @syscap SystemCapability.Utils.Lang 96 * @crossplatform 97 * @atomicservice 98 * @since 11 99 */ 100 interface TypedArray extends Int8Array {} 101 /** 102 * Allocates a new Buffer for a fixed size bytes. If fill is undefined, the Buffer will be zero-filled. 103 * 104 * @param { number } size - size size The desired length of the new Buffer 105 * @param { string | Buffer | number } [fill] - fill [fill=0] A value to pre-fill the new Buffer with 106 * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If `fill` is a string, this is its encoding 107 * @returns { Buffer } Return a new allocated Buffer 108 * @throws { BusinessError } 401 - Parameter error. Possible causes: 109 * 1.Mandatory parameters are left unspecified; 110 * 2.Incorrect parameter types; 111 * 3.Parameter verification failed. 112 * @syscap SystemCapability.Utils.Lang 113 * @since 9 114 */ 115 /** 116 * Allocates a new Buffer for a fixed size bytes. If fill is undefined, the Buffer will be zero-filled. 117 * 118 * @param { number } size - size size The desired length of the new Buffer 119 * @param { string | Buffer | number } [fill] - fill [fill=0] A value to pre-fill the new Buffer with 120 * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If `fill` is a string, this is its encoding 121 * @returns { Buffer } Return a new allocated Buffer 122 * @throws { BusinessError } 401 - Parameter error. Possible causes: 123 * 1.Mandatory parameters are left unspecified; 124 * 2.Incorrect parameter types; 125 * 3.Parameter verification failed. 126 * @syscap SystemCapability.Utils.Lang 127 * @crossplatform 128 * @since 10 129 */ 130 /** 131 * Allocates a new Buffer for a fixed size bytes. If fill is undefined, the Buffer will be zero-filled. 132 * 133 * @param { number } size - size size The desired length of the new Buffer 134 * @param { string | Buffer | number } [fill] - fill [fill=0] A value to pre-fill the new Buffer with 135 * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If `fill` is a string, this is its encoding 136 * @returns { Buffer } Return a new allocated Buffer 137 * @throws { BusinessError } 401 - Parameter error. Possible causes: 138 * 1.Mandatory parameters are left unspecified; 139 * 2.Incorrect parameter types; 140 * 3.Parameter verification failed. 141 * @syscap SystemCapability.Utils.Lang 142 * @crossplatform 143 * @atomicservice 144 * @since 11 145 */ 146 function alloc(size: number, fill?: string | Buffer | number, encoding?: BufferEncoding): Buffer; 147 148 /** 149 * Allocates a new Buffer for a fixed size bytes. The Buffer will not be initially filled. 150 * 151 * @param { number } size - size size The desired length of the new Buffer 152 * @returns { Buffer } Return a new allocated Buffer 153 * @throws { BusinessError } 401 - Parameter error. Possible causes: 154 * 1.Mandatory parameters are left unspecified; 155 * 2.Incorrect parameter types; 156 * 3.Parameter verification failed. 157 * @syscap SystemCapability.Utils.Lang 158 * @since 9 159 */ 160 /** 161 * Allocates a new Buffer for a fixed size bytes. The Buffer will not be initially filled. 162 * 163 * @param { number } size - size size The desired length of the new Buffer 164 * @returns { Buffer } Return a new allocated Buffer 165 * @throws { BusinessError } 401 - Parameter error. Possible causes: 166 * 1.Mandatory parameters are left unspecified; 167 * 2.Incorrect parameter types; 168 * 3.Parameter verification failed. 169 * @syscap SystemCapability.Utils.Lang 170 * @crossplatform 171 * @since 10 172 */ 173 /** 174 * Allocates a new Buffer for a fixed size bytes. The Buffer will not be initially filled. 175 * 176 * @param { number } size - size size The desired length of the new Buffer 177 * @returns { Buffer } Return a new allocated Buffer 178 * @throws { BusinessError } 401 - Parameter error. Possible causes: 179 * 1.Mandatory parameters are left unspecified; 180 * 2.Incorrect parameter types; 181 * 3.Parameter verification failed. 182 * @syscap SystemCapability.Utils.Lang 183 * @crossplatform 184 * @atomicservice 185 * @since 11 186 */ 187 function allocUninitializedFromPool(size: number): Buffer; 188 189 /** 190 * Allocates a new un-pooled Buffer for a fixed size bytes. The Buffer will not be initially filled. 191 * 192 * @param { number } size - size size The desired length of the new Buffer 193 * @returns { Buffer } Return a new allocated Buffer 194 * @throws { BusinessError } 401 - Parameter error. Possible causes: 195 * 1.Mandatory parameters are left unspecified; 196 * 2.Incorrect parameter types; 197 * 3.Parameter verification failed. 198 * @syscap SystemCapability.Utils.Lang 199 * @since 9 200 */ 201 /** 202 * Allocates a new un-pooled Buffer for a fixed size bytes. The Buffer will not be initially filled. 203 * 204 * @param { number } size - size size The desired length of the new Buffer 205 * @returns { Buffer } Return a new allocated Buffer 206 * @throws { BusinessError } 401 - Parameter error. Possible causes: 207 * 1.Mandatory parameters are left unspecified; 208 * 2.Incorrect parameter types; 209 * 3.Parameter verification failed. 210 * @syscap SystemCapability.Utils.Lang 211 * @crossplatform 212 * @since 10 213 */ 214 /** 215 * Allocates a new un-pooled Buffer for a fixed size bytes. The Buffer will not be initially filled. 216 * 217 * @param { number } size - size size The desired length of the new Buffer 218 * @returns { Buffer } Return a new allocated Buffer 219 * @throws { BusinessError } 401 - Parameter error. Possible causes: 220 * 1.Mandatory parameters are left unspecified; 221 * 2.Incorrect parameter types; 222 * 3.Parameter verification failed. 223 * @syscap SystemCapability.Utils.Lang 224 * @crossplatform 225 * @atomicservice 226 * @since 11 227 */ 228 function allocUninitialized(size: number): Buffer; 229 230 /** 231 * Returns the byte length of a string when encoded using `encoding`. 232 * This is not the same as [`String.prototype.length`], which does not account 233 * for the encoding that is used to convert the string into bytes. 234 * 235 * @param { string | Buffer | TypedArray | DataView | ArrayBuffer | SharedArrayBuffer } string - string string A value to calculate the length of 236 * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If `string` is a string, this is its encoding 237 * @returns { number } The number of bytes contained within `string` 238 * @throws { BusinessError } 401 - Parameter error. Possible causes: 239 * 1.Mandatory parameters are left unspecified; 240 * 2.Incorrect parameter types. 241 * @syscap SystemCapability.Utils.Lang 242 * @since 9 243 */ 244 /** 245 * Returns the byte length of a string when encoded using `encoding`. 246 * This is not the same as [`String.prototype.length`], which does not account 247 * for the encoding that is used to convert the string into bytes. 248 * 249 * @param { string | Buffer | TypedArray | DataView | ArrayBuffer | SharedArrayBuffer } string - string string A value to calculate the length of 250 * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If `string` is a string, this is its encoding 251 * @returns { number } The number of bytes contained within `string` 252 * @throws { BusinessError } 401 - Parameter error. Possible causes: 253 * 1.Mandatory parameters are left unspecified; 254 * 2.Incorrect parameter types. 255 * @syscap SystemCapability.Utils.Lang 256 * @crossplatform 257 * @since 10 258 */ 259 /** 260 * Returns the byte length of a string when encoded using `encoding`. 261 * This is not the same as [`String.prototype.length`], which does not account 262 * for the encoding that is used to convert the string into bytes. 263 * 264 * @param { string | Buffer | TypedArray | DataView | ArrayBuffer | SharedArrayBuffer } string - string string A value to calculate the length of 265 * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If `string` is a string, this is its encoding 266 * @returns { number } The number of bytes contained within `string` 267 * @throws { BusinessError } 401 - Parameter error. Possible causes: 268 * 1.Mandatory parameters are left unspecified; 269 * 2.Incorrect parameter types. 270 * @syscap SystemCapability.Utils.Lang 271 * @crossplatform 272 * @atomicservice 273 * @since 11 274 */ 275 function byteLength( 276 string: string | Buffer | TypedArray | DataView | ArrayBuffer | SharedArrayBuffer, 277 encoding?: BufferEncoding 278 ): number; 279 280 /** 281 * Returns a new `Buffer` which is the result of concatenating all the `Buffer`instances in the `list` together. 282 * 283 * @param { Buffer[] | Uint8Array[] } list - list list List of `Buffer` or Uint8Array instances to concatenate 284 * @param { number } [totalLength] - totalLength totalLength Total length of the `Buffer` instances in `list` when concatenated 285 * @returns { Buffer } Return a new allocated Buffer 286 * @throws { BusinessError } 401 - Parameter error. Possible causes: 287 * 1.Mandatory parameters are left unspecified; 288 * 2.Incorrect parameter types; 289 * 3.Parameter verification failed. 290 * @throws { BusinessError } 10200001 - The value of "length" is out of range. It must be >= 0 and <= uint32 max. Received value is: [length] 291 * @syscap SystemCapability.Utils.Lang 292 * @since 9 293 */ 294 /** 295 * Returns a new `Buffer` which is the result of concatenating all the `Buffer`instances in the `list` together. 296 * 297 * @param { Buffer[] | Uint8Array[] } list - list list List of `Buffer` or Uint8Array instances to concatenate 298 * @param { number } [totalLength] - totalLength totalLength Total length of the `Buffer` instances in `list` when concatenated 299 * @returns { Buffer } Return a new allocated Buffer 300 * @throws { BusinessError } 401 - Parameter error. Possible causes: 301 * 1.Mandatory parameters are left unspecified; 302 * 2.Incorrect parameter types; 303 * 3.Parameter verification failed. 304 * @throws { BusinessError } 10200001 - The value of "length" is out of range. It must be >= 0 and <= uint32 max. Received value is: [length] 305 * @syscap SystemCapability.Utils.Lang 306 * @crossplatform 307 * @since 10 308 */ 309 /** 310 * Returns a new `Buffer` which is the result of concatenating all the `Buffer`instances in the `list` together. 311 * 312 * @param { Buffer[] | Uint8Array[] } list - list list List of `Buffer` or Uint8Array instances to concatenate 313 * @param { number } [totalLength] - totalLength totalLength Total length of the `Buffer` instances in `list` when concatenated 314 * @returns { Buffer } Return a new allocated Buffer 315 * @throws { BusinessError } 401 - Parameter error. Possible causes: 316 * 1.Mandatory parameters are left unspecified; 317 * 2.Incorrect parameter types; 318 * 3.Parameter verification failed. 319 * @throws { BusinessError } 10200001 - The value of "length" is out of range. It must be >= 0 and <= uint32 max. Received value is: [length] 320 * @syscap SystemCapability.Utils.Lang 321 * @crossplatform 322 * @atomicservice 323 * @since 11 324 */ 325 function concat(list: Buffer[] | Uint8Array[], totalLength?: number): Buffer; 326 327 /** 328 * Allocates a new Buffer using an array of bytes in the range 0 – 255. Array entries outside that range will be truncated to fit into it. 329 * 330 * @param { number[] } array - array array an array of bytes in the range 0 – 255 331 * @returns { Buffer } Return a new allocated Buffer 332 * @throws { BusinessError } 401 - Parameter error. Possible causes: 333 * 1.Mandatory parameters are left unspecified; 334 * 2.Incorrect parameter types. 335 * @syscap SystemCapability.Utils.Lang 336 * @since 9 337 */ 338 /** 339 * Allocates a new Buffer using an array of bytes in the range 0 – 255. Array entries outside that range will be truncated to fit into it. 340 * 341 * @param { number[] } array - array array an array of bytes in the range 0 – 255 342 * @returns { Buffer } Return a new allocated Buffer 343 * @throws { BusinessError } 401 - Parameter error. Possible causes: 344 * 1.Mandatory parameters are left unspecified; 345 * 2.Incorrect parameter types. 346 * @syscap SystemCapability.Utils.Lang 347 * @crossplatform 348 * @since 10 349 */ 350 /** 351 * Allocates a new Buffer using an array of bytes in the range 0 – 255. Array entries outside that range will be truncated to fit into it. 352 * 353 * @param { number[] } array - array array an array of bytes in the range 0 – 255 354 * @returns { Buffer } Return a new allocated Buffer 355 * @throws { BusinessError } 401 - Parameter error. Possible causes: 356 * 1.Mandatory parameters are left unspecified; 357 * 2.Incorrect parameter types. 358 * @syscap SystemCapability.Utils.Lang 359 * @crossplatform 360 * @atomicservice 361 * @since 11 362 */ 363 function from(array: number[]): Buffer; 364 365 /** 366 * This creates a view of the ArrayBuffer without copying the underlying memory. 367 * 368 * @param { ArrayBuffer | SharedArrayBuffer } arrayBuffer - arrayBuffer arrayBuffer An ArrayBuffer, 369 * SharedArrayBuffer, for example the .buffer property of a TypedArray. 370 * @param { number } [byteOffset] - byteOffset [byteOffset = 0] Index of first byte to expose 371 * @param { number } [length] - length [length = arrayBuffer.byteLength - byteOffset] Number of bytes to expose 372 * @returns { Buffer } Return a view of the ArrayBuffer 373 * @throws { BusinessError } 401 - Parameter error. Possible causes: 374 * 1.Mandatory parameters are left unspecified; 375 * 2.Incorrect parameter types. 376 * @throws { BusinessError } 10200001 - The value of "[byteOffset/length]" is out of range. 377 * It must be >= [left range] and <= [right range]. Received value is: [byteOffset/length] 378 * @syscap SystemCapability.Utils.Lang 379 * @since 9 380 */ 381 /** 382 * This creates a view of the ArrayBuffer without copying the underlying memory. 383 * 384 * @param { ArrayBuffer | SharedArrayBuffer } arrayBuffer - arrayBuffer arrayBuffer An ArrayBuffer, 385 * SharedArrayBuffer, for example the .buffer property of a TypedArray. 386 * @param { number } [byteOffset] - byteOffset [byteOffset = 0] Index of first byte to expose 387 * @param { number } [length] - length [length = arrayBuffer.byteLength - byteOffset] Number of bytes to expose 388 * @returns { Buffer } Return a view of the ArrayBuffer 389 * @throws { BusinessError } 401 - Parameter error. Possible causes: 390 * 1.Mandatory parameters are left unspecified; 391 * 2.Incorrect parameter types. 392 * @throws { BusinessError } 10200001 - The value of "[byteOffset/length]" is out of range. 393 * It must be >= [left range] and <= [right range]. Received value is: [byteOffset/length] 394 * @syscap SystemCapability.Utils.Lang 395 * @crossplatform 396 * @since 10 397 */ 398 /** 399 * This creates a view of the ArrayBuffer without copying the underlying memory. 400 * 401 * @param { ArrayBuffer | SharedArrayBuffer } arrayBuffer - arrayBuffer arrayBuffer An ArrayBuffer, 402 * SharedArrayBuffer, for example the .buffer property of a TypedArray. 403 * @param { number } [byteOffset] - byteOffset [byteOffset = 0] Index of first byte to expose 404 * @param { number } [length] - length [length = arrayBuffer.byteLength - byteOffset] Number of bytes to expose 405 * @returns { Buffer } Return a view of the ArrayBuffer 406 * @throws { BusinessError } 401 - Parameter error. Possible causes: 407 * 1.Mandatory parameters are left unspecified; 408 * 2.Incorrect parameter types. 409 * @throws { BusinessError } 10200001 - The value of "[byteOffset/length]" is out of range. 410 * It must be >= [left range] and <= [right range]. Received value is: [byteOffset/length] 411 * @syscap SystemCapability.Utils.Lang 412 * @crossplatform 413 * @atomicservice 414 * @since 11 415 */ 416 function from(arrayBuffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): Buffer; 417 418 /** 419 * Copies the passed buffer data onto a new Buffer instance. 420 * 421 * @param { Buffer | Uint8Array } buffer - buffer buffer An existing Buffer or Uint8Array from which to copy data 422 * @returns { Buffer } Return a new allocated Buffer 423 * @throws { BusinessError } 401 - Parameter error. Possible causes: 424 * 1.Mandatory parameters are left unspecified; 425 * 2.Incorrect parameter types. 426 * @syscap SystemCapability.Utils.Lang 427 * @since 9 428 */ 429 /** 430 * Copies the passed buffer data onto a new Buffer instance. 431 * 432 * @param { Buffer | Uint8Array } buffer - buffer buffer An existing Buffer or Uint8Array from which to copy data 433 * @returns { Buffer } Return a new allocated Buffer 434 * @throws { BusinessError } 401 - Parameter error. Possible causes: 435 * 1.Mandatory parameters are left unspecified; 436 * 2.Incorrect parameter types. 437 * @syscap SystemCapability.Utils.Lang 438 * @crossplatform 439 * @since 10 440 */ 441 /** 442 * Copies the passed buffer data onto a new Buffer instance. 443 * 444 * @param { Buffer | Uint8Array } buffer - buffer buffer An existing Buffer or Uint8Array from which to copy data 445 * @returns { Buffer } Return a new allocated Buffer 446 * @throws { BusinessError } 401 - Parameter error. Possible causes: 447 * 1.Mandatory parameters are left unspecified; 448 * 2.Incorrect parameter types. 449 * @syscap SystemCapability.Utils.Lang 450 * @crossplatform 451 * @atomicservice 452 * @since 11 453 */ 454 function from(buffer: Buffer | Uint8Array): Buffer; 455 456 /** 457 * For the object whose value returned by valueof() function is strictly equal to object 458 * or supports symbol To primitive object, a new buffer instance is created. 459 * 460 * @param { Object } object - object object An object supporting Symbol.toPrimitive or valueOf() 461 * @param { number | string } offsetOrEncoding - offsetOrEncoding offsetOrEncoding A byte-offset or encoding 462 * @param { number } length - length length A length 463 * @returns { Buffer } Return a new allocated Buffer 464 * @throws { BusinessError } 401 - Parameter error. Possible causes: 465 * 1.Mandatory parameters are left unspecified; 466 * 2.Incorrect parameter types. 467 * @syscap SystemCapability.Utils.Lang 468 * @since 9 469 */ 470 /** 471 * For the object whose value returned by valueof() function is strictly equal to object 472 * or supports symbol To primitive object, a new buffer instance is created. 473 * 474 * @param { Object } object - object object An object supporting Symbol.toPrimitive or valueOf() 475 * @param { number | string } offsetOrEncoding - offsetOrEncoding offsetOrEncoding A byte-offset or encoding 476 * @param { number } length - length length A length 477 * @returns { Buffer } Return a new allocated Buffer 478 * @throws { BusinessError } 401 - Parameter error. Possible causes: 479 * 1.Mandatory parameters are left unspecified; 480 * 2.Incorrect parameter types. 481 * @syscap SystemCapability.Utils.Lang 482 * @crossplatform 483 * @since 10 484 */ 485 /** 486 * For the object whose value returned by valueof() function is strictly equal to object 487 * or supports symbol To primitive object, a new buffer instance is created. 488 * 489 * @param { Object } object - object object An object supporting Symbol.toPrimitive or valueOf() 490 * @param { number | string } offsetOrEncoding - offsetOrEncoding offsetOrEncoding A byte-offset or encoding 491 * @param { number } length - length length A length 492 * @returns { Buffer } Return a new allocated Buffer 493 * @throws { BusinessError } 401 - Parameter error. Possible causes: 494 * 1.Mandatory parameters are left unspecified; 495 * 2.Incorrect parameter types. 496 * @syscap SystemCapability.Utils.Lang 497 * @crossplatform 498 * @atomicservice 499 * @since 11 500 */ 501 function from(object: Object, offsetOrEncoding: number | string, length: number): Buffer; 502 503 /** 504 * Creates a new Buffer containing string. The encoding parameter identifies the character encoding 505 * to be used when converting string into bytes. 506 * 507 * @param { String } string - string string A string to encode 508 * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] The encoding of string 509 * @returns { Buffer } Return a new Buffer containing string 510 * @throws { BusinessError } 401 - Parameter error. Possible causes: 511 * 1.Mandatory parameters are left unspecified; 512 * 2.Incorrect parameter types. 513 * @syscap SystemCapability.Utils.Lang 514 * @since 9 515 */ 516 /** 517 * Creates a new Buffer containing string. The encoding parameter identifies the character encoding 518 * to be used when converting string into bytes. 519 * 520 * @param { String } string - string string A string to encode 521 * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] The encoding of string 522 * @returns { Buffer } Return a new Buffer containing string 523 * @throws { BusinessError } 401 - Parameter error. Possible causes: 524 * 1.Mandatory parameters are left unspecified; 525 * 2.Incorrect parameter types. 526 * @syscap SystemCapability.Utils.Lang 527 * @crossplatform 528 * @since 10 529 */ 530 /** 531 * Creates a new Buffer containing string. The encoding parameter identifies the character encoding 532 * to be used when converting string into bytes. 533 * 534 * @param { String } string - string string A string to encode 535 * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] The encoding of string 536 * @returns { Buffer } Return a new Buffer containing string 537 * @throws { BusinessError } 401 - Parameter error. Possible causes: 538 * 1.Mandatory parameters are left unspecified; 539 * 2.Incorrect parameter types. 540 * @syscap SystemCapability.Utils.Lang 541 * @crossplatform 542 * @atomicservice 543 * @since 11 544 */ 545 function from(string: String, encoding?: BufferEncoding): Buffer; 546 547 /** 548 * Returns true if obj is a Buffer, false otherwise 549 * 550 * @param { Object } obj - obj obj Objects to be judged 551 * @returns { boolean } true or false 552 * @syscap SystemCapability.Utils.Lang 553 * @since 9 554 */ 555 /** 556 * Returns true if obj is a Buffer, false otherwise 557 * 558 * @param { Object } obj - obj obj Objects to be judged 559 * @returns { boolean } true or false 560 * @syscap SystemCapability.Utils.Lang 561 * @crossplatform 562 * @since 10 563 */ 564 /** 565 * Returns true if obj is a Buffer, false otherwise 566 * 567 * @param { Object } obj - obj obj Objects to be judged 568 * @returns { boolean } true or false 569 * @syscap SystemCapability.Utils.Lang 570 * @crossplatform 571 * @atomicservice 572 * @since 11 573 */ 574 function isBuffer(obj: Object): boolean; 575 576 /** 577 * Returns true if encoding is the name of a supported character encoding, or false otherwise. 578 * 579 * @param { string } encoding - encoding encoding A character encoding name to check 580 * @returns { boolean } true or false 581 * @syscap SystemCapability.Utils.Lang 582 * @since 9 583 */ 584 /** 585 * Returns true if encoding is the name of a supported character encoding, or false otherwise. 586 * 587 * @param { string } encoding - encoding encoding A character encoding name to check 588 * @returns { boolean } true or false 589 * @syscap SystemCapability.Utils.Lang 590 * @crossplatform 591 * @since 10 592 */ 593 /** 594 * Returns true if encoding is the name of a supported character encoding, or false otherwise. 595 * 596 * @param { string } encoding - encoding encoding A character encoding name to check 597 * @returns { boolean } true or false 598 * @syscap SystemCapability.Utils.Lang 599 * @crossplatform 600 * @atomicservice 601 * @since 11 602 */ 603 function isEncoding(encoding: string): boolean; 604 605 /** 606 * Compares buf1 to buf2 607 * 608 * @param { Buffer | Uint8Array } buf1 - buf1 buf1 A Buffer or Uint8Array instance. 609 * @param { Buffer | Uint8Array } buf2 - buf2 buf2 A Buffer or Uint8Array instance. 610 * @returns { -1 | 0 | 1 } 0 is returned if target is the same as buf 611 * 1 is returned if target should come before buf when sorted. 612 * -1 is returned if target should come after buf when sorted. 613 * @throws { BusinessError } 401 - Parameter error. Possible causes: 614 * 1.Mandatory parameters are left unspecified; 615 * 2.Incorrect parameter types. 616 * @syscap SystemCapability.Utils.Lang 617 * @since 9 618 */ 619 /** 620 * Compares buf1 to buf2 621 * 622 * @param { Buffer | Uint8Array } buf1 - buf1 buf1 A Buffer or Uint8Array instance. 623 * @param { Buffer | Uint8Array } buf2 - buf2 buf2 A Buffer or Uint8Array instance. 624 * @returns { -1 | 0 | 1 } 0 is returned if target is the same as buf 625 * 1 is returned if target should come before buf when sorted. 626 * -1 is returned if target should come after buf when sorted. 627 * @throws { BusinessError } 401 - Parameter error. Possible causes: 628 * 1.Mandatory parameters are left unspecified; 629 * 2.Incorrect parameter types. 630 * @syscap SystemCapability.Utils.Lang 631 * @crossplatform 632 * @since 10 633 */ 634 /** 635 * Compares buf1 to buf2 636 * 637 * @param { Buffer | Uint8Array } buf1 - buf1 buf1 A Buffer or Uint8Array instance. 638 * @param { Buffer | Uint8Array } buf2 - buf2 buf2 A Buffer or Uint8Array instance. 639 * @returns { -1 | 0 | 1 } 0 is returned if target is the same as buf 640 * 1 is returned if target should come before buf when sorted. 641 * -1 is returned if target should come after buf when sorted. 642 * @throws { BusinessError } 401 - Parameter error. Possible causes: 643 * 1.Mandatory parameters are left unspecified; 644 * 2.Incorrect parameter types. 645 * @syscap SystemCapability.Utils.Lang 646 * @crossplatform 647 * @atomicservice 648 * @since 11 649 */ 650 function compare(buf1: Buffer | Uint8Array, buf2: Buffer | Uint8Array): -1 | 0 | 1; 651 652 /** 653 * Re-encodes the given Buffer or Uint8Array instance from one character encoding to another. 654 * 655 * @param { Buffer | Uint8Array } source - source source A Buffer or Uint8Array instance. 656 * @param { string } fromEnc - fromEnc fromEnc The current encoding 657 * @param { string } toEnc - toEnc toEnc To target encoding 658 * @returns { Buffer } Returns a new Buffer instance 659 * @throws { BusinessError } 401 - Parameter error. Possible causes: 660 * 1.Mandatory parameters are left unspecified; 661 * 2.Incorrect parameter types. 662 * @syscap SystemCapability.Utils.Lang 663 * @since 9 664 */ 665 /** 666 * Re-encodes the given Buffer or Uint8Array instance from one character encoding to another. 667 * 668 * @param { Buffer | Uint8Array } source - source source A Buffer or Uint8Array instance. 669 * @param { string } fromEnc - fromEnc fromEnc The current encoding 670 * @param { string } toEnc - toEnc toEnc To target encoding 671 * @returns { Buffer } Returns a new Buffer instance 672 * @throws { BusinessError } 401 - Parameter error. Possible causes: 673 * 1.Mandatory parameters are left unspecified; 674 * 2.Incorrect parameter types. 675 * @syscap SystemCapability.Utils.Lang 676 * @crossplatform 677 * @since 10 678 */ 679 /** 680 * Re-encodes the given Buffer or Uint8Array instance from one character encoding to another. 681 * 682 * @param { Buffer | Uint8Array } source - source source A Buffer or Uint8Array instance. 683 * @param { string } fromEnc - fromEnc fromEnc The current encoding 684 * @param { string } toEnc - toEnc toEnc To target encoding 685 * @returns { Buffer } Returns a new Buffer instance 686 * @throws { BusinessError } 401 - Parameter error. Possible causes: 687 * 1.Mandatory parameters are left unspecified; 688 * 2.Incorrect parameter types. 689 * @syscap SystemCapability.Utils.Lang 690 * @crossplatform 691 * @atomicservice 692 * @since 11 693 */ 694 function transcode(source: Buffer | Uint8Array, fromEnc: string, toEnc: string): Buffer; 695 696 697 /** 698 * The Buffer object is a method of handling buffers dedicated to binary data. 699 * 700 * @syscap SystemCapability.Utils.Lang 701 * @since 9 702 */ 703 /** 704 * The Buffer object is a method of handling buffers dedicated to binary data. 705 * 706 * @syscap SystemCapability.Utils.Lang 707 * @crossplatform 708 * @since 10 709 */ 710 /** 711 * The Buffer object is a method of handling buffers dedicated to binary data. 712 * 713 * @syscap SystemCapability.Utils.Lang 714 * @crossplatform 715 * @atomicservice 716 * @since 11 717 */ 718 class Buffer { 719 /** 720 * Returns the number of bytes in buf 721 * 722 * @throws { BusinessError } 10200013 - Length cannot be set for the buffer that has only a getter. 723 * @syscap SystemCapability.Utils.Lang 724 * @since 9 725 */ 726 /** 727 * Returns the number of bytes in buf 728 * 729 * @throws { BusinessError } 10200013 - Length cannot be set for the buffer that has only a getter. 730 * @syscap SystemCapability.Utils.Lang 731 * @crossplatform 732 * @since 10 733 */ 734 /** 735 * Returns the number of bytes in buf 736 * 737 * @throws { BusinessError } 10200013 - Length cannot be set for the buffer that has only a getter. 738 * @syscap SystemCapability.Utils.Lang 739 * @crossplatform 740 * @atomicservice 741 * @since 11 742 */ 743 length: number; 744 745 /** 746 * The underlying ArrayBuffer object based on which this Buffer object is created. 747 * 748 * @throws { BusinessError } 10200013 - Buffer cannot be set for the buffer that has only a getter. 749 * @syscap SystemCapability.Utils.Lang 750 * @since 9 751 */ 752 /** 753 * The underlying ArrayBuffer object based on which this Buffer object is created. 754 * 755 * @throws { BusinessError } 10200013 - Buffer cannot be set for the buffer that has only a getter. 756 * @syscap SystemCapability.Utils.Lang 757 * @crossplatform 758 * @since 10 759 */ 760 /** 761 * The underlying ArrayBuffer object based on which this Buffer object is created. 762 * 763 * @throws { BusinessError } 10200013 - Buffer cannot be set for the buffer that has only a getter. 764 * @syscap SystemCapability.Utils.Lang 765 * @crossplatform 766 * @atomicservice 767 * @since 11 768 */ 769 buffer: ArrayBuffer; 770 771 /** 772 * The byteOffset of the Buffers underlying ArrayBuffer object 773 * 774 * @throws { BusinessError } 10200013 - ByteOffset cannot be set for the buffer that has only a getter. 775 * @syscap SystemCapability.Utils.Lang 776 * @since 9 777 */ 778 /** 779 * The byteOffset of the Buffers underlying ArrayBuffer object 780 * 781 * @throws { BusinessError } 10200013 - ByteOffset cannot be set for the buffer that has only a getter. 782 * @syscap SystemCapability.Utils.Lang 783 * @crossplatform 784 * @since 10 785 */ 786 /** 787 * The byteOffset of the Buffers underlying ArrayBuffer object 788 * 789 * @throws { BusinessError } 10200013 - ByteOffset cannot be set for the buffer that has only a getter. 790 * @syscap SystemCapability.Utils.Lang 791 * @crossplatform 792 * @atomicservice 793 * @since 11 794 */ 795 byteOffset: number; 796 797 /** 798 * Fills buf with the specified value. If the offset and end are not given, the entire buf will be filled. 799 * 800 * @param { string | Buffer | Uint8Array | number } value - value value The value with which to fill buf 801 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to fill buf 802 * @param { number } [end] - end [end = buf.length] Where to stop filling buf (not inclusive) 803 * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] The encoding for value if value is a string 804 * @returns { Buffer } A reference to buf 805 * @throws { BusinessError } 10200001 - The value of "[offset/end]" is out of range. It must be >= 0 and <= [right range]. Received value is: [offset/end] 806 * @throws { BusinessError } 401 - Parameter error. Possible causes: 807 * 1.Incorrect parameter types; 808 * 2.Parameter verification failed. 809 * @syscap SystemCapability.Utils.Lang 810 * @since 9 811 */ 812 /** 813 * Fills buf with the specified value. If the offset and end are not given, the entire buf will be filled. 814 * 815 * @param { string | Buffer | Uint8Array | number } value - value value The value with which to fill buf 816 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to fill buf 817 * @param { number } [end] - end [end = buf.length] Where to stop filling buf (not inclusive) 818 * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] The encoding for value if value is a string 819 * @returns { Buffer } A reference to buf 820 * @throws { BusinessError } 10200001 - The value of "[offset/end]" is out of range. It must be >= 0 and <= [right range]. Received value is: [offset/end] 821 * @throws { BusinessError } 401 - Parameter error. Possible causes: 822 * 1.Incorrect parameter types; 823 * 2.Parameter verification failed. 824 * @syscap SystemCapability.Utils.Lang 825 * @crossplatform 826 * @since 10 827 */ 828 /** 829 * Fills buf with the specified value. If the offset and end are not given, the entire buf will be filled. 830 * 831 * @param { string | Buffer | Uint8Array | number } value - value value The value with which to fill buf 832 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to fill buf 833 * @param { number } [end] - end [end = buf.length] Where to stop filling buf (not inclusive) 834 * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] The encoding for value if value is a string 835 * @returns { Buffer } A reference to buf 836 * @throws { BusinessError } 10200001 - The value of "[offset/end]" is out of range. It must be >= 0 and <= [right range]. Received value is: [offset/end] 837 * @throws { BusinessError } 401 - Parameter error. Possible causes: 838 * 1.Incorrect parameter types; 839 * 2.Parameter verification failed. 840 * @syscap SystemCapability.Utils.Lang 841 * @crossplatform 842 * @atomicservice 843 * @since 11 844 */ 845 fill( 846 value: string | Buffer | Uint8Array | number, 847 offset?: number, 848 end?: number, 849 encoding?: BufferEncoding 850 ): Buffer; 851 852 /** 853 * Compares buf with target and returns a number indicating whether buf comes before, after, 854 * or is the same as target in sort order. Comparison is based on the actual sequence of bytes in each Buffer. 855 * 856 * @param { Buffer | Uint8Array } target - target target A Buffer or Uint8Array with which to compare buf 857 * @param { number } [targetStart] - targetStart [targetStart = 0] The offset within target at which to begin comparison 858 * @param { number } [targetEnd] - targetEnd [targetEnd = target.length] The offset within target at which to end comparison (not inclusive) 859 * @param { number } [sourceStart] - sourceStart [sourceStart = 0] The offset within buf at which to begin comparison 860 * @param { number } [sourceEnd] - sourceEnd [sourceEnd = buf.length] The offset within buf at which to end comparison (not inclusive) 861 * @returns { -1 | 0 | 1 } 0 is returned if target is the same as buf 862 * 1 is returned if target should come before buf when sorted. 863 * -1 is returned if target should come after buf when sorted. 864 * @throws { BusinessError } 401 - Parameter error. Possible causes: 865 * 1.Mandatory parameters are left unspecified; 866 * 2.Incorrect parameter types. 867 * @throws { BusinessError } 10200001 - The value of "[targetStart/targetEnd/sourceStart/sourceEnd]" is out of range. 868 * It must be >= 0 and <= [right range]. Received value is: [targetStart/targetEnd/sourceStart/sourceEnd] 869 * @syscap SystemCapability.Utils.Lang 870 * @since 9 871 */ 872 /** 873 * Compares buf with target and returns a number indicating whether buf comes before, after, 874 * or is the same as target in sort order. Comparison is based on the actual sequence of bytes in each Buffer. 875 * 876 * @param { Buffer | Uint8Array } target - target target A Buffer or Uint8Array with which to compare buf 877 * @param { number } [targetStart] - targetStart [targetStart = 0] The offset within target at which to begin comparison 878 * @param { number } [targetEnd] - targetEnd [targetEnd = target.length] The offset within target at which to end comparison (not inclusive) 879 * @param { number } [sourceStart] - sourceStart [sourceStart = 0] The offset within buf at which to begin comparison 880 * @param { number } [sourceEnd] - sourceEnd [sourceEnd = buf.length] The offset within buf at which to end comparison (not inclusive) 881 * @returns { -1 | 0 | 1 } 0 is returned if target is the same as buf 882 * 1 is returned if target should come before buf when sorted. 883 * -1 is returned if target should come after buf when sorted. 884 * @throws { BusinessError } 401 - Parameter error. Possible causes: 885 * 1.Mandatory parameters are left unspecified; 886 * 2.Incorrect parameter types. 887 * @throws { BusinessError } 10200001 - The value of "[targetStart/targetEnd/sourceStart/sourceEnd]" is out of range. 888 * It must be >= 0 and <= [right range]. Received value is: [targetStart/targetEnd/sourceStart/sourceEnd] 889 * @syscap SystemCapability.Utils.Lang 890 * @crossplatform 891 * @since 10 892 */ 893 /** 894 * Compares buf with target and returns a number indicating whether buf comes before, after, 895 * or is the same as target in sort order. Comparison is based on the actual sequence of bytes in each Buffer. 896 * 897 * @param { Buffer | Uint8Array } target - target target A Buffer or Uint8Array with which to compare buf 898 * @param { number } [targetStart] - targetStart [targetStart = 0] The offset within target at which to begin comparison 899 * @param { number } [targetEnd] - targetEnd [targetEnd = target.length] The offset within target at which to end comparison (not inclusive) 900 * @param { number } [sourceStart] - sourceStart [sourceStart = 0] The offset within buf at which to begin comparison 901 * @param { number } [sourceEnd] - sourceEnd [sourceEnd = buf.length] The offset within buf at which to end comparison (not inclusive) 902 * @returns { -1 | 0 | 1 } 0 is returned if target is the same as buf 903 * 1 is returned if target should come before buf when sorted. 904 * -1 is returned if target should come after buf when sorted. 905 * @throws { BusinessError } 401 - Parameter error. Possible causes: 906 * 1.Mandatory parameters are left unspecified; 907 * 2.Incorrect parameter types. 908 * @throws { BusinessError } 10200001 - The value of "[targetStart/targetEnd/sourceStart/sourceEnd]" is out of range. 909 * It must be >= 0 and <= [right range]. Received value is: [targetStart/targetEnd/sourceStart/sourceEnd] 910 * @syscap SystemCapability.Utils.Lang 911 * @crossplatform 912 * @atomicservice 913 * @since 11 914 */ 915 compare( 916 target: Buffer | Uint8Array, 917 targetStart?: number, 918 targetEnd?: number, 919 sourceStart?: number, 920 sourceEnd?: number 921 ): -1 | 0 | 1; 922 923 /** 924 * Copies data from a region of buf to a region in target, even if the target memory region overlaps with buf. 925 * If sourceEnd is greater than the length of the target, the length of the target shall prevail, and the extra part will not be overwritten. 926 * 927 * @param { Buffer | Uint8Array } target - target target A Buffer or Uint8Array to copy into 928 * @param { number } [targetStart] - targetStart [targetStart = 0] The offset within target at which to begin writing 929 * @param { number } [sourceStart] - sourceStart [sourceStart = 0] The offset within buf from which to begin copying 930 * @param { number } [sourceEnd] - sourceEnd [sourceEnd = buf.length] The offset within buf at which to stop copying (not inclusive) 931 * @returns { number } The number of bytes copied 932 * @throws { BusinessError } 401 - Parameter error. Possible causes: 933 * 1.Mandatory parameters are left unspecified; 934 * 2.Incorrect parameter types. 935 * @throws { BusinessError } 10200001 - The value of "[targetStart/sourceStart/sourceEnd]" is out of range. It must be >= 0. 936 * Received value is: [targetStart/sourceStart/sourceEnd] 937 * @syscap SystemCapability.Utils.Lang 938 * @since 9 939 */ 940 /** 941 * Copies data from a region of buf to a region in target, even if the target memory region overlaps with buf. 942 * If sourceEnd is greater than the length of the target, the length of the target shall prevail, and the extra part will not be overwritten. 943 * 944 * @param { Buffer | Uint8Array } target - target target A Buffer or Uint8Array to copy into 945 * @param { number } [targetStart] - targetStart [targetStart = 0] The offset within target at which to begin writing 946 * @param { number } [sourceStart] - sourceStart [sourceStart = 0] The offset within buf from which to begin copying 947 * @param { number } [sourceEnd] - sourceEnd [sourceEnd = buf.length] The offset within buf at which to stop copying (not inclusive) 948 * @returns { number } The number of bytes copied 949 * @throws { BusinessError } 401 - Parameter error. Possible causes: 950 * 1.Mandatory parameters are left unspecified; 951 * 2.Incorrect parameter types. 952 * @throws { BusinessError } 10200001 - The value of "[targetStart/sourceStart/sourceEnd]" is out of range. It must be >= 0. 953 * Received value is: [targetStart/sourceStart/sourceEnd] 954 * @syscap SystemCapability.Utils.Lang 955 * @crossplatform 956 * @since 10 957 */ 958 /** 959 * Copies data from a region of buf to a region in target, even if the target memory region overlaps with buf. 960 * If sourceEnd is greater than the length of the target, the length of the target shall prevail, and the extra part will not be overwritten. 961 * 962 * @param { Buffer | Uint8Array } target - target target A Buffer or Uint8Array to copy into 963 * @param { number } [targetStart] - targetStart [targetStart = 0] The offset within target at which to begin writing 964 * @param { number } [sourceStart] - sourceStart [sourceStart = 0] The offset within buf from which to begin copying 965 * @param { number } [sourceEnd] - sourceEnd [sourceEnd = buf.length] The offset within buf at which to stop copying (not inclusive) 966 * @returns { number } The number of bytes copied 967 * @throws { BusinessError } 401 - Parameter error. Possible causes: 968 * 1.Mandatory parameters are left unspecified; 969 * 2.Incorrect parameter types. 970 * @throws { BusinessError } 10200001 - The value of "[targetStart/sourceStart/sourceEnd]" is out of range. It must be >= 0. 971 * Received value is: [targetStart/sourceStart/sourceEnd] 972 * @syscap SystemCapability.Utils.Lang 973 * @crossplatform 974 * @atomicservice 975 * @since 11 976 */ 977 copy(target: Buffer | Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; 978 979 /** 980 * Returns true if both buf and otherBuffer have exactly the same bytes, false otherwise 981 * 982 * @param { Uint8Array | Buffer } otherBuffer - otherBuffer otherBuffer A Buffer or Uint8Array with which to compare buf 983 * @returns { boolean } true or false 984 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 985 * @syscap SystemCapability.Utils.Lang 986 * @since 9 987 */ 988 /** 989 * Returns true if both buf and otherBuffer have exactly the same bytes, false otherwise 990 * 991 * @param { Uint8Array | Buffer } otherBuffer - otherBuffer otherBuffer A Buffer or Uint8Array with which to compare buf 992 * @returns { boolean } true or false 993 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 994 * @syscap SystemCapability.Utils.Lang 995 * @crossplatform 996 * @since 10 997 */ 998 /** 999 * Returns true if both buf and otherBuffer have exactly the same bytes, false otherwise 1000 * 1001 * @param { Uint8Array | Buffer } otherBuffer - otherBuffer otherBuffer A Buffer or Uint8Array with which to compare buf 1002 * @returns { boolean } true or false 1003 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1004 * @syscap SystemCapability.Utils.Lang 1005 * @crossplatform 1006 * @atomicservice 1007 * @since 11 1008 */ 1009 equals(otherBuffer: Uint8Array | Buffer): boolean; 1010 1011 /** 1012 * Returns true if value was found in buf, false otherwise 1013 * 1014 * @param { string | number | Buffer | Uint8Array } value - value value What to search for 1015 * @param { number } [byteOffset] - byteOffset [byteOffset = 0] Where to begin searching in buf. If negative, then offset is calculated from the end of buf 1016 * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If value is a string, this is its encoding 1017 * @returns { boolean } true or false 1018 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1019 * 1.Mandatory parameters are left unspecified; 1020 * 2.Incorrect parameter types. 1021 * @syscap SystemCapability.Utils.Lang 1022 * @since 9 1023 */ 1024 /** 1025 * Returns true if value was found in buf, false otherwise 1026 * 1027 * @param { string | number | Buffer | Uint8Array } value - value value What to search for 1028 * @param { number } [byteOffset] - byteOffset [byteOffset = 0] Where to begin searching in buf. If negative, then offset is calculated from the end of buf 1029 * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If value is a string, this is its encoding 1030 * @returns { boolean } true or false 1031 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1032 * 1.Mandatory parameters are left unspecified; 1033 * 2.Incorrect parameter types. 1034 * @syscap SystemCapability.Utils.Lang 1035 * @crossplatform 1036 * @since 10 1037 */ 1038 /** 1039 * Returns true if value was found in buf, false otherwise 1040 * 1041 * @param { string | number | Buffer | Uint8Array } value - value value What to search for 1042 * @param { number } [byteOffset] - byteOffset [byteOffset = 0] Where to begin searching in buf. If negative, then offset is calculated from the end of buf 1043 * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If value is a string, this is its encoding 1044 * @returns { boolean } true or false 1045 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1046 * 1.Mandatory parameters are left unspecified; 1047 * 2.Incorrect parameter types. 1048 * @syscap SystemCapability.Utils.Lang 1049 * @crossplatform 1050 * @atomicservice 1051 * @since 11 1052 */ 1053 includes(value: string | number | Buffer | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): boolean; 1054 1055 /** 1056 * The index of the first occurrence of value in buf 1057 * 1058 * @param { string | number | Buffer | Uint8Array } value - value value What to search for 1059 * @param { number } [byteOffset] - byteOffset [byteOffset = 0] Where to begin searching in buf 1060 * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If value is a string, 1061 * this is the encoding used to determine the binary representation of the string that will be searched for in buf 1062 * @returns { number } The index of the first occurrence of value in buf, or -1 if buf does not contain value 1063 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1064 * 1.Mandatory parameters are left unspecified; 1065 * 2.Incorrect parameter types. 1066 * @syscap SystemCapability.Utils.Lang 1067 * @since 9 1068 */ 1069 /** 1070 * The index of the first occurrence of value in buf 1071 * 1072 * @param { string | number | Buffer | Uint8Array } value - value value What to search for 1073 * @param { number } [byteOffset] - byteOffset [byteOffset = 0] Where to begin searching in buf 1074 * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If value is a string, 1075 * this is the encoding used to determine the binary representation of the string that will be searched for in buf 1076 * @returns { number } The index of the first occurrence of value in buf, or -1 if buf does not contain value 1077 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1078 * 1.Mandatory parameters are left unspecified; 1079 * 2.Incorrect parameter types. 1080 * @syscap SystemCapability.Utils.Lang 1081 * @crossplatform 1082 * @since 10 1083 */ 1084 /** 1085 * The index of the first occurrence of value in buf 1086 * 1087 * @param { string | number | Buffer | Uint8Array } value - value value What to search for 1088 * @param { number } [byteOffset] - byteOffset [byteOffset = 0] Where to begin searching in buf 1089 * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If value is a string, 1090 * this is the encoding used to determine the binary representation of the string that will be searched for in buf 1091 * @returns { number } The index of the first occurrence of value in buf, or -1 if buf does not contain value 1092 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1093 * 1.Mandatory parameters are left unspecified; 1094 * 2.Incorrect parameter types. 1095 * @syscap SystemCapability.Utils.Lang 1096 * @crossplatform 1097 * @atomicservice 1098 * @since 11 1099 */ 1100 indexOf(value: string | number | Buffer | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number; 1101 1102 /** 1103 * Creates and returns an iterator of buf keys (indices). 1104 * 1105 * @returns { IterableIterator<number> } 1106 * @syscap SystemCapability.Utils.Lang 1107 * @since 9 1108 */ 1109 /** 1110 * Creates and returns an iterator of buf keys (indices). 1111 * 1112 * @returns { IterableIterator<number> } 1113 * @syscap SystemCapability.Utils.Lang 1114 * @crossplatform 1115 * @since 10 1116 */ 1117 /** 1118 * Creates and returns an iterator of buf keys (indices). 1119 * 1120 * @returns { IterableIterator<number> } 1121 * @syscap SystemCapability.Utils.Lang 1122 * @crossplatform 1123 * @atomicservice 1124 * @since 11 1125 */ 1126 keys(): IterableIterator<number>; 1127 1128 /** 1129 * Creates and returns an iterator for buf values (bytes). 1130 * 1131 * @returns { IterableIterator<number> } 1132 * @syscap SystemCapability.Utils.Lang 1133 * @since 9 1134 */ 1135 /** 1136 * Creates and returns an iterator for buf values (bytes). 1137 * 1138 * @returns { IterableIterator<number> } 1139 * @syscap SystemCapability.Utils.Lang 1140 * @crossplatform 1141 * @since 10 1142 */ 1143 /** 1144 * Creates and returns an iterator for buf values (bytes). 1145 * 1146 * @returns { IterableIterator<number> } 1147 * @syscap SystemCapability.Utils.Lang 1148 * @crossplatform 1149 * @atomicservice 1150 * @since 11 1151 */ 1152 values(): IterableIterator<number>; 1153 1154 /** 1155 * Creates and returns an iterator of [index, byte] pairs from the contents of buf. 1156 * 1157 * @returns { IterableIterator<[number, number]> } 1158 * @syscap SystemCapability.Utils.Lang 1159 * @since 9 1160 */ 1161 /** 1162 * Creates and returns an iterator of [index, byte] pairs from the contents of buf. 1163 * 1164 * @returns { IterableIterator<[number, number]> } 1165 * @syscap SystemCapability.Utils.Lang 1166 * @crossplatform 1167 * @since 10 1168 */ 1169 /** 1170 * Creates and returns an iterator of [index, byte] pairs from the contents of buf. 1171 * 1172 * @returns { IterableIterator<[number, number]> } 1173 * @syscap SystemCapability.Utils.Lang 1174 * @crossplatform 1175 * @atomicservice 1176 * @since 11 1177 */ 1178 entries(): IterableIterator<[number, number]>; 1179 1180 /** 1181 * The index of the last occurrence of value in buf 1182 * 1183 * @param { string | number | Buffer | Uint8Array } value - value value What to search for 1184 * @param { number } [byteOffset] - byteOffset [byteOffset = 0] Where to begin searching in buf 1185 * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If value is a string, 1186 * this is the encoding used to determine the binary representation of the string that will be searched for in buf 1187 * @returns { number } The index of the last occurrence of value in buf, or -1 if buf does not contain value 1188 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1189 * 1.Mandatory parameters are left unspecified; 1190 * 2.Incorrect parameter types. 1191 * @syscap SystemCapability.Utils.Lang 1192 * @since 9 1193 */ 1194 /** 1195 * The index of the last occurrence of value in buf 1196 * 1197 * @param { string | number | Buffer | Uint8Array } value - value value What to search for 1198 * @param { number } [byteOffset] - byteOffset [byteOffset = 0] Where to begin searching in buf 1199 * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If value is a string, 1200 * this is the encoding used to determine the binary representation of the string that will be searched for in buf 1201 * @returns { number } The index of the last occurrence of value in buf, or -1 if buf does not contain value 1202 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1203 * 1.Mandatory parameters are left unspecified; 1204 * 2.Incorrect parameter types. 1205 * @syscap SystemCapability.Utils.Lang 1206 * @crossplatform 1207 * @since 10 1208 */ 1209 /** 1210 * The index of the last occurrence of value in buf 1211 * 1212 * @param { string | number | Buffer | Uint8Array } value - value value What to search for 1213 * @param { number } [byteOffset] - byteOffset [byteOffset = 0] Where to begin searching in buf 1214 * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If value is a string, 1215 * this is the encoding used to determine the binary representation of the string that will be searched for in buf 1216 * @returns { number } The index of the last occurrence of value in buf, or -1 if buf does not contain value 1217 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1218 * 1.Mandatory parameters are left unspecified; 1219 * 2.Incorrect parameter types. 1220 * @syscap SystemCapability.Utils.Lang 1221 * @crossplatform 1222 * @atomicservice 1223 * @since 11 1224 */ 1225 lastIndexOf(value: string | number | Buffer | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number; 1226 1227 /** 1228 * Reads a signed, big-endian 64-bit integer from buf at the specified offset 1229 * 1230 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 1231 * @returns { bigint } Return a signed, big-endian 64-bit integer 1232 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1233 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] 1234 * @syscap SystemCapability.Utils.Lang 1235 * @since 9 1236 */ 1237 /** 1238 * Reads a signed, big-endian 64-bit integer from buf at the specified offset 1239 * 1240 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 1241 * @returns { bigint } Return a signed, big-endian 64-bit integer 1242 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1243 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] 1244 * @syscap SystemCapability.Utils.Lang 1245 * @crossplatform 1246 * @since 10 1247 */ 1248 /** 1249 * Reads a signed, big-endian 64-bit integer from buf at the specified offset 1250 * 1251 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 1252 * @returns { bigint } Return a signed, big-endian 64-bit integer 1253 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1254 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] 1255 * @syscap SystemCapability.Utils.Lang 1256 * @crossplatform 1257 * @atomicservice 1258 * @since 11 1259 */ 1260 readBigInt64BE(offset?: number): bigint; 1261 1262 /** 1263 * Reads a signed, little-endian 64-bit integer from buf at the specified offset 1264 * 1265 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 1266 * @returns { bigint } Return a signed, little-endian 64-bit integer 1267 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1268 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] 1269 * @syscap SystemCapability.Utils.Lang 1270 * @since 9 1271 */ 1272 /** 1273 * Reads a signed, little-endian 64-bit integer from buf at the specified offset 1274 * 1275 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 1276 * @returns { bigint } Return a signed, little-endian 64-bit integer 1277 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1278 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] 1279 * @syscap SystemCapability.Utils.Lang 1280 * @crossplatform 1281 * @since 10 1282 */ 1283 /** 1284 * Reads a signed, little-endian 64-bit integer from buf at the specified offset 1285 * 1286 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 1287 * @returns { bigint } Return a signed, little-endian 64-bit integer 1288 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1289 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] 1290 * @syscap SystemCapability.Utils.Lang 1291 * @crossplatform 1292 * @atomicservice 1293 * @since 11 1294 */ 1295 readBigInt64LE(offset?: number): bigint; 1296 1297 /** 1298 * Reads a unsigned, big-endian 64-bit integer from buf at the specified offset 1299 * 1300 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 1301 * @returns { bigint } Return a unsigned, big-endian 64-bit integer 1302 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1303 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] 1304 * @syscap SystemCapability.Utils.Lang 1305 * @since 9 1306 */ 1307 /** 1308 * Reads a unsigned, big-endian 64-bit integer from buf at the specified offset 1309 * 1310 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 1311 * @returns { bigint } Return a unsigned, big-endian 64-bit integer 1312 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1313 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] 1314 * @syscap SystemCapability.Utils.Lang 1315 * @crossplatform 1316 * @since 10 1317 */ 1318 /** 1319 * Reads a unsigned, big-endian 64-bit integer from buf at the specified offset 1320 * 1321 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 1322 * @returns { bigint } Return a unsigned, big-endian 64-bit integer 1323 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1324 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] 1325 * @syscap SystemCapability.Utils.Lang 1326 * @crossplatform 1327 * @atomicservice 1328 * @since 11 1329 */ 1330 readBigUInt64BE(offset?: number): bigint; 1331 1332 /** 1333 * Reads a unsigned, little-endian 64-bit integer from buf at the specified offset 1334 * 1335 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 1336 * @returns { bigint } Return a unsigned, little-endian 64-bit integer 1337 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1338 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] 1339 * @syscap SystemCapability.Utils.Lang 1340 * @since 9 1341 */ 1342 /** 1343 * Reads a unsigned, little-endian 64-bit integer from buf at the specified offset 1344 * 1345 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 1346 * @returns { bigint } Return a unsigned, little-endian 64-bit integer 1347 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1348 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] 1349 * @syscap SystemCapability.Utils.Lang 1350 * @crossplatform 1351 * @since 10 1352 */ 1353 /** 1354 * Reads a unsigned, little-endian 64-bit integer from buf at the specified offset 1355 * 1356 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 1357 * @returns { bigint } Return a unsigned, little-endian 64-bit integer 1358 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1359 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] 1360 * @syscap SystemCapability.Utils.Lang 1361 * @crossplatform 1362 * @atomicservice 1363 * @since 11 1364 */ 1365 readBigUInt64LE(offset?: number): bigint; 1366 1367 /** 1368 * Reads a 64-bit, big-endian double from buf at the specified offset 1369 * 1370 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 1371 * @returns { number } Return a 64-bit, big-endian double 1372 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1373 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] 1374 * @syscap SystemCapability.Utils.Lang 1375 * @since 9 1376 */ 1377 /** 1378 * Reads a 64-bit, big-endian double from buf at the specified offset 1379 * 1380 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 1381 * @returns { number } Return a 64-bit, big-endian double 1382 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1383 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] 1384 * @syscap SystemCapability.Utils.Lang 1385 * @crossplatform 1386 * @since 10 1387 */ 1388 /** 1389 * Reads a 64-bit, big-endian double from buf at the specified offset 1390 * 1391 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 1392 * @returns { number } Return a 64-bit, big-endian double 1393 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1394 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] 1395 * @syscap SystemCapability.Utils.Lang 1396 * @crossplatform 1397 * @atomicservice 1398 * @since 11 1399 */ 1400 readDoubleBE(offset?: number): number; 1401 1402 /** 1403 * Reads a 64-bit, little-endian double from buf at the specified offset 1404 * 1405 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 1406 * @returns { number } Return a 64-bit, little-endian double 1407 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1408 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] 1409 * @syscap SystemCapability.Utils.Lang 1410 * @since 9 1411 */ 1412 /** 1413 * Reads a 64-bit, little-endian double from buf at the specified offset 1414 * 1415 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 1416 * @returns { number } Return a 64-bit, little-endian double 1417 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1418 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] 1419 * @syscap SystemCapability.Utils.Lang 1420 * @crossplatform 1421 * @since 10 1422 */ 1423 /** 1424 * Reads a 64-bit, little-endian double from buf at the specified offset 1425 * 1426 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 1427 * @returns { number } Return a 64-bit, little-endian double 1428 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1429 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] 1430 * @syscap SystemCapability.Utils.Lang 1431 * @crossplatform 1432 * @atomicservice 1433 * @since 11 1434 */ 1435 readDoubleLE(offset?: number): number; 1436 1437 /** 1438 * Reads a 32-bit, big-endian float from buf at the specified offset 1439 * 1440 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 4 1441 * @returns { number } Return a 32-bit, big-endian float 1442 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1443 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] 1444 * @syscap SystemCapability.Utils.Lang 1445 * @since 9 1446 */ 1447 /** 1448 * Reads a 32-bit, big-endian float from buf at the specified offset 1449 * 1450 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 4 1451 * @returns { number } Return a 32-bit, big-endian float 1452 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1453 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] 1454 * @syscap SystemCapability.Utils.Lang 1455 * @crossplatform 1456 * @since 10 1457 */ 1458 /** 1459 * Reads a 32-bit, big-endian float from buf at the specified offset 1460 * 1461 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 4 1462 * @returns { number } Return a 32-bit, big-endian float 1463 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1464 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] 1465 * @syscap SystemCapability.Utils.Lang 1466 * @crossplatform 1467 * @atomicservice 1468 * @since 11 1469 */ 1470 readFloatBE(offset?: number): number; 1471 1472 /** 1473 * Reads a 32-bit, little-endian float from buf at the specified offset 1474 * 1475 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 4 1476 * @returns { number } Return a 32-bit, little-endian float 1477 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1478 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] 1479 * @syscap SystemCapability.Utils.Lang 1480 * @since 9 1481 */ 1482 /** 1483 * Reads a 32-bit, little-endian float from buf at the specified offset 1484 * 1485 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 4 1486 * @returns { number } Return a 32-bit, little-endian float 1487 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1488 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] 1489 * @syscap SystemCapability.Utils.Lang 1490 * @crossplatform 1491 * @since 10 1492 */ 1493 /** 1494 * Reads a 32-bit, little-endian float from buf at the specified offset 1495 * 1496 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 4 1497 * @returns { number } Return a 32-bit, little-endian float 1498 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1499 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] 1500 * @syscap SystemCapability.Utils.Lang 1501 * @crossplatform 1502 * @atomicservice 1503 * @since 11 1504 */ 1505 readFloatLE(offset?: number): number; 1506 1507 /** 1508 * Reads a signed 8-bit integer from buf at the specified offset 1509 * 1510 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 1 1511 * @returns { number } Return a signed 8-bit integer 1512 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1513 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 1. Received value is: [offset] 1514 * @syscap SystemCapability.Utils.Lang 1515 * @since 9 1516 */ 1517 /** 1518 * Reads a signed 8-bit integer from buf at the specified offset 1519 * 1520 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 1 1521 * @returns { number } Return a signed 8-bit integer 1522 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1523 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 1. Received value is: [offset] 1524 * @syscap SystemCapability.Utils.Lang 1525 * @crossplatform 1526 * @since 10 1527 */ 1528 /** 1529 * Reads a signed 8-bit integer from buf at the specified offset 1530 * 1531 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 1 1532 * @returns { number } Return a signed 8-bit integer 1533 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1534 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 1. Received value is: [offset] 1535 * @syscap SystemCapability.Utils.Lang 1536 * @crossplatform 1537 * @atomicservice 1538 * @since 11 1539 */ 1540 readInt8(offset?: number): number; 1541 1542 /** 1543 * Reads a signed, big-endian 16-bit integer from buf at the specified offset 1544 * 1545 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 2 1546 * @returns { number } Return a signed, big-endian 16-bit integer 1547 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1548 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] 1549 * @syscap SystemCapability.Utils.Lang 1550 * @since 9 1551 */ 1552 /** 1553 * Reads a signed, big-endian 16-bit integer from buf at the specified offset 1554 * 1555 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 2 1556 * @returns { number } Return a signed, big-endian 16-bit integer 1557 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1558 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] 1559 * @syscap SystemCapability.Utils.Lang 1560 * @crossplatform 1561 * @since 10 1562 */ 1563 /** 1564 * Reads a signed, big-endian 16-bit integer from buf at the specified offset 1565 * 1566 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 2 1567 * @returns { number } Return a signed, big-endian 16-bit integer 1568 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1569 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] 1570 * @syscap SystemCapability.Utils.Lang 1571 * @crossplatform 1572 * @atomicservice 1573 * @since 11 1574 */ 1575 readInt16BE(offset?: number): number; 1576 1577 /** 1578 * Reads a signed, little-endian 16-bit integer from buf at the specified offset 1579 * 1580 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 2 1581 * @returns { number } Return a signed, little-endian 16-bit integer 1582 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1583 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] 1584 * @syscap SystemCapability.Utils.Lang 1585 * @since 9 1586 */ 1587 /** 1588 * Reads a signed, little-endian 16-bit integer from buf at the specified offset 1589 * 1590 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 2 1591 * @returns { number } Return a signed, little-endian 16-bit integer 1592 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1593 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] 1594 * @syscap SystemCapability.Utils.Lang 1595 * @crossplatform 1596 * @since 10 1597 */ 1598 /** 1599 * Reads a signed, little-endian 16-bit integer from buf at the specified offset 1600 * 1601 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 2 1602 * @returns { number } Return a signed, little-endian 16-bit integer 1603 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1604 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] 1605 * @syscap SystemCapability.Utils.Lang 1606 * @crossplatform 1607 * @atomicservice 1608 * @since 11 1609 */ 1610 readInt16LE(offset?: number): number; 1611 1612 /** 1613 * Reads a signed, big-endian 32-bit integer from buf at the specified offset 1614 * 1615 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 4 1616 * @returns { number } Return a signed, big-endian 32-bit integer 1617 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1618 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] 1619 * @syscap SystemCapability.Utils.Lang 1620 * @since 9 1621 */ 1622 /** 1623 * Reads a signed, big-endian 32-bit integer from buf at the specified offset 1624 * 1625 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 4 1626 * @returns { number } Return a signed, big-endian 32-bit integer 1627 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1628 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] 1629 * @syscap SystemCapability.Utils.Lang 1630 * @crossplatform 1631 * @since 10 1632 */ 1633 /** 1634 * Reads a signed, big-endian 32-bit integer from buf at the specified offset 1635 * 1636 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 4 1637 * @returns { number } Return a signed, big-endian 32-bit integer 1638 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1639 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] 1640 * @syscap SystemCapability.Utils.Lang 1641 * @crossplatform 1642 * @atomicservice 1643 * @since 11 1644 */ 1645 readInt32BE(offset?: number): number; 1646 1647 /** 1648 * Reads a signed, little-endian 32-bit integer from buf at the specified offset 1649 * 1650 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 4 1651 * @returns { number } Return a signed, little-endian 32-bit integer 1652 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1653 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] 1654 * @syscap SystemCapability.Utils.Lang 1655 * @since 9 1656 */ 1657 /** 1658 * Reads a signed, little-endian 32-bit integer from buf at the specified offset 1659 * 1660 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 4 1661 * @returns { number } Return a signed, little-endian 32-bit integer 1662 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1663 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] 1664 * @syscap SystemCapability.Utils.Lang 1665 * @crossplatform 1666 * @since 10 1667 */ 1668 /** 1669 * Reads a signed, little-endian 32-bit integer from buf at the specified offset 1670 * 1671 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 4 1672 * @returns { number } Return a signed, little-endian 32-bit integer 1673 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1674 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] 1675 * @syscap SystemCapability.Utils.Lang 1676 * @crossplatform 1677 * @atomicservice 1678 * @since 11 1679 */ 1680 readInt32LE(offset?: number): number; 1681 1682 /** 1683 * Reads byteLength number of bytes from buf at the specified offset and interprets the result as a big-endian, 1684 * two's complement signed value supporting up to 48 bits of accuracy 1685 * 1686 * @param { number } offset - offset offset Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - byteLength 1687 * @param { number } byteLength - byteLength byteLength Number of bytes to read. Must satisfy 0 < byteLength <= 6 1688 * @returns { number } 1689 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1690 * 1.Mandatory parameters are left unspecified; 1691 * 2.Incorrect parameter types. 1692 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 1693 * @syscap SystemCapability.Utils.Lang 1694 * @since 9 1695 */ 1696 /** 1697 * Reads byteLength number of bytes from buf at the specified offset and interprets the result as a big-endian, 1698 * two's complement signed value supporting up to 48 bits of accuracy 1699 * 1700 * @param { number } offset - offset offset Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - byteLength 1701 * @param { number } byteLength - byteLength byteLength Number of bytes to read. Must satisfy 0 < byteLength <= 6 1702 * @returns { number } 1703 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1704 * 1.Mandatory parameters are left unspecified; 1705 * 2.Incorrect parameter types. 1706 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 1707 * @syscap SystemCapability.Utils.Lang 1708 * @crossplatform 1709 * @since 10 1710 */ 1711 /** 1712 * Reads byteLength number of bytes from buf at the specified offset and interprets the result as a big-endian, 1713 * two's complement signed value supporting up to 48 bits of accuracy 1714 * 1715 * @param { number } offset - offset offset Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - byteLength 1716 * @param { number } byteLength - byteLength byteLength Number of bytes to read. Must satisfy 0 < byteLength <= 6 1717 * @returns { number } 1718 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1719 * 1.Mandatory parameters are left unspecified; 1720 * 2.Incorrect parameter types. 1721 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 1722 * @syscap SystemCapability.Utils.Lang 1723 * @crossplatform 1724 * @atomicservice 1725 * @since 11 1726 */ 1727 readIntBE(offset: number, byteLength: number): number; 1728 1729 /** 1730 * Reads byteLength number of bytes from buf at the specified offset and interprets the result as a little-endian, 1731 * two's complement signed value supporting up to 48 bits of accuracy. 1732 * 1733 * @param { number } offset - offset offset Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - byteLength 1734 * @param { number } byteLength - byteLength byteLength Number of bytes to read. Must satisfy 0 < byteLength <= 6 1735 * @returns { number } 1736 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1737 * 1.Mandatory parameters are left unspecified; 1738 * 2.Incorrect parameter types. 1739 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 1740 * @syscap SystemCapability.Utils.Lang 1741 * @since 9 1742 */ 1743 /** 1744 * Reads byteLength number of bytes from buf at the specified offset and interprets the result as a little-endian, 1745 * two's complement signed value supporting up to 48 bits of accuracy. 1746 * 1747 * @param { number } offset - offset offset Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - byteLength 1748 * @param { number } byteLength - byteLength byteLength Number of bytes to read. Must satisfy 0 < byteLength <= 6 1749 * @returns { number } 1750 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1751 * 1.Mandatory parameters are left unspecified; 1752 * 2.Incorrect parameter types. 1753 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 1754 * @syscap SystemCapability.Utils.Lang 1755 * @crossplatform 1756 * @since 10 1757 */ 1758 /** 1759 * Reads byteLength number of bytes from buf at the specified offset and interprets the result as a little-endian, 1760 * two's complement signed value supporting up to 48 bits of accuracy. 1761 * 1762 * @param { number } offset - offset offset Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - byteLength 1763 * @param { number } byteLength - byteLength byteLength Number of bytes to read. Must satisfy 0 < byteLength <= 6 1764 * @returns { number } 1765 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1766 * 1.Mandatory parameters are left unspecified; 1767 * 2.Incorrect parameter types. 1768 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 1769 * @syscap SystemCapability.Utils.Lang 1770 * @crossplatform 1771 * @atomicservice 1772 * @since 11 1773 */ 1774 readIntLE(offset: number, byteLength: number): number; 1775 1776 /** 1777 * Reads an unsigned 8-bit integer from buf at the specified offset 1778 * 1779 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 1 1780 * @returns { number } Reads an unsigned 8-bit integer 1781 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1782 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 1. Received value is: [offset] 1783 * @syscap SystemCapability.Utils.Lang 1784 * @since 9 1785 */ 1786 /** 1787 * Reads an unsigned 8-bit integer from buf at the specified offset 1788 * 1789 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 1 1790 * @returns { number } Reads an unsigned 8-bit integer 1791 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1792 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 1. Received value is: [offset] 1793 * @syscap SystemCapability.Utils.Lang 1794 * @crossplatform 1795 * @since 10 1796 */ 1797 /** 1798 * Reads an unsigned 8-bit integer from buf at the specified offset 1799 * 1800 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 1 1801 * @returns { number } Reads an unsigned 8-bit integer 1802 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1803 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 1. Received value is: [offset] 1804 * @syscap SystemCapability.Utils.Lang 1805 * @crossplatform 1806 * @atomicservice 1807 * @since 11 1808 */ 1809 readUInt8(offset?: number): number; 1810 1811 /** 1812 * Reads an unsigned, big-endian 16-bit integer from buf at the specified offset 1813 * 1814 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 2 1815 * @returns { number } Reads an unsigned, big-endian 16-bit integer 1816 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1817 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] 1818 * @syscap SystemCapability.Utils.Lang 1819 * @since 9 1820 */ 1821 /** 1822 * Reads an unsigned, big-endian 16-bit integer from buf at the specified offset 1823 * 1824 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 2 1825 * @returns { number } Reads an unsigned, big-endian 16-bit integer 1826 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1827 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] 1828 * @syscap SystemCapability.Utils.Lang 1829 * @crossplatform 1830 * @since 10 1831 */ 1832 /** 1833 * Reads an unsigned, big-endian 16-bit integer from buf at the specified offset 1834 * 1835 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 2 1836 * @returns { number } Reads an unsigned, big-endian 16-bit integer 1837 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1838 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] 1839 * @syscap SystemCapability.Utils.Lang 1840 * @crossplatform 1841 * @atomicservice 1842 * @since 11 1843 */ 1844 readUInt16BE(offset?: number): number; 1845 1846 /** 1847 * Reads an unsigned, little-endian 16-bit integer from buf at the specified offset 1848 * 1849 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 2 1850 * @returns { number } Reads an unsigned, little-endian 16-bit integer 1851 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1852 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] 1853 * @syscap SystemCapability.Utils.Lang 1854 * @since 9 1855 */ 1856 /** 1857 * Reads an unsigned, little-endian 16-bit integer from buf at the specified offset 1858 * 1859 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 2 1860 * @returns { number } Reads an unsigned, little-endian 16-bit integer 1861 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1862 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] 1863 * @syscap SystemCapability.Utils.Lang 1864 * @crossplatform 1865 * @since 10 1866 */ 1867 /** 1868 * Reads an unsigned, little-endian 16-bit integer from buf at the specified offset 1869 * 1870 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 2 1871 * @returns { number } Reads an unsigned, little-endian 16-bit integer 1872 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1873 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] 1874 * @syscap SystemCapability.Utils.Lang 1875 * @crossplatform 1876 * @atomicservice 1877 * @since 11 1878 */ 1879 readUInt16LE(offset?: number): number; 1880 1881 /** 1882 * Reads an unsigned, big-endian 32-bit integer from buf at the specified offset 1883 * 1884 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 4 1885 * @returns { number } Reads an unsigned, big-endian 32-bit integer 1886 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1887 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] 1888 * @syscap SystemCapability.Utils.Lang 1889 * @since 9 1890 */ 1891 /** 1892 * Reads an unsigned, big-endian 32-bit integer from buf at the specified offset 1893 * 1894 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 4 1895 * @returns { number } Reads an unsigned, big-endian 32-bit integer 1896 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1897 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] 1898 * @syscap SystemCapability.Utils.Lang 1899 * @crossplatform 1900 * @since 10 1901 */ 1902 /** 1903 * Reads an unsigned, big-endian 32-bit integer from buf at the specified offset 1904 * 1905 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 4 1906 * @returns { number } Reads an unsigned, big-endian 32-bit integer 1907 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1908 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] 1909 * @syscap SystemCapability.Utils.Lang 1910 * @crossplatform 1911 * @atomicservice 1912 * @since 11 1913 */ 1914 readUInt32BE(offset?: number): number; 1915 1916 /** 1917 * Reads an unsigned, little-endian 32-bit integer from buf at the specified offset 1918 * 1919 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 4 1920 * @returns { number } Reads an unsigned, little-endian 32-bit integer 1921 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1922 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] 1923 * @syscap SystemCapability.Utils.Lang 1924 * @since 9 1925 */ 1926 /** 1927 * Reads an unsigned, little-endian 32-bit integer from buf at the specified offset 1928 * 1929 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 4 1930 * @returns { number } Reads an unsigned, little-endian 32-bit integer 1931 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1932 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] 1933 * @syscap SystemCapability.Utils.Lang 1934 * @crossplatform 1935 * @since 10 1936 */ 1937 /** 1938 * Reads an unsigned, little-endian 32-bit integer from buf at the specified offset 1939 * 1940 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 4 1941 * @returns { number } Reads an unsigned, little-endian 32-bit integer 1942 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 1943 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] 1944 * @syscap SystemCapability.Utils.Lang 1945 * @crossplatform 1946 * @atomicservice 1947 * @since 11 1948 */ 1949 readUInt32LE(offset?: number): number; 1950 1951 /** 1952 * Reads byteLength number of bytes from buf at the specified offset and interprets the result as 1953 * an unsigned big-endian integer supporting up to 48 bits of accuracy. 1954 * 1955 * @param { number } offset - offset offset Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - byteLength 1956 * @param { number } byteLength - byteLength byteLength Number of bytes to read. Must satisfy 0 < byteLength <= 6 1957 * @returns { number } 1958 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1959 * 1.Mandatory parameters are left unspecified; 1960 * 2.Incorrect parameter types. 1961 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 1962 * @syscap SystemCapability.Utils.Lang 1963 * @since 9 1964 */ 1965 /** 1966 * Reads byteLength number of bytes from buf at the specified offset and interprets the result as 1967 * an unsigned big-endian integer supporting up to 48 bits of accuracy. 1968 * 1969 * @param { number } offset - offset offset Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - byteLength 1970 * @param { number } byteLength - byteLength byteLength Number of bytes to read. Must satisfy 0 < byteLength <= 6 1971 * @returns { number } 1972 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1973 * 1.Mandatory parameters are left unspecified; 1974 * 2.Incorrect parameter types. 1975 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 1976 * @syscap SystemCapability.Utils.Lang 1977 * @crossplatform 1978 * @since 10 1979 */ 1980 /** 1981 * Reads byteLength number of bytes from buf at the specified offset and interprets the result as 1982 * an unsigned big-endian integer supporting up to 48 bits of accuracy. 1983 * 1984 * @param { number } offset - offset offset Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - byteLength 1985 * @param { number } byteLength - byteLength byteLength Number of bytes to read. Must satisfy 0 < byteLength <= 6 1986 * @returns { number } 1987 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1988 * 1.Mandatory parameters are left unspecified; 1989 * 2.Incorrect parameter types. 1990 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 1991 * @syscap SystemCapability.Utils.Lang 1992 * @crossplatform 1993 * @atomicservice 1994 * @since 11 1995 */ 1996 readUIntBE(offset: number, byteLength: number): number; 1997 1998 /** 1999 * Reads byteLength number of bytes from buf at the specified offset and interprets the result as an unsigned, 2000 * little-endian integer supporting up to 48 bits of accuracy. 2001 * 2002 * @param { number } offset - offset offset Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - byteLength 2003 * @param { number } byteLength - byteLength byteLength Number of bytes to read. Must satisfy 0 < byteLength <= 6 2004 * @returns { number } 2005 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2006 * 1.Mandatory parameters are left unspecified; 2007 * 2.Incorrect parameter types. 2008 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2009 * @syscap SystemCapability.Utils.Lang 2010 * @since 9 2011 */ 2012 /** 2013 * Reads byteLength number of bytes from buf at the specified offset and interprets the result as an unsigned, 2014 * little-endian integer supporting up to 48 bits of accuracy. 2015 * 2016 * @param { number } offset - offset offset Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - byteLength 2017 * @param { number } byteLength - byteLength byteLength Number of bytes to read. Must satisfy 0 < byteLength <= 6 2018 * @returns { number } 2019 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2020 * 1.Mandatory parameters are left unspecified; 2021 * 2.Incorrect parameter types. 2022 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2023 * @syscap SystemCapability.Utils.Lang 2024 * @crossplatform 2025 * @since 10 2026 */ 2027 /** 2028 * Reads byteLength number of bytes from buf at the specified offset and interprets the result as an unsigned, 2029 * little-endian integer supporting up to 48 bits of accuracy. 2030 * 2031 * @param { number } offset - offset offset Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - byteLength 2032 * @param { number } byteLength - byteLength byteLength Number of bytes to read. Must satisfy 0 < byteLength <= 6 2033 * @returns { number } 2034 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2035 * 1.Mandatory parameters are left unspecified; 2036 * 2.Incorrect parameter types. 2037 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2038 * @syscap SystemCapability.Utils.Lang 2039 * @crossplatform 2040 * @atomicservice 2041 * @since 11 2042 */ 2043 readUIntLE(offset: number, byteLength: number): number; 2044 2045 /** 2046 * Returns a new Buffer that references the same memory as the original, but offset and cropped by the start and end indices. 2047 * 2048 * @param { number } [start] - start [start = 0] Where the new Buffer will start 2049 * @param { number } [end] - end [end = buf.length] Where the new Buffer will end (not inclusive) 2050 * @returns { Buffer } Returns a new Buffer that references the same memory as the original 2051 * @syscap SystemCapability.Utils.Lang 2052 * @since 9 2053 */ 2054 /** 2055 * Returns a new Buffer that references the same memory as the original, but offset and cropped by the start and end indices. 2056 * 2057 * @param { number } [start] - start [start = 0] Where the new Buffer will start 2058 * @param { number } [end] - end [end = buf.length] Where the new Buffer will end (not inclusive) 2059 * @returns { Buffer } Returns a new Buffer that references the same memory as the original 2060 * @syscap SystemCapability.Utils.Lang 2061 * @crossplatform 2062 * @since 10 2063 */ 2064 /** 2065 * Returns a new Buffer that references the same memory as the original, but offset and cropped by the start and end indices. 2066 * 2067 * @param { number } [start] - start [start = 0] Where the new Buffer will start 2068 * @param { number } [end] - end [end = buf.length] Where the new Buffer will end (not inclusive) 2069 * @returns { Buffer } Returns a new Buffer that references the same memory as the original 2070 * @syscap SystemCapability.Utils.Lang 2071 * @crossplatform 2072 * @atomicservice 2073 * @since 11 2074 */ 2075 subarray(start?: number, end?: number): Buffer; 2076 2077 /** 2078 * Interprets buf as an array of unsigned 16-bit integers and swaps the byte order in-place. 2079 * 2080 * @returns { Buffer } A reference to buf 2081 * @throws { BusinessError } 10200009 - The buffer size must be a multiple of 16-bits 2082 * @syscap SystemCapability.Utils.Lang 2083 * @since 9 2084 */ 2085 /** 2086 * Interprets buf as an array of unsigned 16-bit integers and swaps the byte order in-place. 2087 * 2088 * @returns { Buffer } A reference to buf 2089 * @throws { BusinessError } 10200009 - The buffer size must be a multiple of 16-bits 2090 * @syscap SystemCapability.Utils.Lang 2091 * @crossplatform 2092 * @since 10 2093 */ 2094 /** 2095 * Interprets buf as an array of unsigned 16-bit integers and swaps the byte order in-place. 2096 * 2097 * @returns { Buffer } A reference to buf 2098 * @throws { BusinessError } 10200009 - The buffer size must be a multiple of 16-bits 2099 * @syscap SystemCapability.Utils.Lang 2100 * @crossplatform 2101 * @atomicservice 2102 * @since 11 2103 */ 2104 swap16(): Buffer; 2105 2106 /** 2107 * Interprets buf as an array of unsigned 32-bit integers and swaps the byte order in-place. 2108 * 2109 * @returns { Buffer } A reference to buf 2110 * @throws { BusinessError } 10200009 - The buffer size must be a multiple of 32-bits 2111 * @syscap SystemCapability.Utils.Lang 2112 * @since 9 2113 */ 2114 /** 2115 * Interprets buf as an array of unsigned 32-bit integers and swaps the byte order in-place. 2116 * 2117 * @returns { Buffer } A reference to buf 2118 * @throws { BusinessError } 10200009 - The buffer size must be a multiple of 32-bits 2119 * @syscap SystemCapability.Utils.Lang 2120 * @crossplatform 2121 * @since 10 2122 */ 2123 /** 2124 * Interprets buf as an array of unsigned 32-bit integers and swaps the byte order in-place. 2125 * 2126 * @returns { Buffer } A reference to buf 2127 * @throws { BusinessError } 10200009 - The buffer size must be a multiple of 32-bits 2128 * @syscap SystemCapability.Utils.Lang 2129 * @crossplatform 2130 * @atomicservice 2131 * @since 11 2132 */ 2133 swap32(): Buffer; 2134 2135 /** 2136 * Interprets buf as an array of unsigned 64-bit integers and swaps the byte order in-place. 2137 * 2138 * @returns { Buffer } A reference to buf 2139 * @throws { BusinessError } 10200009 - The buffer size must be a multiple of 64-bits 2140 * @syscap SystemCapability.Utils.Lang 2141 * @since 9 2142 */ 2143 /** 2144 * Interprets buf as an array of unsigned 64-bit integers and swaps the byte order in-place. 2145 * 2146 * @returns { Buffer } A reference to buf 2147 * @throws { BusinessError } 10200009 - The buffer size must be a multiple of 64-bits 2148 * @syscap SystemCapability.Utils.Lang 2149 * @crossplatform 2150 * @since 10 2151 */ 2152 /** 2153 * Interprets buf as an array of unsigned 64-bit integers and swaps the byte order in-place. 2154 * 2155 * @returns { Buffer } A reference to buf 2156 * @throws { BusinessError } 10200009 - The buffer size must be a multiple of 64-bits 2157 * @syscap SystemCapability.Utils.Lang 2158 * @crossplatform 2159 * @atomicservice 2160 * @since 11 2161 */ 2162 swap64(): Buffer; 2163 2164 /** 2165 * Returns a JSON representation of buf 2166 * 2167 * @returns { Object } Returns a JSON 2168 * @syscap SystemCapability.Utils.Lang 2169 * @since 9 2170 */ 2171 /** 2172 * Returns a JSON representation of buf 2173 * 2174 * @returns { Object } Returns a JSON 2175 * @syscap SystemCapability.Utils.Lang 2176 * @crossplatform 2177 * @since 10 2178 */ 2179 /** 2180 * Returns a JSON representation of buf 2181 * 2182 * @returns { Object } Returns a JSON 2183 * @syscap SystemCapability.Utils.Lang 2184 * @crossplatform 2185 * @atomicservice 2186 * @since 11 2187 */ 2188 toJSON(): Object; 2189 2190 /** 2191 * Decodes buf to a string according to the specified character encoding in encoding 2192 * 2193 * @param { string } [encoding] - encoding [encoding='utf8'] The character encoding to use 2194 * @param { number } [start] - start [start = 0] The byte offset to start decoding at 2195 * @param { number } [end] - end [end = buf.length] The byte offset to stop decoding at (not inclusive) 2196 * @returns { string } 2197 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 2198 * @syscap SystemCapability.Utils.Lang 2199 * @since 9 2200 */ 2201 /** 2202 * Decodes buf to a string according to the specified character encoding in encoding 2203 * 2204 * @param { string } [encoding] - encoding [encoding='utf8'] The character encoding to use 2205 * @param { number } [start] - start [start = 0] The byte offset to start decoding at 2206 * @param { number } [end] - end [end = buf.length] The byte offset to stop decoding at (not inclusive) 2207 * @returns { string } 2208 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 2209 * @syscap SystemCapability.Utils.Lang 2210 * @crossplatform 2211 * @since 10 2212 */ 2213 /** 2214 * Decodes buf to a string according to the specified character encoding in encoding 2215 * 2216 * @param { string } [encoding] - encoding [encoding='utf8'] The character encoding to use 2217 * @param { number } [start] - start [start = 0] The byte offset to start decoding at 2218 * @param { number } [end] - end [end = buf.length] The byte offset to stop decoding at (not inclusive) 2219 * @returns { string } 2220 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. 2221 * @syscap SystemCapability.Utils.Lang 2222 * @crossplatform 2223 * @atomicservice 2224 * @since 11 2225 */ 2226 toString(encoding?: string, start?: number, end?: number): string; 2227 2228 /** 2229 * Writes string to buf at offset according to the character encoding in encoding 2230 * 2231 * @param { string } str - str str Writes string to buf at offset according to the character encoding in encoding 2232 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write string 2233 * @param { number } [length] - length [length = buf.length - offset] Maximum number of bytes to write (written bytes will not exceed buf.length - offset) 2234 * @param { string } [encoding] - encoding [encoding='utf8'] The character encoding of string. 2235 * @returns { number } Number of bytes written. 2236 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2237 * 1.Mandatory parameters are left unspecified; 2238 * 2.Incorrect parameter types. 2239 * @throws { BusinessError } 10200001 - The value of "[offset/length]" is out of range. It must be >= 0 and <= buf.length. Received value is: [offset/length] 2240 * @syscap SystemCapability.Utils.Lang 2241 * @since 9 2242 */ 2243 /** 2244 * Writes string to buf at offset according to the character encoding in encoding 2245 * 2246 * @param { string } str - str str Writes string to buf at offset according to the character encoding in encoding 2247 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write string 2248 * @param { number } [length] - length [length = buf.length - offset] Maximum number of bytes to write (written bytes will not exceed buf.length - offset) 2249 * @param { string } [encoding] - encoding [encoding='utf8'] The character encoding of string. 2250 * @returns { number } Number of bytes written. 2251 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2252 * 1.Mandatory parameters are left unspecified; 2253 * 2.Incorrect parameter types. 2254 * @throws { BusinessError } 10200001 - The value of "[offset/length]" is out of range. It must be >= 0 and <= buf.length. Received value is: [offset/length] 2255 * @syscap SystemCapability.Utils.Lang 2256 * @crossplatform 2257 * @since 10 2258 */ 2259 /** 2260 * Writes string to buf at offset according to the character encoding in encoding 2261 * 2262 * @param { string } str - str str Writes string to buf at offset according to the character encoding in encoding 2263 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write string 2264 * @param { number } [length] - length [length = buf.length - offset] Maximum number of bytes to write (written bytes will not exceed buf.length - offset) 2265 * @param { string } [encoding] - encoding [encoding='utf8'] The character encoding of string. 2266 * @returns { number } Number of bytes written. 2267 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2268 * 1.Mandatory parameters are left unspecified; 2269 * 2.Incorrect parameter types. 2270 * @throws { BusinessError } 10200001 - The value of "[offset/length]" is out of range. It must be >= 0 and <= buf.length. Received value is: [offset/length] 2271 * @syscap SystemCapability.Utils.Lang 2272 * @crossplatform 2273 * @atomicservice 2274 * @since 11 2275 */ 2276 write(str: string, offset?: number, length?: number, encoding?: string): number; 2277 2278 /** 2279 * Writes value to buf at the specified offset as big-endian. 2280 * 2281 * @param { bigint } value - value value Number to be written to buf 2282 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 2283 * @returns { number } offset plus the number of bytes written 2284 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2285 * 1.Mandatory parameters are left unspecified; 2286 * 2.Incorrect parameter types; 3.Parameter verification failed. 2287 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2288 * @syscap SystemCapability.Utils.Lang 2289 * @since 9 2290 */ 2291 /** 2292 * Writes value to buf at the specified offset as big-endian. 2293 * 2294 * @param { bigint } value - value value Number to be written to buf 2295 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 2296 * @returns { number } offset plus the number of bytes written 2297 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2298 * 1.Mandatory parameters are left unspecified; 2299 * 2.Incorrect parameter types; 2300 * 3.Parameter verification failed. 2301 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2302 * @syscap SystemCapability.Utils.Lang 2303 * @crossplatform 2304 * @since 10 2305 */ 2306 /** 2307 * Writes value to buf at the specified offset as big-endian. 2308 * 2309 * @param { bigint } value - value value Number to be written to buf 2310 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 2311 * @returns { number } offset plus the number of bytes written 2312 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2313 * 1.Mandatory parameters are left unspecified; 2314 * 2.Incorrect parameter types; 2315 * 3.Parameter verification failed. 2316 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2317 * @syscap SystemCapability.Utils.Lang 2318 * @crossplatform 2319 * @atomicservice 2320 * @since 11 2321 */ 2322 writeBigInt64BE(value: bigint, offset?: number): number; 2323 2324 /** 2325 * Writes value to buf at the specified offset as little-endian. 2326 * 2327 * @param { bigint } value - value value Number to be written to buf 2328 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 2329 * @returns { number } offset plus the number of bytes written 2330 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2331 * 1.Mandatory parameters are left unspecified; 2332 * 2.Incorrect parameter types; 2333 * 3.Parameter verification failed. 2334 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2335 * @syscap SystemCapability.Utils.Lang 2336 * @since 9 2337 */ 2338 /** 2339 * Writes value to buf at the specified offset as little-endian. 2340 * 2341 * @param { bigint } value - value value Number to be written to buf 2342 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 2343 * @returns { number } offset plus the number of bytes written 2344 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2345 * 1.Mandatory parameters are left unspecified; 2346 * 2.Incorrect parameter types; 2347 * 3.Parameter verification failed. 2348 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2349 * @syscap SystemCapability.Utils.Lang 2350 * @crossplatform 2351 * @since 10 2352 */ 2353 /** 2354 * Writes value to buf at the specified offset as little-endian. 2355 * 2356 * @param { bigint } value - value value Number to be written to buf 2357 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 2358 * @returns { number } offset plus the number of bytes written 2359 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2360 * 1.Mandatory parameters are left unspecified; 2361 * 2.Incorrect parameter types; 2362 * 3.Parameter verification failed. 2363 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2364 * @syscap SystemCapability.Utils.Lang 2365 * @crossplatform 2366 * @atomicservice 2367 * @since 11 2368 */ 2369 writeBigInt64LE(value: bigint, offset?: number): number; 2370 2371 /** 2372 * Writes value to buf at the specified offset as big-endian. 2373 * 2374 * @param { bigint } value - value value Number to be written to buf 2375 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 2376 * @returns { number } offset plus the number of bytes written 2377 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2378 * 1.Mandatory parameters are left unspecified; 2379 * 2.Incorrect parameter types; 2380 * 3.Parameter verification failed. 2381 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2382 * @syscap SystemCapability.Utils.Lang 2383 * @since 9 2384 */ 2385 /** 2386 * Writes value to buf at the specified offset as big-endian. 2387 * 2388 * @param { bigint } value - value value Number to be written to buf 2389 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 2390 * @returns { number } offset plus the number of bytes written 2391 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2392 * 1.Mandatory parameters are left unspecified; 2393 * 2.Incorrect parameter types; 2394 * 3.Parameter verification failed. 2395 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2396 * @syscap SystemCapability.Utils.Lang 2397 * @crossplatform 2398 * @since 10 2399 */ 2400 /** 2401 * Writes value to buf at the specified offset as big-endian. 2402 * 2403 * @param { bigint } value - value value Number to be written to buf 2404 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 2405 * @returns { number } offset plus the number of bytes written 2406 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2407 * 1.Mandatory parameters are left unspecified; 2408 * 2.Incorrect parameter types; 2409 * 3.Parameter verification failed. 2410 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2411 * @syscap SystemCapability.Utils.Lang 2412 * @crossplatform 2413 * @atomicservice 2414 * @since 11 2415 */ 2416 writeBigUInt64BE(value: bigint, offset?: number): number; 2417 2418 /** 2419 * Writes value to buf at the specified offset as little-endian. 2420 * 2421 * @param { bigint } value - value value Number to be written to buf 2422 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 2423 * @returns { number } offset plus the number of bytes written 2424 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2425 * 1.Mandatory parameters are left unspecified; 2426 * 2.Incorrect parameter types; 2427 * 3.Parameter verification failed. 2428 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2429 * @syscap SystemCapability.Utils.Lang 2430 * @since 9 2431 */ 2432 /** 2433 * Writes value to buf at the specified offset as little-endian. 2434 * 2435 * @param { bigint } value - value value Number to be written to buf 2436 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 2437 * @returns { number } offset plus the number of bytes written 2438 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2439 * 1.Mandatory parameters are left unspecified; 2440 * 2.Incorrect parameter types; 2441 * 3.Parameter verification failed. 2442 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2443 * @syscap SystemCapability.Utils.Lang 2444 * @crossplatform 2445 * @since 10 2446 */ 2447 /** 2448 * Writes value to buf at the specified offset as little-endian. 2449 * 2450 * @param { bigint } value - value value Number to be written to buf 2451 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 2452 * @returns { number } offset plus the number of bytes written 2453 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2454 * 1.Mandatory parameters are left unspecified; 2455 * 2.Incorrect parameter types; 2456 * 3.Parameter verification failed. 2457 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2458 * @syscap SystemCapability.Utils.Lang 2459 * @crossplatform 2460 * @atomicservice 2461 * @since 11 2462 */ 2463 writeBigUInt64LE(value: bigint, offset?: number): number; 2464 2465 /** 2466 * Writes value to buf at the specified offset as big-endian. 2467 * 2468 * @param { number } value - value value Number to be written to buf 2469 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 2470 * @returns { number } offset plus the number of bytes written 2471 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2472 * 1.Mandatory parameters are left unspecified; 2473 * 2.Incorrect parameter types. 2474 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] 2475 * @syscap SystemCapability.Utils.Lang 2476 * @since 9 2477 */ 2478 /** 2479 * Writes value to buf at the specified offset as big-endian. 2480 * 2481 * @param { number } value - value value Number to be written to buf 2482 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 2483 * @returns { number } offset plus the number of bytes written 2484 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2485 * 1.Mandatory parameters are left unspecified; 2486 * 2.Incorrect parameter types. 2487 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] 2488 * @syscap SystemCapability.Utils.Lang 2489 * @crossplatform 2490 * @since 10 2491 */ 2492 /** 2493 * Writes value to buf at the specified offset as big-endian. 2494 * 2495 * @param { number } value - value value Number to be written to buf 2496 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 2497 * @returns { number } offset plus the number of bytes written 2498 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2499 * 1.Mandatory parameters are left unspecified; 2500 * 2.Incorrect parameter types. 2501 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] 2502 * @syscap SystemCapability.Utils.Lang 2503 * @crossplatform 2504 * @atomicservice 2505 * @since 11 2506 */ 2507 writeDoubleBE(value: number, offset?: number): number; 2508 2509 /** 2510 * Writes value to buf at the specified offset as little-endian. 2511 * 2512 * @param { number } value - value value Number to be written to buf 2513 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 2514 * @returns { number } offset plus the number of bytes written 2515 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2516 * 1.Mandatory parameters are left unspecified; 2517 * 2.Incorrect parameter types. 2518 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] 2519 * @syscap SystemCapability.Utils.Lang 2520 * @since 9 2521 */ 2522 /** 2523 * Writes value to buf at the specified offset as little-endian. 2524 * 2525 * @param { number } value - value value Number to be written to buf 2526 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 2527 * @returns { number } offset plus the number of bytes written 2528 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2529 * 1.Mandatory parameters are left unspecified; 2530 * 2.Incorrect parameter types. 2531 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] 2532 * @syscap SystemCapability.Utils.Lang 2533 * @crossplatform 2534 * @since 10 2535 */ 2536 /** 2537 * Writes value to buf at the specified offset as little-endian. 2538 * 2539 * @param { number } value - value value Number to be written to buf 2540 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 2541 * @returns { number } offset plus the number of bytes written 2542 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2543 * 1.Mandatory parameters are left unspecified; 2544 * 2.Incorrect parameter types. 2545 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] 2546 * @syscap SystemCapability.Utils.Lang 2547 * @crossplatform 2548 * @atomicservice 2549 * @since 11 2550 */ 2551 writeDoubleLE(value: number, offset?: number): number; 2552 2553 /** 2554 * Writes value to buf at the specified offset as big-endian. 2555 * 2556 * @param { number } value - value value Number to be written to buf 2557 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 4 2558 * @returns { number } offset plus the number of bytes written 2559 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2560 * 1.Mandatory parameters are left unspecified; 2561 * 2.Incorrect parameter types. 2562 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] 2563 * @syscap SystemCapability.Utils.Lang 2564 * @since 9 2565 */ 2566 /** 2567 * Writes value to buf at the specified offset as big-endian. 2568 * 2569 * @param { number } value - value value Number to be written to buf 2570 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 4 2571 * @returns { number } offset plus the number of bytes written 2572 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2573 * 1.Mandatory parameters are left unspecified; 2574 * 2.Incorrect parameter types. 2575 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] 2576 * @syscap SystemCapability.Utils.Lang 2577 * @crossplatform 2578 * @since 10 2579 */ 2580 /** 2581 * Writes value to buf at the specified offset as big-endian. 2582 * 2583 * @param { number } value - value value Number to be written to buf 2584 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 4 2585 * @returns { number } offset plus the number of bytes written 2586 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2587 * 1.Mandatory parameters are left unspecified; 2588 * 2.Incorrect parameter types. 2589 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] 2590 * @syscap SystemCapability.Utils.Lang 2591 * @crossplatform 2592 * @atomicservice 2593 * @since 11 2594 */ 2595 writeFloatBE(value: number, offset?: number): number; 2596 2597 /** 2598 * Writes value to buf at the specified offset as little-endian. 2599 * 2600 * @param { number } value - value value Number to be written to buf 2601 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 4 2602 * @returns { number } offset plus the number of bytes written 2603 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2604 * 1.Mandatory parameters are left unspecified; 2605 * 2.Incorrect parameter types. 2606 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] 2607 * @syscap SystemCapability.Utils.Lang 2608 * @since 9 2609 */ 2610 /** 2611 * Writes value to buf at the specified offset as little-endian. 2612 * 2613 * @param { number } value - value value Number to be written to buf 2614 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 4 2615 * @returns { number } offset plus the number of bytes written 2616 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2617 * 1.Mandatory parameters are left unspecified; 2618 * 2.Incorrect parameter types. 2619 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] 2620 * @syscap SystemCapability.Utils.Lang 2621 * @crossplatform 2622 * @since 10 2623 */ 2624 /** 2625 * Writes value to buf at the specified offset as little-endian. 2626 * 2627 * @param { number } value - value value Number to be written to buf 2628 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 4 2629 * @returns { number } offset plus the number of bytes written 2630 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2631 * 1.Mandatory parameters are left unspecified; 2632 * 2.Incorrect parameter types. 2633 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] 2634 * @syscap SystemCapability.Utils.Lang 2635 * @crossplatform 2636 * @atomicservice 2637 * @since 11 2638 */ 2639 writeFloatLE(value: number, offset?: number): number; 2640 2641 /** 2642 * Writes value to buf at the specified offset. value must be a valid signed 8-bit integer. 2643 * 2644 * @param { number } value - value value Number to be written to buf 2645 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 1 2646 * @returns { number } offset plus the number of bytes written 2647 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2648 * 1.Mandatory parameters are left unspecified; 2649 * 2.Incorrect parameter types; 2650 * 3.Parameter verification failed. 2651 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2652 * @syscap SystemCapability.Utils.Lang 2653 * @since 9 2654 */ 2655 /** 2656 * Writes value to buf at the specified offset. value must be a valid signed 8-bit integer. 2657 * 2658 * @param { number } value - value value Number to be written to buf 2659 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 1 2660 * @returns { number } offset plus the number of bytes written 2661 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2662 * 1.Mandatory parameters are left unspecified; 2663 * 2.Incorrect parameter types; 2664 * 3.Parameter verification failed. 2665 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2666 * @syscap SystemCapability.Utils.Lang 2667 * @crossplatform 2668 * @since 10 2669 */ 2670 /** 2671 * Writes value to buf at the specified offset. value must be a valid signed 8-bit integer. 2672 * 2673 * @param { number } value - value value Number to be written to buf 2674 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 1 2675 * @returns { number } offset plus the number of bytes written 2676 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2677 * 1.Mandatory parameters are left unspecified; 2678 * 2.Incorrect parameter types; 2679 * 3.Parameter verification failed. 2680 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2681 * @syscap SystemCapability.Utils.Lang 2682 * @crossplatform 2683 * @atomicservice 2684 * @since 11 2685 */ 2686 writeInt8(value: number, offset?: number): number; 2687 2688 /** 2689 * Writes value to buf at the specified offset as big-endian. The value must be a valid signed 16-bit integer 2690 * 2691 * @param { number } value - value value Number to be written to buf 2692 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 2 2693 * @returns { number } offset plus the number of bytes written 2694 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2695 * 1.Mandatory parameters are left unspecified; 2696 * 2.Incorrect parameter types; 2697 * 3.Parameter verification failed. 2698 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2699 * @syscap SystemCapability.Utils.Lang 2700 * @since 9 2701 */ 2702 /** 2703 * Writes value to buf at the specified offset as big-endian. The value must be a valid signed 16-bit integer 2704 * 2705 * @param { number } value - value value Number to be written to buf 2706 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 2 2707 * @returns { number } offset plus the number of bytes written 2708 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2709 * 1.Mandatory parameters are left unspecified; 2710 * 2.Incorrect parameter types; 2711 * 3.Parameter verification failed. 2712 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2713 * @syscap SystemCapability.Utils.Lang 2714 * @crossplatform 2715 * @since 10 2716 */ 2717 /** 2718 * Writes value to buf at the specified offset as big-endian. The value must be a valid signed 16-bit integer 2719 * 2720 * @param { number } value - value value Number to be written to buf 2721 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 2 2722 * @returns { number } offset plus the number of bytes written 2723 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2724 * 1.Mandatory parameters are left unspecified; 2725 * 2.Incorrect parameter types; 2726 * 3.Parameter verification failed. 2727 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2728 * @syscap SystemCapability.Utils.Lang 2729 * @crossplatform 2730 * @atomicservice 2731 * @since 11 2732 */ 2733 writeInt16BE(value: number, offset?: number): number; 2734 2735 /** 2736 * Writes value to buf at the specified offset as little-endian. The value must be a valid signed 16-bit integer 2737 * 2738 * @param { number } value - value value Number to be written to buf 2739 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 2 2740 * @returns { number } offset plus the number of bytes written 2741 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2742 * 1.Mandatory parameters are left unspecified; 2743 * 2.Incorrect parameter types; 2744 * 3.Parameter verification failed. 2745 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2746 * @syscap SystemCapability.Utils.Lang 2747 * @since 9 2748 */ 2749 /** 2750 * Writes value to buf at the specified offset as little-endian. The value must be a valid signed 16-bit integer 2751 * 2752 * @param { number } value - value value Number to be written to buf 2753 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 2 2754 * @returns { number } offset plus the number of bytes written 2755 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2756 * 1.Mandatory parameters are left unspecified; 2757 * 2.Incorrect parameter types; 2758 * 3.Parameter verification failed. 2759 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2760 * @syscap SystemCapability.Utils.Lang 2761 * @crossplatform 2762 * @since 10 2763 */ 2764 /** 2765 * Writes value to buf at the specified offset as little-endian. The value must be a valid signed 16-bit integer 2766 * 2767 * @param { number } value - value value Number to be written to buf 2768 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 2 2769 * @returns { number } offset plus the number of bytes written 2770 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2771 * 1.Mandatory parameters are left unspecified; 2772 * 2.Incorrect parameter types; 2773 * 3.Parameter verification failed. 2774 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2775 * @syscap SystemCapability.Utils.Lang 2776 * @crossplatform 2777 * @atomicservice 2778 * @since 11 2779 */ 2780 writeInt16LE(value: number, offset?: number): number; 2781 2782 /** 2783 * Writes value to buf at the specified offset as big-endian. The value must be a valid signed 32-bit integer. 2784 * 2785 * @param { number } value - value value Number to be written to buf 2786 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 4 2787 * @returns { number } offset plus the number of bytes written 2788 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2789 * 1.Mandatory parameters are left unspecified; 2790 * 2.Incorrect parameter types; 2791 * 3.Parameter verification failed. 2792 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2793 * @syscap SystemCapability.Utils.Lang 2794 * @since 9 2795 */ 2796 /** 2797 * Writes value to buf at the specified offset as big-endian. The value must be a valid signed 32-bit integer. 2798 * 2799 * @param { number } value - value value Number to be written to buf 2800 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 4 2801 * @returns { number } offset plus the number of bytes written 2802 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2803 * 1.Mandatory parameters are left unspecified; 2804 * 2.Incorrect parameter types; 2805 * 3.Parameter verification failed. 2806 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2807 * @syscap SystemCapability.Utils.Lang 2808 * @crossplatform 2809 * @since 10 2810 */ 2811 /** 2812 * Writes value to buf at the specified offset as big-endian. The value must be a valid signed 32-bit integer. 2813 * 2814 * @param { number } value - value value Number to be written to buf 2815 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 4 2816 * @returns { number } offset plus the number of bytes written 2817 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2818 * 1.Mandatory parameters are left unspecified; 2819 * 2.Incorrect parameter types; 2820 * 3.Parameter verification failed. 2821 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2822 * @syscap SystemCapability.Utils.Lang 2823 * @crossplatform 2824 * @atomicservice 2825 * @since 11 2826 */ 2827 writeInt32BE(value: number, offset?: number): number; 2828 2829 /** 2830 * Writes value to buf at the specified offset as little-endian. The value must be a valid signed 32-bit integer. 2831 * 2832 * @param { number } value - value value Number to be written to buf 2833 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 4 2834 * @returns { number } offset plus the number of bytes written 2835 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2836 * 1.Mandatory parameters are left unspecified; 2837 * 2.Incorrect parameter types; 2838 * 3.Parameter verification failed. 2839 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2840 * @syscap SystemCapability.Utils.Lang 2841 * @since 9 2842 */ 2843 /** 2844 * Writes value to buf at the specified offset as little-endian. The value must be a valid signed 32-bit integer. 2845 * 2846 * @param { number } value - value value Number to be written to buf 2847 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 4 2848 * @returns { number } offset plus the number of bytes written 2849 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2850 * 1.Mandatory parameters are left unspecified; 2851 * 2.Incorrect parameter types; 2852 * 3.Parameter verification failed. 2853 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2854 * @syscap SystemCapability.Utils.Lang 2855 * @crossplatform 2856 * @since 10 2857 */ 2858 /** 2859 * Writes value to buf at the specified offset as little-endian. The value must be a valid signed 32-bit integer. 2860 * 2861 * @param { number } value - value value Number to be written to buf 2862 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 4 2863 * @returns { number } offset plus the number of bytes written 2864 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2865 * 1.Mandatory parameters are left unspecified; 2866 * 2.Incorrect parameter types; 2867 * 3.Parameter verification failed. 2868 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2869 * @syscap SystemCapability.Utils.Lang 2870 * @crossplatform 2871 * @atomicservice 2872 * @since 11 2873 */ 2874 writeInt32LE(value: number, offset?: number): number; 2875 2876 /** 2877 * Writes byteLength bytes of value to buf at the specified offset as big-endian 2878 * 2879 * @param { number } value - value value Number to be written to buf 2880 * @param { number } offset - offset offset Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength 2881 * @param { number } byteLength - byteLength byteLength Number of bytes to write. Must satisfy 0 < byteLength <= 6 2882 * @returns { number } offset plus the number of bytes written 2883 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2884 * 1.Mandatory parameters are left unspecified; 2885 * 2.Incorrect parameter types. 2886 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2887 * @syscap SystemCapability.Utils.Lang 2888 * @since 9 2889 */ 2890 /** 2891 * Writes byteLength bytes of value to buf at the specified offset as big-endian 2892 * 2893 * @param { number } value - value value Number to be written to buf 2894 * @param { number } offset - offset offset Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength 2895 * @param { number } byteLength - byteLength byteLength Number of bytes to write. Must satisfy 0 < byteLength <= 6 2896 * @returns { number } offset plus the number of bytes written 2897 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2898 * 1.Mandatory parameters are left unspecified; 2899 * 2.Incorrect parameter types. 2900 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2901 * @syscap SystemCapability.Utils.Lang 2902 * @crossplatform 2903 * @since 10 2904 */ 2905 /** 2906 * Writes byteLength bytes of value to buf at the specified offset as big-endian 2907 * 2908 * @param { number } value - value value Number to be written to buf 2909 * @param { number } offset - offset offset Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength 2910 * @param { number } byteLength - byteLength byteLength Number of bytes to write. Must satisfy 0 < byteLength <= 6 2911 * @returns { number } offset plus the number of bytes written 2912 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2913 * 1.Mandatory parameters are left unspecified; 2914 * 2.Incorrect parameter types. 2915 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2916 * @syscap SystemCapability.Utils.Lang 2917 * @crossplatform 2918 * @atomicservice 2919 * @since 11 2920 */ 2921 writeIntBE(value: number, offset: number, byteLength: number): number; 2922 2923 /** 2924 * Writes byteLength bytes of value to buf at the specified offset as little-endian 2925 * 2926 * @param { number } value - value value Number to be written to buf 2927 * @param { number } offset - offset offset Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength 2928 * @param { number } byteLength - byteLength byteLength Number of bytes to write. Must satisfy 0 < byteLength <= 6 2929 * @returns { number } offset plus the number of bytes written 2930 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2931 * 1.Mandatory parameters are left unspecified; 2932 * 2.Incorrect parameter types. 2933 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2934 * @syscap SystemCapability.Utils.Lang 2935 * @since 9 2936 */ 2937 /** 2938 * Writes byteLength bytes of value to buf at the specified offset as little-endian 2939 * 2940 * @param { number } value - value value Number to be written to buf 2941 * @param { number } offset - offset offset Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength 2942 * @param { number } byteLength - byteLength byteLength Number of bytes to write. Must satisfy 0 < byteLength <= 6 2943 * @returns { number } offset plus the number of bytes written 2944 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2945 * 1.Mandatory parameters are left unspecified; 2946 * 2.Incorrect parameter types. 2947 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2948 * @syscap SystemCapability.Utils.Lang 2949 * @crossplatform 2950 * @since 10 2951 */ 2952 /** 2953 * Writes byteLength bytes of value to buf at the specified offset as little-endian 2954 * 2955 * @param { number } value - value value Number to be written to buf 2956 * @param { number } offset - offset offset Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength 2957 * @param { number } byteLength - byteLength byteLength Number of bytes to write. Must satisfy 0 < byteLength <= 6 2958 * @returns { number } offset plus the number of bytes written 2959 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2960 * 1.Mandatory parameters are left unspecified; 2961 * 2.Incorrect parameter types. 2962 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2963 * @syscap SystemCapability.Utils.Lang 2964 * @crossplatform 2965 * @atomicservice 2966 * @since 11 2967 */ 2968 writeIntLE(value: number, offset: number, byteLength: number): number; 2969 2970 /** 2971 * Writes value to buf at the specified offset. value must be a valid unsigned 8-bit integer 2972 * 2973 * @param { number } value - value value Number to be written to buf 2974 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 1 2975 * @returns { number } offset plus the number of bytes written 2976 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2977 * 1.Mandatory parameters are left unspecified; 2978 * 2.Incorrect parameter types; 2979 * 3.Parameter verification failed. 2980 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2981 * @syscap SystemCapability.Utils.Lang 2982 * @since 9 2983 */ 2984 /** 2985 * Writes value to buf at the specified offset. value must be a valid unsigned 8-bit integer 2986 * 2987 * @param { number } value - value value Number to be written to buf 2988 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 1 2989 * @returns { number } offset plus the number of bytes written 2990 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2991 * 1.Mandatory parameters are left unspecified; 2992 * 2.Incorrect parameter types; 2993 * 3.Parameter verification failed. 2994 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 2995 * @syscap SystemCapability.Utils.Lang 2996 * @crossplatform 2997 * @since 10 2998 */ 2999 /** 3000 * Writes value to buf at the specified offset. value must be a valid unsigned 8-bit integer 3001 * 3002 * @param { number } value - value value Number to be written to buf 3003 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 1 3004 * @returns { number } offset plus the number of bytes written 3005 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3006 * 1.Mandatory parameters are left unspecified; 3007 * 2.Incorrect parameter types; 3008 * 3.Parameter verification failed. 3009 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 3010 * @syscap SystemCapability.Utils.Lang 3011 * @crossplatform 3012 * @atomicservice 3013 * @since 11 3014 */ 3015 writeUInt8(value: number, offset?: number): number; 3016 3017 /** 3018 * Writes value to buf at the specified offset as big-endian. The value must be a valid unsigned 16-bit integer. 3019 * 3020 * @param { number } value - value value Number to be written to buf 3021 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 2 3022 * @returns { number } offset plus the number of bytes written 3023 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3024 * 1.Mandatory parameters are left unspecified; 3025 * 2.Incorrect parameter types; 3026 * 3.Parameter verification failed. 3027 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 3028 * @syscap SystemCapability.Utils.Lang 3029 * @since 9 3030 */ 3031 /** 3032 * Writes value to buf at the specified offset as big-endian. The value must be a valid unsigned 16-bit integer. 3033 * 3034 * @param { number } value - value value Number to be written to buf 3035 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 2 3036 * @returns { number } offset plus the number of bytes written 3037 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3038 * 1.Mandatory parameters are left unspecified; 3039 * 2.Incorrect parameter types; 3040 * 3.Parameter verification failed. 3041 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 3042 * @syscap SystemCapability.Utils.Lang 3043 * @crossplatform 3044 * @since 10 3045 */ 3046 /** 3047 * Writes value to buf at the specified offset as big-endian. The value must be a valid unsigned 16-bit integer. 3048 * 3049 * @param { number } value - value value Number to be written to buf 3050 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 2 3051 * @returns { number } offset plus the number of bytes written 3052 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3053 * 1.Mandatory parameters are left unspecified; 3054 * 2.Incorrect parameter types; 3055 * 3.Parameter verification failed. 3056 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 3057 * @syscap SystemCapability.Utils.Lang 3058 * @crossplatform 3059 * @atomicservice 3060 * @since 11 3061 */ 3062 writeUInt16BE(value: number, offset?: number): number; 3063 3064 /** 3065 * Writes value to buf at the specified offset as little-endian. The value must be a valid unsigned 16-bit integer. 3066 * 3067 * @param { number } value - value value Number to be written to buf 3068 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 2 3069 * @returns { number } offset plus the number of bytes written 3070 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3071 * 1.Mandatory parameters are left unspecified; 3072 * 2.Incorrect parameter types; 3073 * 3.Parameter verification failed. 3074 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 3075 * @syscap SystemCapability.Utils.Lang 3076 * @since 9 3077 */ 3078 /** 3079 * Writes value to buf at the specified offset as little-endian. The value must be a valid unsigned 16-bit integer. 3080 * 3081 * @param { number } value - value value Number to be written to buf 3082 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 2 3083 * @returns { number } offset plus the number of bytes written 3084 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3085 * 1.Mandatory parameters are left unspecified; 3086 * 2.Incorrect parameter types; 3087 * 3.Parameter verification failed. 3088 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 3089 * @syscap SystemCapability.Utils.Lang 3090 * @crossplatform 3091 * @since 10 3092 */ 3093 /** 3094 * Writes value to buf at the specified offset as little-endian. The value must be a valid unsigned 16-bit integer. 3095 * 3096 * @param { number } value - value value Number to be written to buf 3097 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 2 3098 * @returns { number } offset plus the number of bytes written 3099 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3100 * 1.Mandatory parameters are left unspecified; 3101 * 2.Incorrect parameter types; 3102 * 3.Parameter verification failed. 3103 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 3104 * @syscap SystemCapability.Utils.Lang 3105 * @crossplatform 3106 * @atomicservice 3107 * @since 11 3108 */ 3109 writeUInt16LE(value: number, offset?: number): number; 3110 3111 /** 3112 * Writes value to buf at the specified offset as big-endian. The value must be a valid unsigned 32-bit integer. 3113 * 3114 * @param { number } value - value value Number to be written to buf 3115 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 4 3116 * @returns { number } offset plus the number of bytes written 3117 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3118 * 1.Mandatory parameters are left unspecified; 3119 * 2.Incorrect parameter types; 3120 * 3.Parameter verification failed. 3121 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 3122 * @syscap SystemCapability.Utils.Lang 3123 * @since 9 3124 */ 3125 /** 3126 * Writes value to buf at the specified offset as big-endian. The value must be a valid unsigned 32-bit integer. 3127 * 3128 * @param { number } value - value value Number to be written to buf 3129 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 4 3130 * @returns { number } offset plus the number of bytes written 3131 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3132 * 1.Mandatory parameters are left unspecified; 3133 * 2.Incorrect parameter types; 3134 * 3.Parameter verification failed. 3135 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 3136 * @syscap SystemCapability.Utils.Lang 3137 * @crossplatform 3138 * @since 10 3139 */ 3140 /** 3141 * Writes value to buf at the specified offset as big-endian. The value must be a valid unsigned 32-bit integer. 3142 * 3143 * @param { number } value - value value Number to be written to buf 3144 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 4 3145 * @returns { number } offset plus the number of bytes written 3146 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3147 * 1.Mandatory parameters are left unspecified; 3148 * 2.Incorrect parameter types; 3149 * 3.Parameter verification failed. 3150 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 3151 * @syscap SystemCapability.Utils.Lang 3152 * @crossplatform 3153 * @atomicservice 3154 * @since 11 3155 */ 3156 writeUInt32BE(value: number, offset?: number): number; 3157 3158 /** 3159 * Writes value to buf at the specified offset as little-endian. The value must be a valid unsigned 32-bit integer. 3160 * 3161 * @param { number } value - value value Number to be written to buf 3162 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 4 3163 * @returns { number } offset plus the number of bytes written 3164 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3165 * 1.Mandatory parameters are left unspecified; 3166 * 2.Incorrect parameter types; 3167 * 3.Parameter verification failed. 3168 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 3169 * @syscap SystemCapability.Utils.Lang 3170 * @since 9 3171 */ 3172 /** 3173 * Writes value to buf at the specified offset as little-endian. The value must be a valid unsigned 32-bit integer. 3174 * 3175 * @param { number } value - value value Number to be written to buf 3176 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 4 3177 * @returns { number } offset plus the number of bytes written 3178 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3179 * 1.Mandatory parameters are left unspecified; 3180 * 2.Incorrect parameter types; 3181 * 3.Parameter verification failed. 3182 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 3183 * @syscap SystemCapability.Utils.Lang 3184 * @crossplatform 3185 * @since 10 3186 */ 3187 /** 3188 * Writes value to buf at the specified offset as little-endian. The value must be a valid unsigned 32-bit integer. 3189 * 3190 * @param { number } value - value value Number to be written to buf 3191 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 4 3192 * @returns { number } offset plus the number of bytes written 3193 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3194 * 1.Mandatory parameters are left unspecified; 3195 * 2.Incorrect parameter types; 3196 * 3.Parameter verification failed. 3197 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 3198 * @syscap SystemCapability.Utils.Lang 3199 * @crossplatform 3200 * @atomicservice 3201 * @since 11 3202 */ 3203 writeUInt32LE(value: number, offset?: number): number; 3204 3205 /** 3206 * Writes byteLength bytes of value to buf at the specified offset as big-endian 3207 * 3208 * @param { number } value - value value Number to be written to buf 3209 * @param { number } offset - offset offset Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength 3210 * @param { number } byteLength - byteLength byteLength Number of bytes to write. Must satisfy 0 < byteLength <= 6 3211 * @returns { number } offset plus the number of bytes written 3212 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3213 * 1.Mandatory parameters are left unspecified; 3214 * 2.Incorrect parameter types. 3215 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 3216 * @syscap SystemCapability.Utils.Lang 3217 * @since 9 3218 */ 3219 /** 3220 * Writes byteLength bytes of value to buf at the specified offset as big-endian 3221 * 3222 * @param { number } value - value value Number to be written to buf 3223 * @param { number } offset - offset offset Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength 3224 * @param { number } byteLength - byteLength byteLength Number of bytes to write. Must satisfy 0 < byteLength <= 6 3225 * @returns { number } offset plus the number of bytes written 3226 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3227 * 1.Mandatory parameters are left unspecified; 3228 * 2.Incorrect parameter types. 3229 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 3230 * @syscap SystemCapability.Utils.Lang 3231 * @crossplatform 3232 * @since 10 3233 */ 3234 /** 3235 * Writes byteLength bytes of value to buf at the specified offset as big-endian 3236 * 3237 * @param { number } value - value value Number to be written to buf 3238 * @param { number } offset - offset offset Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength 3239 * @param { number } byteLength - byteLength byteLength Number of bytes to write. Must satisfy 0 < byteLength <= 6 3240 * @returns { number } offset plus the number of bytes written 3241 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3242 * 1.Mandatory parameters are left unspecified; 3243 * 2.Incorrect parameter types. 3244 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 3245 * @syscap SystemCapability.Utils.Lang 3246 * @crossplatform 3247 * @atomicservice 3248 * @since 11 3249 */ 3250 writeUIntBE(value: number, offset: number, byteLength: number): number; 3251 3252 /** 3253 * Writes byteLength bytes of value to buf at the specified offset as little-endian 3254 * 3255 * @param { number } value - value value Number to be written to buf 3256 * @param { number } offset - offset offset Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength 3257 * @param { number } byteLength - byteLength byteLength Number of bytes to write. Must satisfy 0 < byteLength <= 6 3258 * @returns { number } offset plus the number of bytes written 3259 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3260 * 1.Mandatory parameters are left unspecified; 3261 * 2.Incorrect parameter types. 3262 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 3263 * @syscap SystemCapability.Utils.Lang 3264 * @since 9 3265 */ 3266 /** 3267 * Writes byteLength bytes of value to buf at the specified offset as little-endian 3268 * 3269 * @param { number } value - value value Number to be written to buf 3270 * @param { number } offset - offset offset Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength 3271 * @param { number } byteLength - byteLength byteLength Number of bytes to write. Must satisfy 0 < byteLength <= 6 3272 * @returns { number } offset plus the number of bytes written 3273 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3274 * 1.Mandatory parameters are left unspecified; 3275 * 2.Incorrect parameter types. 3276 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 3277 * @syscap SystemCapability.Utils.Lang 3278 * @crossplatform 3279 * @since 10 3280 */ 3281 /** 3282 * Writes byteLength bytes of value to buf at the specified offset as little-endian 3283 * 3284 * @param { number } value - value value Number to be written to buf 3285 * @param { number } offset - offset offset Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength 3286 * @param { number } byteLength - byteLength byteLength Number of bytes to write. Must satisfy 0 < byteLength <= 6 3287 * @returns { number } offset plus the number of bytes written 3288 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3289 * 1.Mandatory parameters are left unspecified; 3290 * 2.Incorrect parameter types. 3291 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 3292 * @syscap SystemCapability.Utils.Lang 3293 * @crossplatform 3294 * @atomicservice 3295 * @since 11 3296 */ 3297 writeUIntLE(value: number, offset: number, byteLength: number): number; 3298 } 3299 3300 /** 3301 * Process data as blob type 3302 * 3303 * @syscap SystemCapability.Utils.Lang 3304 * @since 9 3305 */ 3306 /** 3307 * Process data as blob type 3308 * 3309 * @syscap SystemCapability.Utils.Lang 3310 * @crossplatform 3311 * @since 10 3312 */ 3313 /** 3314 * Process data as blob type 3315 * 3316 * @syscap SystemCapability.Utils.Lang 3317 * @crossplatform 3318 * @atomicservice 3319 * @since 11 3320 */ 3321 class Blob { 3322 /** 3323 * Creates a new Blob object containing a concatenation of the given sources. 3324 * 3325 * @param { string[] | ArrayBuffer[] | TypedArray[] | DataView[] | Blob[] } sources - sources sources An array of string, <ArrayBuffer>, 3326 * <TypedArray>, <DataView>, or <Blob> objects, or any mix of such objects, that will be stored within the Blob 3327 * @param { Object } [options] - options options {endings: string, type: string} 3328 * endings: One of either 'transparent' or 'native'. 3329 * type: The Blob content-type 3330 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3331 * 1.Mandatory parameters are left unspecified; 3332 * 2.Incorrect parameter types. 3333 * @syscap SystemCapability.Utils.Lang 3334 * @since 9 3335 */ 3336 /** 3337 * Creates a new Blob object containing a concatenation of the given sources. 3338 * 3339 * @param { string[] | ArrayBuffer[] | TypedArray[] | DataView[] | Blob[] } sources - sources sources An array of string, <ArrayBuffer>, 3340 * <TypedArray>, <DataView>, or <Blob> objects, or any mix of such objects, that will be stored within the Blob 3341 * @param { Object } [options] - options options {endings: string, type: string} 3342 * endings: One of either 'transparent' or 'native'. 3343 * type: The Blob content-type 3344 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3345 * 1.Mandatory parameters are left unspecified; 3346 * 2.Incorrect parameter types. 3347 * @syscap SystemCapability.Utils.Lang 3348 * @crossplatform 3349 * @since 10 3350 */ 3351 /** 3352 * Creates a new Blob object containing a concatenation of the given sources. 3353 * 3354 * @param { string[] | ArrayBuffer[] | TypedArray[] | DataView[] | Blob[] } sources - sources sources An array of string, <ArrayBuffer>, 3355 * <TypedArray>, <DataView>, or <Blob> objects, or any mix of such objects, that will be stored within the Blob 3356 * @param { Object } [options] - options options {endings: string, type: string} 3357 * endings: One of either 'transparent' or 'native'. 3358 * type: The Blob content-type 3359 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3360 * 1.Mandatory parameters are left unspecified; 3361 * 2.Incorrect parameter types. 3362 * @syscap SystemCapability.Utils.Lang 3363 * @crossplatform 3364 * @atomicservice 3365 * @since 11 3366 */ 3367 constructor(sources: string[] | ArrayBuffer[] | TypedArray[] | DataView[] | Blob[], options?: Object); 3368 3369 /** 3370 * The total size of the Blob in bytes 3371 * 3372 * @syscap SystemCapability.Utils.Lang 3373 * @since 9 3374 */ 3375 /** 3376 * The total size of the Blob in bytes 3377 * 3378 * @syscap SystemCapability.Utils.Lang 3379 * @crossplatform 3380 * @since 10 3381 */ 3382 /** 3383 * The total size of the Blob in bytes 3384 * 3385 * @syscap SystemCapability.Utils.Lang 3386 * @crossplatform 3387 * @atomicservice 3388 * @since 11 3389 */ 3390 size: number; 3391 3392 /** 3393 * The content-type of the Blob 3394 * 3395 * @syscap SystemCapability.Utils.Lang 3396 * @since 9 3397 */ 3398 /** 3399 * The content-type of the Blob 3400 * 3401 * @syscap SystemCapability.Utils.Lang 3402 * @crossplatform 3403 * @since 10 3404 */ 3405 /** 3406 * The content-type of the Blob 3407 * 3408 * @syscap SystemCapability.Utils.Lang 3409 * @crossplatform 3410 * @atomicservice 3411 * @since 11 3412 */ 3413 type: string; 3414 3415 /** 3416 * Returns a promise that fulfills with an <ArrayBuffer> containing a copy of the Blob data. 3417 * 3418 * @returns { Promise<ArrayBuffer> } 3419 * @syscap SystemCapability.Utils.Lang 3420 * @since 9 3421 */ 3422 /** 3423 * Returns a promise that fulfills with an <ArrayBuffer> containing a copy of the Blob data. 3424 * 3425 * @returns { Promise<ArrayBuffer> } 3426 * @syscap SystemCapability.Utils.Lang 3427 * @crossplatform 3428 * @since 10 3429 */ 3430 /** 3431 * Returns a promise that fulfills with an <ArrayBuffer> containing a copy of the Blob data. 3432 * 3433 * @returns { Promise<ArrayBuffer> } 3434 * @syscap SystemCapability.Utils.Lang 3435 * @crossplatform 3436 * @atomicservice 3437 * @since 11 3438 */ 3439 arrayBuffer(): Promise<ArrayBuffer>; 3440 3441 /** 3442 * Creates and returns a new Blob containing a subset of this Blob objects data. The original Blob is not altered 3443 * 3444 * @param { number } [start] - start start The starting index 3445 * @param { number } [end] - end end The ending index 3446 * @param { string } [type] - type type The content-type for the new Blob 3447 * @returns { Blob } 3448 * @syscap SystemCapability.Utils.Lang 3449 * @since 9 3450 */ 3451 /** 3452 * Creates and returns a new Blob containing a subset of this Blob objects data. The original Blob is not altered 3453 * 3454 * @param { number } [start] - start start The starting index 3455 * @param { number } [end] - end end The ending index 3456 * @param { string } [type] - type type The content-type for the new Blob 3457 * @returns { Blob } 3458 * @syscap SystemCapability.Utils.Lang 3459 * @crossplatform 3460 * @since 10 3461 */ 3462 /** 3463 * Creates and returns a new Blob containing a subset of this Blob objects data. The original Blob is not altered 3464 * 3465 * @param { number } [start] - start start The starting index 3466 * @param { number } [end] - end end The ending index 3467 * @param { string } [type] - type type The content-type for the new Blob 3468 * @returns { Blob } 3469 * @syscap SystemCapability.Utils.Lang 3470 * @crossplatform 3471 * @atomicservice 3472 * @since 11 3473 */ 3474 slice(start?: number, end?: number, type?: string): Blob; 3475 3476 /** 3477 * Returns a promise that fulfills with the contents of the Blob decoded as a UTF-8 string. 3478 * 3479 * @returns { Promise<string> } 3480 * @syscap SystemCapability.Utils.Lang 3481 * @since 9 3482 */ 3483 /** 3484 * Returns a promise that fulfills with the contents of the Blob decoded as a UTF-8 string. 3485 * 3486 * @returns { Promise<string> } 3487 * @syscap SystemCapability.Utils.Lang 3488 * @crossplatform 3489 * @since 10 3490 */ 3491 /** 3492 * Returns a promise that fulfills with the contents of the Blob decoded as a UTF-8 string. 3493 * 3494 * @returns { Promise<string> } 3495 * @syscap SystemCapability.Utils.Lang 3496 * @crossplatform 3497 * @atomicservice 3498 * @since 11 3499 */ 3500 text(): Promise<string>; 3501 } 3502} 3503export default buffer; 3504