Returns a Deep clone of the current CborReader.
A new CborReader instance cloned from the current one.
Retrieves the last error message recorded by the CBOR writer.
This method provides a human-readable description of the last error encountered during CBOR encoding operations. If no error has occurred, it returns an empty string.
A string describing the last error message, or empty if no message is available.
The reference count retrieved by this method reflects the number of references maintained internally by libcardano-c for this native instance of the CBOR writer object. This is unrelated to the reference counting mechanism in JavaScript, which is managed by the JavaScript engine's garbage collector.
This method is primarily intended for diagnostic purposes.
The current reference count of the CBOR writer in the WASM context.
Retrieves the current state of the CBOR reader without consuming any data.
This method allows you to inspect the next data item's type or structure in the CBOR stream without advancing the reader's position. It is useful for determining the type of the next value to decide how to process it.
The current state of the reader, represented as a CborReaderState enum value.
Peeks the next CBOR tag (major type 6) without advancing the reader's position.
This method examines the next CBOR-encoded tag (semantic tag) in the stream without consuming it. CBOR tags provide semantic context to the data that follows, such as indicating a timestamp or a URI. Use this method to inspect the next tag before deciding how to process it.
The CBOR tag at the current position, as an enum value.
Reads a big integer (BigInt) from the CBOR stream.
This method decodes and retrieves the next CBOR data item as a big integer. CBOR bignums are used to represent integers too large to fit into standard 64-bit representations.
The decoded big integer from the CBOR stream.
Reads a CBOR boolean value (true or false).
This method decodes and reads a CBOR-encoded boolean value (major type 7, simple values 20 and 21)
from the current position in the reader. It supports CBOR representations for true and false.
The decoded boolean value (true or false).
Reads a double-precision floating-point number from the CBOR stream.
This method decodes and retrieves the next CBOR data item as a double-precision floating-point number (IEEE 754 format). It is suitable for processing CBOR items encoded as floating-point numbers.
The decoded double-precision floating-point number.
Reads and returns the next CBOR data item in its encoded byte form.
This method retrieves the raw encoded bytes of the next CBOR data item, preserving its exact representation in the stream. This is useful for scenarios where the encoded value needs to be stored, inspected, or reprocessed.
A Uint8Array containing the encoded bytes of the next CBOR data item.
Reads a signed integer from the CBOR stream.
This method decodes and retrieves the next CBOR data item as a signed 64-bit integer. It ensures that the integer is correctly interpreted based on its signed representation.
The signed integer read from the CBOR stream as a BigInt.
Reads a CBOR simple value (major type 7) from the CBOR stream.
CBOR simple values include false, true, null, undefined, and other custom simple values
represented as major type 7.
The decoded simple value as a CborSimpleValue enum.
Reads the start of a CBOR array (major type 4).
This method reads the initial marker of a CBOR array and returns its length. For definite-length arrays,
the length represents the number of items in the array. For indefinite-length arrays, the length will
return -1, and the array will end with a special "break" marker.
The number of items in the array for definite-length arrays, or -1 for indefinite-length arrays.
Reads the beginning of a CBOR map (major type 5).
This method reads the CBOR stream and retrieves the number of key-value pairs in the map.
If the map has an indefinite length, the returned size will be -1. After calling this method,
the CBOR reader state transitions to process the key-value pairs within the map.
The number of key-value pairs in the map or -1 for indefinite-length maps.
Reads a CBOR tag (major type 6).
This method decodes a CBOR-encoded tag (semantic tag) from the current position
in the reader and returns it as a CborTag value. CBOR tags provide semantic
context to the data that follows them, such as indicating a timestamp or a URI.
The decoded CBOR tag as an enum value.
Reads an unsigned integer from the CBOR stream.
This method decodes and retrieves the next CBOR data item as an unsigned 64-bit integer. It ensures that the integer is correctly interpreted based on its unsigned representation.
The unsigned integer read from the CBOR stream as a BigInt.
Skips the current CBOR value in the stream.
This function moves the reader past the current CBOR data item without decoding it. It is particularly useful when you want to ignore a value in the CBOR stream, for example, when the value is not relevant to your application logic.
StaticfromCreates a new CborReader from a binary CBOR-encoded data.
The CBOR-encoded binary data to be read.
A new instance of the CborReader class.
StaticfromCreates a new CborReader from a CBOR-encoded hexadecimal string.
The CBOR-encoded data in hexadecimal string format.
A new instance of the CborReader class.
A class for reading CBOR (Concise Binary Object Representation) data.
The
CborReaderclass provides methods for decoding and extracting various data types from a CBOR-encoded binary stream. It supports handling integers, strings, arrays, maps, and other CBOR data structures.