cbor library

Classes

Cbor
The CBOR package main API.
DartItem
The CBOR Dart item class. Objects of this class are produced by by the decode process.
Decoder
The decoder class implements the CBOR decoder functionality as defined in RFC7049. Output from the decoding process is through the Listener class interface.
DecodeStack
The stack of dart items assembled from the listener stack
Encoder
The encoder class implements the CBOR encoder functionality as defined in RFC7049. This class is intended for single CBOR entity encoding, indefinite sequences and simple lists and maps
Input
The Input class provides data access primitives to the underlying UTF-8 data buffer supplied.
ItemStack
The decoded Dart item stack class.
ListBuilder
List builder class.
Listener
Listener base class, all listener implementations must at least implement these methods to interface to the decoder. The methods are not documented at the API level, usage should be obvious from the naming.
ListenerDebug
A simple debug listener.
ListenerStack
The stack based listener class, produces a stack of DartItems from the decoder output.
MapBuilder
Map builder class.
Output
A base class for encoder output. Derived classes must implement these methods as a minimum to provide full CBOR encoding.
OutputStandard
The standard output class.
Stack<T>
Base stack class

Enums

dartTypes
The Dart types an item can have.
dataHints
If the type is dtBuffer or dtString a hint at what the data may contain.
DecoderState
Decoder states
encodeFloatAs
Float encoding directives
whatsNext
What we are waiting for next, if anything.

Constants

ai20 → const int
Additional information constants
ai21 → const int
ai22 → const int
ai23 → const int
ai24 → const int
ai25 → const int
ai26 → const int
ai27 → const int
aiBreak → const int
eightByte → const int
fourByte → const int
halfLimitLower → const double
halfLimitUpper → const double
indefArray → const String
indefBytes → const String
indefiniteMaxSize → const int
Indefinite array/map size limit. Indefinite arrays and maps are just normal arrays and maps with an initially unknown size, we can't model this so just set the initial size to this arbitrarily high number.
indefMap → const String
indefStop → const String
Indefinite stack types and stop marker.
indefString → const String
majorTypeArray → const int
majorTypeBytes → const int
majorTypeMap → const int
majorTypeNint → const int
majorTypeNotSet → const int
majorTypePint → const int
Major type constants
majorTypeShift → const int
Constants for use across the CBOR package. CBOR decoding constants
majorTypeSpecial → const int
majorTypeString → const int
majorTypeTag → const int
minorTypeMask → const int
oneByte → const int
Length constants
simpleLimitLower → const int
simpleLimitUpper → const int
singleLimitLower → const double
singleLimitUpper → const double
tagBase64 → const int
tagBase64Url → const int
tagBigFloat → const int
tagDateTimeEpoch → const int
tagDateTimeStandard → const int
Tag constants
tagDecimalFraction → const int
tagEncodedCborDataItem → const int
tagExpectedBase16 → const int
tagExpectedBase64 → const int
tagExpectedBase64Url → const int
tagMimeMessage → const int
tagNegativeBignum → const int
tagPositiveBignum → const int
tagRegularExpression → const int
tagSelfDescribedCbor → const int
tagUri → const int
twoByte → const int

Properties

baseTable → Uint16Buffer
Half precision mapping tables
final
shiftTable List<int>
final
two16 int
final
two32 int
final
two8 int
Numerical constants
final

Functions

bignumToBigInt(Uint8Buffer buff, String sign) BigInt?
Bignum functions Bignum byte buffer to BigInt. Returns null if the conversion fails.
canBeAHalf(double value) bool
Check if a double can be represented as half precision. Returns true if it can be.
canBeASingle(double value) bool
Check if a double can be represented as single precision. Returns true if it can.
getHalfPrecisionDouble(int val) double
Numeric handling support functions. Float handling support functions. Gets a half precision float from its int value.
getHalfPrecisionInt(double val) int
Gets a half precision integer value from a float.
hexToBytes(String? input) ByteBuffer?
Convert a hex string to a ByteBuffer of bytes.
init() → void
isInRange(int value, int lowerBound, int upperBound) bool
Checks if an integer value is within a specified bounded range Returns true if the range check succeeds.

Typedefs

BuilderHook = void Function(bool, dynamic)
Builder hook function type. The bool parameter is set to true if the encoded entity can be used as a map key.

Exceptions / Errors

CborException
Exceptions