Diffusion .NET Client Library  6.1.5
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
PushTechnology.ClientInterface.IO.CBOR.CBORReader Class Reference

The CBOR reader that is able to read CBOR-encoded data from a stream. More...

Public Member Functions

 CBORReader (Stream inputStream)
 Creates a new CBORReader that is able to read CBOR-encoded data from a given input stream. More...
 
long GetTag ()
 Returns the tag value that is associated with the current CBORType. More...
 
long GetInteger ()
 Returns the current CBORType value as a 64-bit signed integer. More...
 
double GetFloatingPoint ()
 Returns the current CBORType value as a 64-bit floating point. More...
 
bool GetBoolean ()
 Returns the current CBORType value as a boolean. More...
 
string GetString ()
 Returns the current CBORType value as a UTF-8 encoded string. More...
 
byte[] GetBytes ()
 Returns the current CBORType value as a sequence of bytes. More...
 
CBORType ReadNext ()
 Reads the next CBORType from the input stream. More...
 

Static Public Member Functions

static void Read (CBORReader reader, ICBORReaderCallback callback)
 Reads from a CBOR-encoded stream in a visitor-style fashion. More...
 

Public Attributes

int SequenceLength => sequenceLength
 Returns the length of the current stream sequence. More...
 
string Fieldname => fieldname
 Returns the fieldname asssociated with the current CBORType. More...
 
CBORType CurrentType => currentType
 Returns the current CBORType. More...
 
bool InObject => context.IsObject
 Returns true if the reader is currently within an object structure. Otherwise false. More...
 
bool InArray => context.IsArray
 Returns true if the reader is currently within an array structure. Otherwise false. More...
 
int StructureDepth => context.Depth
 Returns the depth level of the current structure. A depth of 0 indicates the 'root' level. More...
 
bool IsEndOfStream => reader.IsEndOfStream
 Returns true if the reader has reached the end of the stream. Otherwise false. More...
 
Stream BaseStream => reader.BaseStream
 Returns the underlying stream. More...
 

Detailed Description

The CBOR reader that is able to read CBOR-encoded data from a stream.

Constructor & Destructor Documentation

PushTechnology.ClientInterface.IO.CBOR.CBORReader.CBORReader ( Stream  inputStream)

Creates a new CBORReader that is able to read CBOR-encoded data from a given input stream.

The reader does not take ownership of the given inputStream . The stream needs to be disposed of if it is no longer needed.

Parameters
inputStreamThe input stream to read CBOR-encoded data from.
Exceptions
ArgumentNullExceptionThe given stream is null.
ArgumentExceptionThe given stream does not support reading.

Member Function Documentation

bool PushTechnology.ClientInterface.IO.CBOR.CBORReader.GetBoolean ( )

Returns the current CBORType value as a boolean.

Returns
The current CBORType value as a boolean.
Exceptions
CBORExceptionThe value is not a valid boolean type.
byte [] PushTechnology.ClientInterface.IO.CBOR.CBORReader.GetBytes ( )

Returns the current CBORType value as a sequence of bytes.

This will return the internal byte array instead of a copy.

Returns
The current CBORType value as a sequence of bytes.
Exceptions
CBORExceptionThe value is not a valid sequence type.
double PushTechnology.ClientInterface.IO.CBOR.CBORReader.GetFloatingPoint ( )

Returns the current CBORType value as a 64-bit floating point.

Returns
The current CBORType value as a 64-bit floating point.
Exceptions
CBORExceptionThe value is not a valid floating point type.
long PushTechnology.ClientInterface.IO.CBOR.CBORReader.GetInteger ( )

Returns the current CBORType value as a 64-bit signed integer.

Returns
The current CBORType value as a 64-bit signed integer.
Exceptions
CBORExceptionThe value is not a valid integer type.
string PushTechnology.ClientInterface.IO.CBOR.CBORReader.GetString ( )

Returns the current CBORType value as a UTF-8 encoded string.

Returns
The current CBORType value as a UTF-8 encoded string.
Exceptions
CBORExceptionThe value is not a valid sequence type.
long PushTechnology.ClientInterface.IO.CBOR.CBORReader.GetTag ( )

Returns the tag value that is associated with the current CBORType.

Returns
The tag as a positive 64-bit signed integer value. -1 if the current CBORType has not been preceded by a tag.
static void PushTechnology.ClientInterface.IO.CBOR.CBORReader.Read ( CBORReader  reader,
ICBORReaderCallback  callback 
)
static

Reads from a CBOR-encoded stream in a visitor-style fashion.

Parameters
readerThe reader instance to use for reading operations.
callbackThe callback instance to report the results to.
Exceptions
ArgumentNullExceptionThe given reader or callback are null.
CBORType PushTechnology.ClientInterface.IO.CBOR.CBORReader.ReadNext ( )

Reads the next CBORType from the input stream.

Returns
The next CBORType or null if the reader has reached the end of the stream.
Exceptions
CBORExceptionThe given data stream is not encoded in valid CBOR.

Member Data Documentation

Stream PushTechnology.ClientInterface.IO.CBOR.CBORReader.BaseStream => reader.BaseStream

Returns the underlying stream.

CBORType PushTechnology.ClientInterface.IO.CBOR.CBORReader.CurrentType => currentType

Returns the current CBORType.

string PushTechnology.ClientInterface.IO.CBOR.CBORReader.Fieldname => fieldname

Returns the fieldname asssociated with the current CBORType.

bool PushTechnology.ClientInterface.IO.CBOR.CBORReader.InArray => context.IsArray

Returns true if the reader is currently within an array structure. Otherwise false.

bool PushTechnology.ClientInterface.IO.CBOR.CBORReader.InObject => context.IsObject

Returns true if the reader is currently within an object structure. Otherwise false.

bool PushTechnology.ClientInterface.IO.CBOR.CBORReader.IsEndOfStream => reader.IsEndOfStream

Returns true if the reader has reached the end of the stream. Otherwise false.

int PushTechnology.ClientInterface.IO.CBOR.CBORReader.SequenceLength => sequenceLength

Returns the length of the current stream sequence.

int PushTechnology.ClientInterface.IO.CBOR.CBORReader.StructureDepth => context.Depth

Returns the depth level of the current structure. A depth of 0 indicates the 'root' level.


The documentation for this class was generated from the following file: