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