Skip to content

io/bytes

Documentation

Overview

Classes

Bytes

toJavaBytes()

Converts a native JavaScript byte array (an array of numbers) to a Java byte array. This is used internally by the API layer to pass data to Java methods.

ts
static toJavaBytes(bytes: any): void;
ParameterTypeDescription
bytesanyThe JavaScript array of bytes (e.g., [104, 101, 108, 108, 111]).

Returns

  • Type: void
  • Description: A native Java byte array (internal representation).

toJavaScriptBytes()

Converts a native Java byte array back to a JavaScript array of numbers. This is used internally by the API layer to retrieve data from Java methods.

ts
static toJavaScriptBytes(internalBytes: any): void;
ParameterTypeDescription
internalBytesanyThe native Java byte array.

Returns

  • Type: void
  • Description: A JavaScript array containing the byte values (numbers).

textToByteArray()

Converts a standard text string into a byte array using the default platform encoding.

ts
static textToByteArray(text: string): void;
ParameterTypeDescription
textstringThe input text string.

Returns

  • Type: void
  • Description: A JavaScript array representing the bytes of the text.

byteArrayToText()

Converts a byte array back into a text string.

ts
static byteArrayToText(data: any): string;
ParameterTypeDescription
dataanyThe JavaScript array of bytes.

Returns

  • Type: string
  • Description: The reconstructed text string.

intToByteArray()

Converts a 32-bit integer value into a byte array, respecting the specified byte order.

ts
static intToByteArray(value: number, byteOrder: any): void;
ParameterTypeDescription
valuenumberThe integer value to convert.
byteOrderanySpecifies the byte ordering: "BIG_ENDIAN" (most significant byte first) or "LITTLE_ENDIAN" (least significant byte first).

Returns

  • Type: void
  • Description: A JavaScript array representing the 4-byte integer.

byteArrayToInt()

Converts a 4-byte array back into a 32-bit integer value, respecting the specified byte order.

ts
static byteArrayToInt(data: any, byteOrder: any): number;
ParameterTypeDescription
dataanyThe 4-byte array (JavaScript array of numbers).
byteOrderanySpecifies the byte ordering used during conversion.

Returns

  • Type: number
  • Description: The reconstructed integer value.