ByteDataReader

class ByteDataReader(val byteArray: ByteArray)

This class provides methods for reading various data types from a byte array ByteArray.

It maintains an internal cursor that indicates the current reading position within the byte array. The peek...() methods allow reading data without moving the cursor, while the get...() methods read and advance the cursor.

Parameters

byteArray

The byte array to read from.

Constructors

Link copied to clipboard
constructor(byteString: ByteString)

Creates a ByteDataReader with a given ByteString.

constructor(byteArray: ByteArray)

Creates a ByteDataReader with a given byte array.

Properties

Link copied to clipboard

Functions

Link copied to clipboard

Checks if the end of the byte array has been reached.

Link copied to clipboard
fun getByteString(numBytes: Int): ByteString

Reads a ByteString from the byte array and advances the cursor.

Link copied to clipboard

Reads an Int16 value from the byte array and advances the cursor.

Link copied to clipboard

Reads an Int16 value in little-endian order from the byte array and advances the cursor.

Link copied to clipboard
fun getInt32(): Int

Reads an Int32 value from the byte array and advances the cursor.

Link copied to clipboard

Reads an Int32 value in little-endian order from the byte array and advances the cursor.

Link copied to clipboard
fun getInt64(): Long

Reads an Int64 value from the byte array and advances the cursor.

Link copied to clipboard

Reads an Int64 value in little-endian order from the byte array and advances the cursor.

Link copied to clipboard
fun getInt8(): Byte

Reads an Int8 value from the byte array and advances the cursor.

Link copied to clipboard
fun getString(numBytes: Int): String

Reads a String from the byte array and advances the cursor.

Link copied to clipboard

Reads a UInt16 value from the byte array and advances the cursor.

Link copied to clipboard

Reads a UInt16 value in little-endian order from the byte array and advances the cursor.

Link copied to clipboard

Reads a UInt32 value from the byte array and advances the cursor.

Link copied to clipboard

Reads a UInt32 value in little-endian order from the byte array and advances the cursor.

Link copied to clipboard

Reads a UInt64 value from the byte array and advances the cursor.

Link copied to clipboard

Reads a UInt64 value in little-endian order from the byte array and advances the cursor.

Link copied to clipboard

Reads a UInt8 value from the byte array and advances the cursor.

Link copied to clipboard

Gets the number of bytes remaining to be read from the current cursor position.

Link copied to clipboard
fun peekByteString(numBytes: Int): ByteString

Reads a ByteString from the byte array without advancing the cursor.

Link copied to clipboard

Reads an Int16 value from the byte array without advancing the cursor.

Link copied to clipboard

Reads an Int16 value in little-endian order from the byte array without advancing the cursor.

Link copied to clipboard
fun peekInt32(): Int

Reads an Int32 value from the byte array without advancing the cursor.

Link copied to clipboard

Reads an Int32 value in little-endian order from the byte array without advancing the cursor.

Link copied to clipboard

Reads an Int64 value from the byte array without advancing the cursor.

Link copied to clipboard

Reads an Int64 value in little-endian order from the byte array without advancing the cursor.

Link copied to clipboard
fun peekInt8(): Byte

Reads an Int8 value from the byte array without advancing the cursor.

Link copied to clipboard
fun peekString(numBytes: Int): String

Reads a String from the byte array without advancing the cursor.

Link copied to clipboard

Reads a UInt16 value from the byte array without advancing the cursor.

Link copied to clipboard

Reads a UInt16 value in little-endian order from the byte array without advancing the cursor.

Link copied to clipboard

Reads a UInt32 value from the byte array without advancing the cursor.

Link copied to clipboard

Reads a UInt32 value in little-endian order from the byte array without advancing the cursor.

Link copied to clipboard

Reads a UInt64 value from the byte array without advancing the cursor.

Link copied to clipboard

Reads a UInt64 value in little-endian order from the byte array without advancing the cursor.

Link copied to clipboard

Reads a UInt8 value from the byte array without advancing the cursor.

Link copied to clipboard
fun skip(numBytes: Int): ByteDataReader

Skips a specified number of bytes in the byte array.