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