io/bytes
Documentation
- source: io/bytes.ts
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.
tsstatic toJavaBytes(bytes: any): void;
Parameter Type Description 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.
tsstatic toJavaScriptBytes(internalBytes: any): void;
Parameter Type Description 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.
tsstatic textToByteArray(text: string): void;
Parameter Type Description 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.
tsstatic byteArrayToText(data: any): string;
Parameter Type Description 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.
tsstatic intToByteArray(value: number, byteOrder: any): void;
Parameter Type Description 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.
tsstatic byteArrayToInt(data: any, byteOrder: any): number;
Parameter Type Description dataanyThe 4-byte array (JavaScript array of numbers). byteOrderanySpecifies the byte ordering used during conversion. Returns
- Type:
number- Description: The reconstructed integer value.
