1/* 2 * Copyright (c) 2025 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 * @file 17 * @kit ArkTS 18 */ 19/** 20 * The FastBuffer class is a container type for dealing with binary data directly. It can be constructed in a variety of ways. 21 * 22 * @namespace fastbuffer 23 * @syscap SystemCapability.Utils.Lang 24 * @crossplatform 25 * @atomicservice 26 * @since 20 27 */ 28declare namespace fastbuffer { 29 /** 30 * This parameter specifies the type of a common encoding format. 31 * 32 * @typedef { 'ascii' | 'utf8' | 'utf-8' | 'utf16le' | 'ucs2' | 'ucs-2' | 'base64' | 'base64url' | 'latin1' | 'binary' | 'hex' } 33 * @syscap SystemCapability.Utils.Lang 34 * @crossplatform 35 * @atomicservice 36 * @since 20 37 */ 38 type BufferEncoding = 'ascii' | 'utf8' | 'utf-8' | 'utf16le' | 'ucs2' | 'ucs-2' | 'base64' | 'base64url' | 'latin1' | 'binary' | 'hex'; 39 /** 40 * TypedArray inherits the features and methods of Int8Array 41 * 42 * @extends Int8Array 43 * @typedef TypedArray 44 * @syscap SystemCapability.Utils.Lang 45 * @crossplatform 46 * @atomicservice 47 * @since 20 48 */ 49 interface TypedArray extends Int8Array { 50 } 51 /** 52 * Allocates a new FastBuffer for a fixed size bytes. If fill is undefined, the FastBuffer will be zero-filled. 53 * 54 * @param { number } size - size size The desired length of the new FastBuffer 55 * @param { string | FastBuffer | number } [fill] - fill [fill=0] A value to pre-fill the new FastBuffer with 56 * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If `fill` is a string, this is its encoding 57 * @returns { FastBuffer } Return a new allocated FastBuffer 58 * @syscap SystemCapability.Utils.Lang 59 * @crossplatform 60 * @atomicservice 61 * @since 20 62 */ 63 function alloc(size: number, fill?: string | FastBuffer | number, encoding?: BufferEncoding): FastBuffer; 64 /** 65 * Allocates a new FastBuffer for a fixed size bytes. The FastBuffer will not be initially filled. 66 * 67 * @param { number } size - size size The desired length of the new FastBuffer 68 * @returns { FastBuffer } Return a new allocated FastBuffer 69 * @syscap SystemCapability.Utils.Lang 70 * @crossplatform 71 * @atomicservice 72 * @since 20 73 */ 74 function allocUninitializedFromPool(size: number): FastBuffer; 75 /** 76 * Allocates a new un-pooled FastBuffer for a fixed size bytes. The FastBuffer will not be initially filled. 77 * 78 * @param { number } size - size size The desired length of the new FastBuffer 79 * @returns { FastBuffer } Return a new allocated FastBuffer 80 * @syscap SystemCapability.Utils.Lang 81 * @crossplatform 82 * @atomicservice 83 * @since 20 84 */ 85 function allocUninitialized(size: number): FastBuffer; 86 /** 87 * Returns the byte length of a string when encoded using `encoding`. 88 * This is not the same as [`String.prototype.length`], which does not account 89 * for the encoding that is used to convert the string into bytes. 90 * 91 * @param { string | FastBuffer | TypedArray | DataView | ArrayBuffer | SharedArrayBuffer } value - Target string. 92 * @param { BufferEncoding } [encoding] - Encoding format of the string. The default value is 'utf8'. 93 * @returns { number } The number of bytes contained within `string` 94 * @syscap SystemCapability.Utils.Lang 95 * @crossplatform 96 * @atomicservice 97 * @since 20 98 */ 99 function byteLength(value: string | FastBuffer | TypedArray | DataView | ArrayBuffer | SharedArrayBuffer, encoding?: BufferEncoding): number; 100 /** 101 * Returns a new `FastBuffer` which is the result of concatenating all the `FastBuffer`instances in the `list` together. 102 * 103 * @param { FastBuffer[] | Uint8Array[] } list - list list List of `FastBuffer` or Uint8Array instances to concatenate 104 * @param { number } [totalLength] - totalLength totalLength Total length of the `FastBuffer` instances in `list` when concatenated 105 * @returns { FastBuffer } Return a new allocated FastBuffer 106 * @throws { BusinessError } 10200001 - Range error. Possible causes: 107 * The value of the parameter is not within the specified range. 108 * @syscap SystemCapability.Utils.Lang 109 * @crossplatform 110 * @atomicservice 111 * @since 20 112 */ 113 function concat(list: FastBuffer[] | Uint8Array[], totalLength?: number): FastBuffer; 114 /** 115 * Allocates a new FastBuffer using an array of bytes in the range 0 – 255. Array entries outside that range will be truncated to fit into it. 116 * 117 * @param { number[] } array - array array an array of bytes in the range 0 – 255 118 * @returns { FastBuffer } Return a new allocated FastBuffer 119 * @syscap SystemCapability.Utils.Lang 120 * @crossplatform 121 * @atomicservice 122 * @since 20 123 */ 124 function from(array: number[]): FastBuffer; 125 /** 126 * This creates a view of the ArrayBuffer without copying the underlying memory. 127 * 128 * @param { ArrayBuffer | SharedArrayBuffer } arrayBuffer - arrayBuffer arrayBuffer An ArrayBuffer, 129 * SharedArrayBuffer, for example the .buffer property of a TypedArray. 130 * @param { number } [byteOffset] - byteOffset [byteOffset = 0] Index of first byte to expose 131 * @param { number } [length] - length [length = arrayBuffer.byteLength - byteOffset] Number of bytes to expose 132 * @returns { FastBuffer } Return a view of the ArrayBuffer 133 * @throws { BusinessError } 10200001 - Range error. Possible causes: 134 * The value of the parameter is not within the specified range. 135 * @throws { BusinessError } 10200068 - The underlying ArrayBuffer is null or detach. 136 * @syscap SystemCapability.Utils.Lang 137 * @crossplatform 138 * @atomicservice 139 * @since 20 140 */ 141 function from(arrayBuffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): FastBuffer; 142 /** 143 * Copies the passed buffer data onto a new FastBuffer instance. 144 * 145 * @param { FastBuffer | Uint8Array } buffer - buffer buffer An existing FastBuffer or Uint8Array from which to copy data 146 * @returns { FastBuffer } Return a new allocated FastBuffer 147 * @throws { BusinessError } 10200068 - The underlying ArrayBuffer is null or detach. 148 * @syscap SystemCapability.Utils.Lang 149 * @crossplatform 150 * @atomicservice 151 * @since 20 152 */ 153 function from(buffer: FastBuffer | Uint8Array): FastBuffer; 154 /** 155 * Creates a new FastBuffer containing string. The encoding parameter identifies the character encoding 156 * to be used when converting string into bytes. 157 * 158 * @param { string } value - value string A string to encode 159 * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] The encoding of string 160 * @returns { FastBuffer } Return a new FastBuffer containing string 161 * @syscap SystemCapability.Utils.Lang 162 * @crossplatform 163 * @atomicservice 164 * @since 20 165 */ 166 function from(value: string, encoding?: BufferEncoding): FastBuffer; 167 /** 168 * Returns true if obj is a FastBuffer, false otherwise 169 * 170 * @param { Object } obj - obj obj Objects to be judged 171 * @returns { boolean } true or false 172 * @syscap SystemCapability.Utils.Lang 173 * @crossplatform 174 * @atomicservice 175 * @since 20 176 */ 177 function isBuffer(obj: Object): boolean; 178 /** 179 * Returns true if encoding is the name of a supported character encoding, or false otherwise. 180 * 181 * @param { string } encoding - encoding encoding A character encoding name to check 182 * @returns { boolean } true or false 183 * @syscap SystemCapability.Utils.Lang 184 * @crossplatform 185 * @atomicservice 186 * @since 20 187 */ 188 function isEncoding(encoding: string): boolean; 189 /** 190 * Compares buf1 to buf2 191 * 192 * @param { FastBuffer | Uint8Array } buf1 - buf1 buf1 A FastBuffer or Uint8Array instance. 193 * @param { FastBuffer | Uint8Array } buf2 - buf2 buf2 A FastBuffer or Uint8Array instance. 194 * @returns { -1 | 0 | 1 } 0 is returned if target is the same as buf 195 * 1 is returned if target should come before buf when sorted. 196 * -1 is returned if target should come after buf when sorted. 197 * @throws { BusinessError } 10200068 - The underlying ArrayBuffer is null or detach. 198 * @syscap SystemCapability.Utils.Lang 199 * @crossplatform 200 * @atomicservice 201 * @since 20 202 */ 203 function compare(buf1: FastBuffer | Uint8Array, buf2: FastBuffer | Uint8Array): -1 | 0 | 1; 204 /** 205 * Re-encodes the given FastBuffer or Uint8Array instance from one character encoding to another. 206 * 207 * @param { FastBuffer | Uint8Array } source - source source A FastBuffer or Uint8Array instance. 208 * @param { string } fromEnc - fromEnc fromEnc The current encoding 209 * @param { string } toEnc - toEnc toEnc To target encoding 210 * @returns { FastBuffer } Returns a new FastBuffer instance 211 * @syscap SystemCapability.Utils.Lang 212 * @crossplatform 213 * @atomicservice 214 * @since 20 215 */ 216 function transcode(source: FastBuffer | Uint8Array, fromEnc: string, toEnc: string): FastBuffer; 217 /** 218 * The FastBuffer object is a method of handling buffers dedicated to binary data. 219 * 220 * @syscap SystemCapability.Utils.Lang 221 * @crossplatform 222 * @atomicservice 223 * @since 20 224 */ 225 class FastBuffer { 226 /** 227 * Returns the number of bytes in buf 228 * 229 * @type { number } 230 * @syscap SystemCapability.Utils.Lang 231 * @crossplatform 232 * @atomicservice 233 * @since 20 234 */ 235 length: number; 236 /** 237 * The arraybuffer underlying the FastBuffer object 238 * 239 * @type { ArrayBuffer } 240 * @syscap SystemCapability.Utils.Lang 241 * @crossplatform 242 * @atomicservice 243 * @since 20 244 */ 245 buffer: ArrayBuffer; 246 /** 247 * The byteOffset of the Buffers underlying ArrayBuffer object 248 * 249 * @type { number } 250 * @syscap SystemCapability.Utils.Lang 251 * @crossplatform 252 * @atomicservice 253 * @since 20 254 */ 255 byteOffset: number; 256 /** 257 * Fills buf with the specified value. If the offset and end are not given, the entire buf will be filled. 258 * 259 * @param { string | FastBuffer | Uint8Array | number } value - value value The value with which to fill buf 260 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to fill buf 261 * @param { number } [end] - end [end = buf.length] Where to stop filling buf (not inclusive) 262 * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] The encoding for value if value is a string 263 * @returns { FastBuffer } A reference to buf 264 * @throws { BusinessError } 10200001 - Range error. Possible causes: 265 * The value of the parameter is not within the specified range. 266 * @throws { BusinessError } 10200068 - The underlying ArrayBuffer is null or detach. 267 * @syscap SystemCapability.Utils.Lang 268 * @crossplatform 269 * @atomicservice 270 * @since 20 271 */ 272 fill(value: string | FastBuffer | Uint8Array | number, offset?: number, end?: number, encoding?: BufferEncoding): FastBuffer; 273 /** 274 * Compares buf with target and returns a number indicating whether buf comes before, after, 275 * or is the same as target in sort order. Comparison is based on the actual sequence of bytes in each FastBuffer. 276 * 277 * @param { FastBuffer | Uint8Array } target - target target A FastBuffer or Uint8Array with which to compare buf 278 * @param { number } [targetStart] - targetStart [targetStart = 0] The offset within target at which to begin comparison 279 * @param { number } [targetEnd] - targetEnd [targetEnd = target.length] The offset within target at which to end comparison (not inclusive) 280 * @param { number } [sourceStart] - sourceStart [sourceStart = 0] The offset within buf at which to begin comparison 281 * @param { number } [sourceEnd] - sourceEnd [sourceEnd = buf.length] The offset within buf at which to end comparison (not inclusive) 282 * @returns { -1 | 0 | 1 } 0 is returned if target is the same as buf 283 * 1 is returned if target should come before buf when sorted. 284 * -1 is returned if target should come after buf when sorted. 285 * @throws { BusinessError } 10200001 - Range error. Possible causes: 286 * The value of the parameter is not within the specified range. 287 * @throws { BusinessError } 10200068 - The underlying ArrayBuffer is null or detach. 288 * @syscap SystemCapability.Utils.Lang 289 * @crossplatform 290 * @atomicservice 291 * @since 20 292 */ 293 compare(target: FastBuffer | Uint8Array, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): -1 | 0 | 1; 294 /** 295 * Copies data from a region of buf to a region in target, even if the target memory region overlaps with buf. 296 * 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. 297 * 298 * @param { FastBuffer | Uint8Array } target - target target A FastBuffer or Uint8Array to copy into 299 * @param { number } [targetStart] - targetStart [targetStart = 0] The offset within target at which to begin writing 300 * @param { number } [sourceStart] - sourceStart [sourceStart = 0] The offset within buf from which to begin copying 301 * @param { number } [sourceEnd] - sourceEnd [sourceEnd = buf.length] The offset within buf at which to stop copying (not inclusive) 302 * @returns { number } The number of bytes copied 303 * @throws { BusinessError } 10200001 - Range error. Possible causes: 304 * The value of the parameter is not within the specified range. 305 * @throws { BusinessError } 10200068 - The underlying ArrayBuffer is null or detach. 306 * @syscap SystemCapability.Utils.Lang 307 * @crossplatform 308 * @atomicservice 309 * @since 20 310 */ 311 copy(target: FastBuffer | Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; 312 /** 313 * Returns true if both buf and otherBuffer have exactly the same bytes, false otherwise 314 * 315 * @param { Uint8Array | FastBuffer } otherBuffer - otherBuffer otherBuffer A FastBuffer or Uint8Array with which to compare buf 316 * @returns { boolean } true or false 317 * @throws { BusinessError } 10200068 - The underlying ArrayBuffer is null or detach. 318 * @syscap SystemCapability.Utils.Lang 319 * @crossplatform 320 * @atomicservice 321 * @since 20 322 */ 323 equals(otherBuffer: Uint8Array | FastBuffer): boolean; 324 /** 325 * Returns true if value was found in buf, false otherwise 326 * 327 * @param { string | number | FastBuffer | Uint8Array } value - value value What to search for 328 * @param { number } [byteOffset] - byteOffset [byteOffset = 0] Where to begin searching in buf. If negative, then offset is calculated from the end of buf 329 * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If value is a string, this is its encoding 330 * @returns { boolean } true or false 331 * @syscap SystemCapability.Utils.Lang 332 * @crossplatform 333 * @atomicservice 334 * @since 20 335 */ 336 includes(value: string | number | FastBuffer | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): boolean; 337 /** 338 * The index of the first occurrence of value in buf 339 * 340 * @param { string | number | FastBuffer | Uint8Array } value - value value What to search for 341 * @param { number } [byteOffset] - byteOffset [byteOffset = 0] Where to begin searching in buf 342 * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If value is a string, 343 * this is the encoding used to determine the binary representation of the string that will be searched for in buf 344 * @returns { number } The index of the first occurrence of value in buf, or -1 if buf does not contain value 345 * @syscap SystemCapability.Utils.Lang 346 * @crossplatform 347 * @atomicservice 348 * @since 20 349 */ 350 indexOf(value: string | number | FastBuffer | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number; 351 /** 352 * Creates and returns an iterator of buf keys (indices). 353 * 354 * @returns { IterableIterator<number> } 355 * @syscap SystemCapability.Utils.Lang 356 * @crossplatform 357 * @atomicservice 358 * @since 20 359 */ 360 keys(): IterableIterator<number>; 361 /** 362 * Creates and returns an iterator for buf values (bytes). 363 * 364 * @returns { IterableIterator<number> } 365 * @syscap SystemCapability.Utils.Lang 366 * @crossplatform 367 * @atomicservice 368 * @since 20 369 */ 370 values(): IterableIterator<number>; 371 /** 372 * Creates and returns an iterator of [index, byte] pairs from the contents of buf. 373 * 374 * @returns { IterableIterator<[number, number]> } 375 * @syscap SystemCapability.Utils.Lang 376 * @crossplatform 377 * @atomicservice 378 * @since 20 379 */ 380 entries(): IterableIterator<[ 381 number, 382 number 383 ]>; 384 /** 385 * The index of the last occurrence of value in buf 386 * 387 * @param { string | number | FastBuffer | Uint8Array } value - value value What to search for 388 * @param { number } [byteOffset] - byteOffset [byteOffset = 0] Where to begin searching in buf 389 * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If value is a string, 390 * this is the encoding used to determine the binary representation of the string that will be searched for in buf 391 * @returns { number } The index of the last occurrence of value in buf, or -1 if buf does not contain value 392 * @syscap SystemCapability.Utils.Lang 393 * @crossplatform 394 * @atomicservice 395 * @since 20 396 */ 397 lastIndexOf(value: string | number | FastBuffer | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number; 398 /** 399 * Reads a signed, big-endian 64-bit integer from buf at the specified offset 400 * 401 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 402 * @returns { bigint } Return a signed, big-endian 64-bit integer 403 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] 404 * @syscap SystemCapability.Utils.Lang 405 * @crossplatform 406 * @atomicservice 407 * @since 20 408 */ 409 readBigInt64BE(offset?: number): bigint; 410 /** 411 * Reads a signed, little-endian 64-bit integer from buf at the specified offset 412 * 413 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 414 * @returns { bigint } Return a signed, little-endian 64-bit integer 415 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] 416 * @syscap SystemCapability.Utils.Lang 417 * @crossplatform 418 * @atomicservice 419 * @since 20 420 */ 421 readBigInt64LE(offset?: number): bigint; 422 /** 423 * Reads a unsigned, big-endian 64-bit integer from buf at the specified offset 424 * 425 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 426 * @returns { bigint } Return a unsigned, big-endian 64-bit integer 427 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] 428 * @syscap SystemCapability.Utils.Lang 429 * @crossplatform 430 * @atomicservice 431 * @since 20 432 */ 433 readBigUInt64BE(offset?: number): bigint; 434 /** 435 * Reads a unsigned, little-endian 64-bit integer from buf at the specified offset 436 * 437 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 438 * @returns { bigint } Return a unsigned, little-endian 64-bit integer 439 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] 440 * @syscap SystemCapability.Utils.Lang 441 * @crossplatform 442 * @atomicservice 443 * @since 20 444 */ 445 readBigUInt64LE(offset?: number): bigint; 446 /** 447 * Reads a 64-bit, big-endian double from buf at the specified offset 448 * 449 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 450 * @returns { number } Return a 64-bit, big-endian double 451 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] 452 * @syscap SystemCapability.Utils.Lang 453 * @crossplatform 454 * @atomicservice 455 * @since 20 456 */ 457 readDoubleBE(offset?: number): number; 458 /** 459 * Reads a 64-bit, little-endian double from buf at the specified offset 460 * 461 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 462 * @returns { number } Return a 64-bit, little-endian double 463 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] 464 * @syscap SystemCapability.Utils.Lang 465 * @crossplatform 466 * @atomicservice 467 * @since 20 468 */ 469 readDoubleLE(offset?: number): number; 470 /** 471 * Reads a 32-bit, big-endian float from buf at the specified offset 472 * 473 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 4 474 * @returns { number } Return a 32-bit, big-endian float 475 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] 476 * @syscap SystemCapability.Utils.Lang 477 * @crossplatform 478 * @atomicservice 479 * @since 20 480 */ 481 readFloatBE(offset?: number): number; 482 /** 483 * Reads a 32-bit, little-endian float from buf at the specified offset 484 * 485 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 4 486 * @returns { number } Return a 32-bit, little-endian float 487 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] 488 * @syscap SystemCapability.Utils.Lang 489 * @crossplatform 490 * @atomicservice 491 * @since 20 492 */ 493 readFloatLE(offset?: number): number; 494 /** 495 * Reads a signed 8-bit integer from buf at the specified offset 496 * 497 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 1 498 * @returns { number } Return a signed 8-bit integer 499 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 1. Received value is: [offset] 500 * @syscap SystemCapability.Utils.Lang 501 * @crossplatform 502 * @atomicservice 503 * @since 20 504 */ 505 readInt8(offset?: number): number; 506 /** 507 * Reads a signed, big-endian 16-bit integer from buf at the specified offset 508 * 509 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 2 510 * @returns { number } Return a signed, big-endian 16-bit integer 511 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] 512 * @syscap SystemCapability.Utils.Lang 513 * @crossplatform 514 * @atomicservice 515 * @since 20 516 */ 517 readInt16BE(offset?: number): number; 518 /** 519 * Reads a signed, little-endian 16-bit integer from buf at the specified offset 520 * 521 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 2 522 * @returns { number } Return a signed, little-endian 16-bit integer 523 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] 524 * @syscap SystemCapability.Utils.Lang 525 * @crossplatform 526 * @atomicservice 527 * @since 20 528 */ 529 readInt16LE(offset?: number): number; 530 /** 531 * Reads a signed, big-endian 32-bit integer from buf at the specified offset 532 * 533 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 4 534 * @returns { number } Return a signed, big-endian 32-bit integer 535 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] 536 * @syscap SystemCapability.Utils.Lang 537 * @crossplatform 538 * @atomicservice 539 * @since 20 540 */ 541 readInt32BE(offset?: number): number; 542 /** 543 * Reads a signed, little-endian 32-bit integer from buf at the specified offset 544 * 545 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 4 546 * @returns { number } Return a signed, little-endian 32-bit integer 547 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] 548 * @syscap SystemCapability.Utils.Lang 549 * @crossplatform 550 * @atomicservice 551 * @since 20 552 */ 553 readInt32LE(offset?: number): number; 554 /** 555 * Reads byteLength number of bytes from buf at the specified offset and interprets the result as a big-endian, 556 * two's complement signed value supporting up to 48 bits of accuracy 557 * 558 * @param { number } offset - offset offset Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - byteLength 559 * @param { number } byteLength - byteLength byteLength Number of bytes to read. Must satisfy 0 < byteLength <= 6 560 * @returns { number } 561 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 562 * @syscap SystemCapability.Utils.Lang 563 * @crossplatform 564 * @atomicservice 565 * @since 20 566 */ 567 readIntBE(offset: number, byteLength: number): number; 568 /** 569 * Reads byteLength number of bytes from buf at the specified offset and interprets the result as a little-endian, 570 * two's complement signed value supporting up to 48 bits of accuracy. 571 * 572 * @param { number } offset - offset offset Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - byteLength 573 * @param { number } byteLength - byteLength byteLength Number of bytes to read. Must satisfy 0 < byteLength <= 6 574 * @returns { number } 575 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 576 * @syscap SystemCapability.Utils.Lang 577 * @crossplatform 578 * @atomicservice 579 * @since 20 580 */ 581 readIntLE(offset: number, byteLength: number): number; 582 /** 583 * Reads an unsigned 8-bit integer from buf at the specified offset 584 * 585 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 1 586 * @returns { number } Reads an unsigned 8-bit integer 587 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 1. Received value is: [offset] 588 * @syscap SystemCapability.Utils.Lang 589 * @crossplatform 590 * @atomicservice 591 * @since 20 592 */ 593 readUInt8(offset?: number): number; 594 /** 595 * Reads an unsigned, big-endian 16-bit integer from buf at the specified offset 596 * 597 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 2 598 * @returns { number } Reads an unsigned, big-endian 16-bit integer 599 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] 600 * @syscap SystemCapability.Utils.Lang 601 * @crossplatform 602 * @atomicservice 603 * @since 20 604 */ 605 readUInt16BE(offset?: number): number; 606 /** 607 * Reads an unsigned, little-endian 16-bit integer from buf at the specified offset 608 * 609 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 2 610 * @returns { number } Reads an unsigned, little-endian 16-bit integer 611 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] 612 * @syscap SystemCapability.Utils.Lang 613 * @crossplatform 614 * @atomicservice 615 * @since 20 616 */ 617 readUInt16LE(offset?: number): number; 618 /** 619 * Reads an unsigned, big-endian 32-bit integer from buf at the specified offset 620 * 621 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 4 622 * @returns { number } Reads an unsigned, big-endian 32-bit integer 623 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] 624 * @syscap SystemCapability.Utils.Lang 625 * @crossplatform 626 * @atomicservice 627 * @since 20 628 */ 629 readUInt32BE(offset?: number): number; 630 /** 631 * Reads an unsigned, little-endian 32-bit integer from buf at the specified offset 632 * 633 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 4 634 * @returns { number } Reads an unsigned, little-endian 32-bit integer 635 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] 636 * @syscap SystemCapability.Utils.Lang 637 * @crossplatform 638 * @atomicservice 639 * @since 20 640 */ 641 readUInt32LE(offset?: number): number; 642 /** 643 * Reads byteLength number of bytes from buf at the specified offset and interprets the result as 644 * an unsigned big-endian integer supporting up to 48 bits of accuracy. 645 * 646 * @param { number } offset - offset offset Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - byteLength 647 * @param { number } byteLength - byteLength byteLength Number of bytes to read. Must satisfy 0 < byteLength <= 6 648 * @returns { number } 649 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 650 * @syscap SystemCapability.Utils.Lang 651 * @crossplatform 652 * @atomicservice 653 * @since 20 654 */ 655 readUIntBE(offset: number, byteLength: number): number; 656 /** 657 * Reads byteLength number of bytes from buf at the specified offset and interprets the result as an unsigned, 658 * little-endian integer supporting up to 48 bits of accuracy. 659 * 660 * @param { number } offset - offset offset Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - byteLength 661 * @param { number } byteLength - byteLength byteLength Number of bytes to read. Must satisfy 0 < byteLength <= 6 662 * @returns { number } 663 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 664 * @syscap SystemCapability.Utils.Lang 665 * @crossplatform 666 * @atomicservice 667 * @since 20 668 */ 669 readUIntLE(offset: number, byteLength: number): number; 670 /** 671 * Returns a new FastBuffer that references the same memory as the original, but offset and cropped by the start and end indices. 672 * 673 * @param { number } [start] - start [start = 0] Where the new FastBuffer will start 674 * @param { number } [end] - end [end = buf.length] Where the new FastBuffer will end (not inclusive) 675 * @returns { FastBuffer } Returns a new FastBuffer that references the same memory as the original 676 * @syscap SystemCapability.Utils.Lang 677 * @crossplatform 678 * @atomicservice 679 * @since 20 680 */ 681 subarray(start?: number, end?: number): FastBuffer; 682 /** 683 * Interprets buf as an array of unsigned 16-bit integers and swaps the byte order in-place. 684 * 685 * @returns { FastBuffer } A reference to buf 686 * @throws { BusinessError } 10200009 - The fastbuffer size must be a multiple of 16-bits 687 * @syscap SystemCapability.Utils.Lang 688 * @crossplatform 689 * @atomicservice 690 * @since 20 691 */ 692 swap16(): FastBuffer; 693 /** 694 * Interprets buf as an array of unsigned 32-bit integers and swaps the byte order in-place. 695 * 696 * @returns { FastBuffer } A reference to buf 697 * @throws { BusinessError } 10200009 - The fastbuffer size must be a multiple of 32-bits 698 * @syscap SystemCapability.Utils.Lang 699 * @crossplatform 700 * @atomicservice 701 * @since 20 702 */ 703 swap32(): FastBuffer; 704 /** 705 * Interprets buf as an array of unsigned 64-bit integers and swaps the byte order in-place. 706 * 707 * @returns { FastBuffer } A reference to buf 708 * @throws { BusinessError } 10200009 - The fastbuffer size must be a multiple of 64-bits 709 * @syscap SystemCapability.Utils.Lang 710 * @crossplatform 711 * @atomicservice 712 * @since 20 713 */ 714 swap64(): FastBuffer; 715 /** 716 * Returns a JSON representation of buf 717 * 718 * @returns { Object } Returns a JSON 719 * @syscap SystemCapability.Utils.Lang 720 * @crossplatform 721 * @atomicservice 722 * @since 20 723 */ 724 toJSON(): Object; 725 /** 726 * Decodes buf to a string according to the specified character encoding in encoding 727 * 728 * @param { string } [encoding] - encoding [encoding='utf8'] The character encoding to use 729 * @param { number } [start] - start [start = 0] The byte offset to start decoding at 730 * @param { number } [end] - end [end = buf.length] The byte offset to stop decoding at (not inclusive) 731 * @returns { string } 732 * @throws { BusinessError } 10200068 - The underlying ArrayBuffer is null or detach. 733 * @syscap SystemCapability.Utils.Lang 734 * @crossplatform 735 * @atomicservice 736 * @since 20 737 */ 738 toString(encoding?: string, start?: number, end?: number): string; 739 /** 740 * Writes string to buf at offset according to the character encoding in encoding 741 * 742 * @param { string } str - str str Writes string to buf at offset according to the character encoding in encoding 743 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write string 744 * @param { number } [length] - length [length = buf.length - offset] Maximum number of bytes to write (written bytes will not exceed buf.length - offset) 745 * @param { string } [encoding] - encoding [encoding='utf8'] The character encoding of string. 746 * @returns { number } Number of bytes written. 747 * @throws { BusinessError } 10200001 - Range error. Possible causes: 748 * The value of the parameter is not within the specified range. 749 * @throws { BusinessError } 10200068 - The underlying ArrayBuffer is null or detach. 750 * @syscap SystemCapability.Utils.Lang 751 * @crossplatform 752 * @atomicservice 753 * @since 20 754 */ 755 write(str: string, offset?: number, length?: number, encoding?: string): number; 756 /** 757 * Writes value to buf at the specified offset as big-endian. 758 * 759 * @param { bigint } value - value value Number to be written to buf 760 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 761 * @returns { number } offset plus the number of bytes written 762 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 763 * @syscap SystemCapability.Utils.Lang 764 * @crossplatform 765 * @atomicservice 766 * @since 20 767 */ 768 writeBigInt64BE(value: bigint, offset?: number): number; 769 /** 770 * Writes value to buf at the specified offset as little-endian. 771 * 772 * @param { bigint } value - value value Number to be written to buf 773 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 774 * @returns { number } offset plus the number of bytes written 775 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 776 * @syscap SystemCapability.Utils.Lang 777 * @crossplatform 778 * @atomicservice 779 * @since 20 780 */ 781 writeBigInt64LE(value: bigint, offset?: number): number; 782 /** 783 * Writes value to buf at the specified offset as big-endian. 784 * 785 * @param { bigint } value - value value Number to be written to buf 786 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 787 * @returns { number } offset plus the number of bytes written 788 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 789 * @syscap SystemCapability.Utils.Lang 790 * @crossplatform 791 * @atomicservice 792 * @since 20 793 */ 794 writeBigUInt64BE(value: bigint, offset?: number): number; 795 /** 796 * Writes value to buf at the specified offset as little-endian. 797 * 798 * @param { bigint } value - value value Number to be written to buf 799 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 800 * @returns { number } offset plus the number of bytes written 801 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 802 * @syscap SystemCapability.Utils.Lang 803 * @crossplatform 804 * @atomicservice 805 * @since 20 806 */ 807 writeBigUInt64LE(value: bigint, offset?: number): number; 808 /** 809 * Writes value to buf at the specified offset as big-endian. 810 * 811 * @param { number } value - value value Number to be written to buf 812 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 813 * @returns { number } offset plus the number of bytes written 814 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] 815 * @syscap SystemCapability.Utils.Lang 816 * @crossplatform 817 * @atomicservice 818 * @since 20 819 */ 820 writeDoubleBE(value: number, offset?: number): number; 821 /** 822 * Writes value to buf at the specified offset as little-endian. 823 * 824 * @param { number } value - value value Number to be written to buf 825 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 826 * @returns { number } offset plus the number of bytes written 827 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] 828 * @syscap SystemCapability.Utils.Lang 829 * @crossplatform 830 * @atomicservice 831 * @since 20 832 */ 833 writeDoubleLE(value: number, offset?: number): number; 834 /** 835 * Writes value to buf at the specified offset as big-endian. 836 * 837 * @param { number } value - value value Number to be written to buf 838 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 4 839 * @returns { number } offset plus the number of bytes written 840 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] 841 * @syscap SystemCapability.Utils.Lang 842 * @crossplatform 843 * @atomicservice 844 * @since 20 845 */ 846 writeFloatBE(value: number, offset?: number): number; 847 /** 848 * Writes value to buf at the specified offset as little-endian. 849 * 850 * @param { number } value - value value Number to be written to buf 851 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 4 852 * @returns { number } offset plus the number of bytes written 853 * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] 854 * @syscap SystemCapability.Utils.Lang 855 * @crossplatform 856 * @atomicservice 857 * @since 20 858 */ 859 writeFloatLE(value: number, offset?: number): number; 860 /** 861 * Writes value to buf at the specified offset. value must be a valid signed 8-bit integer. 862 * 863 * @param { number } value - value value Number to be written to buf 864 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 1 865 * @returns { number } offset plus the number of bytes written 866 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 867 * @syscap SystemCapability.Utils.Lang 868 * @crossplatform 869 * @atomicservice 870 * @since 20 871 */ 872 writeInt8(value: number, offset?: number): number; 873 /** 874 * Writes value to buf at the specified offset as big-endian. The value must be a valid signed 16-bit integer 875 * 876 * @param { number } value - value value Number to be written to buf 877 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 2 878 * @returns { number } offset plus the number of bytes written 879 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 880 * @syscap SystemCapability.Utils.Lang 881 * @crossplatform 882 * @atomicservice 883 * @since 20 884 */ 885 writeInt16BE(value: number, offset?: number): number; 886 /** 887 * Writes value to buf at the specified offset as little-endian. The value must be a valid signed 16-bit integer 888 * 889 * @param { number } value - value value Number to be written to buf 890 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 2 891 * @returns { number } offset plus the number of bytes written 892 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 893 * @syscap SystemCapability.Utils.Lang 894 * @crossplatform 895 * @atomicservice 896 * @since 20 897 */ 898 writeInt16LE(value: number, offset?: number): number; 899 /** 900 * Writes value to buf at the specified offset as big-endian. The value must be a valid signed 32-bit integer. 901 * 902 * @param { number } value - value value Number to be written to buf 903 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 4 904 * @returns { number } offset plus the number of bytes written 905 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 906 * @syscap SystemCapability.Utils.Lang 907 * @crossplatform 908 * @atomicservice 909 * @since 20 910 */ 911 writeInt32BE(value: number, offset?: number): number; 912 /** 913 * Writes value to buf at the specified offset as little-endian. The value must be a valid signed 32-bit integer. 914 * 915 * @param { number } value - value value Number to be written to buf 916 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 4 917 * @returns { number } offset plus the number of bytes written 918 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 919 * @syscap SystemCapability.Utils.Lang 920 * @crossplatform 921 * @atomicservice 922 * @since 20 923 */ 924 writeInt32LE(value: number, offset?: number): number; 925 /** 926 * Writes byteLength bytes of value to buf at the specified offset as big-endian 927 * 928 * @param { number } value - value value Number to be written to buf 929 * @param { number } offset - offset offset Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength 930 * @param { number } byteLength - byteLength byteLength Number of bytes to write. Must satisfy 0 < byteLength <= 6 931 * @returns { number } offset plus the number of bytes written 932 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 933 * @syscap SystemCapability.Utils.Lang 934 * @crossplatform 935 * @atomicservice 936 * @since 20 937 */ 938 writeIntBE(value: number, offset: number, byteLength: number): number; 939 /** 940 * Writes byteLength bytes of value to buf at the specified offset as little-endian 941 * 942 * @param { number } value - value value Number to be written to buf 943 * @param { number } offset - offset offset Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength 944 * @param { number } byteLength - byteLength byteLength Number of bytes to write. Must satisfy 0 < byteLength <= 6 945 * @returns { number } offset plus the number of bytes written 946 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 947 * @syscap SystemCapability.Utils.Lang 948 * @crossplatform 949 * @atomicservice 950 * @since 20 951 */ 952 writeIntLE(value: number, offset: number, byteLength: number): number; 953 /** 954 * Writes value to buf at the specified offset. value must be a valid unsigned 8-bit integer 955 * 956 * @param { number } value - value value Number to be written to buf 957 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 1 958 * @returns { number } offset plus the number of bytes written 959 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 960 * @syscap SystemCapability.Utils.Lang 961 * @crossplatform 962 * @atomicservice 963 * @since 20 964 */ 965 writeUInt8(value: number, offset?: number): number; 966 /** 967 * Writes value to buf at the specified offset as big-endian. The value must be a valid unsigned 16-bit integer. 968 * 969 * @param { number } value - value value Number to be written to buf 970 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 2 971 * @returns { number } offset plus the number of bytes written 972 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 973 * @syscap SystemCapability.Utils.Lang 974 * @crossplatform 975 * @atomicservice 976 * @since 20 977 */ 978 writeUInt16BE(value: number, offset?: number): number; 979 /** 980 * Writes value to buf at the specified offset as little-endian. The value must be a valid unsigned 16-bit integer. 981 * 982 * @param { number } value - value value Number to be written to buf 983 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 2 984 * @returns { number } offset plus the number of bytes written 985 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 986 * @syscap SystemCapability.Utils.Lang 987 * @crossplatform 988 * @atomicservice 989 * @since 20 990 */ 991 writeUInt16LE(value: number, offset?: number): number; 992 /** 993 * Writes value to buf at the specified offset as big-endian. The value must be a valid unsigned 32-bit integer. 994 * 995 * @param { number } value - value value Number to be written to buf 996 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 4 997 * @returns { number } offset plus the number of bytes written 998 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 999 * @syscap SystemCapability.Utils.Lang 1000 * @crossplatform 1001 * @atomicservice 1002 * @since 20 1003 */ 1004 writeUInt32BE(value: number, offset?: number): number; 1005 /** 1006 * Writes value to buf at the specified offset as little-endian. The value must be a valid unsigned 32-bit integer. 1007 * 1008 * @param { number } value - value value Number to be written to buf 1009 * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 4 1010 * @returns { number } offset plus the number of bytes written 1011 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 1012 * @syscap SystemCapability.Utils.Lang 1013 * @crossplatform 1014 * @atomicservice 1015 * @since 20 1016 */ 1017 writeUInt32LE(value: number, offset?: number): number; 1018 /** 1019 * Writes byteLength bytes of value to buf at the specified offset as big-endian 1020 * 1021 * @param { number } value - value value Number to be written to buf 1022 * @param { number } offset - offset offset Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength 1023 * @param { number } byteLength - byteLength byteLength Number of bytes to write. Must satisfy 0 < byteLength <= 6 1024 * @returns { number } offset plus the number of bytes written 1025 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 1026 * @syscap SystemCapability.Utils.Lang 1027 * @crossplatform 1028 * @atomicservice 1029 * @since 20 1030 */ 1031 writeUIntBE(value: number, offset: number, byteLength: number): number; 1032 /** 1033 * Writes byteLength bytes of value to buf at the specified offset as little-endian 1034 * 1035 * @param { number } value - value value Number to be written to buf 1036 * @param { number } offset - offset offset Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength 1037 * @param { number } byteLength - byteLength byteLength Number of bytes to write. Must satisfy 0 < byteLength <= 6 1038 * @returns { number } offset plus the number of bytes written 1039 * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] 1040 * @syscap SystemCapability.Utils.Lang 1041 * @crossplatform 1042 * @atomicservice 1043 * @since 20 1044 */ 1045 writeUIntLE(value: number, offset: number, byteLength: number): number; 1046 } 1047} 1048export default fastbuffer; 1049