serializer.datastream - Palamecia/mint GitHub Wiki

Module

load serializer.datastream

This module provides the Serializer.DataStream class which allow to manipulate raw data.

Packages

Classes

Serializer.DataStream

This class provides an interface for reading and writing raw data. It is mean to be used by any code that perform low level operations.

Members

Modifiers Member Description
+ const << Writes the content of data to the stream, then returns a reference to the s...
+ const >> Reads some data from the stream and stores it in data, then returns a refer...
+ const containsBoolean Returns true if the stream contains at least one boolean; otherwise returns...
+ const containsInt16 Returns true if the stream contains at least count int16; otherwise retur...
+ const containsInt32 Returns true if the stream contains at least count int32; otherwise retur...
+ const containsInt64 Returns true if the stream contains at least count int64; otherwise retur...
+ const containsInt8 Returns true if the stream contains at least count int8; otherwise return...
+ const containsNumber Returns true if the stream contains at least count numbers; otherwise ret...
+ const containsString Returns true if the stream contains at least one string; otherwise returns ...
+ const containsUInt16 Returns true if the stream contains at least count uint16; otherwise retu...
+ const containsUInt32 Returns true if the stream contains at least count uint32; otherwise retu...
+ const containsUInt64 Returns true if the stream contains at least count uint64; otherwise retu...
+ const containsUInt8 Returns true if the stream contains at least count uint8; otherwise retur...
- final d_ptr Object data
+ @ const fromBase64 Creates a new stream containing the data of data decoded from Base64. Retur...
+ @ const fromBase64Url Creates a new stream containing the data of data decoded from Base64Url. Re...
+ @ const fromUtf8Bytes Creates a new stream containing the count first bytes from the bytes stri...
- @ g_lib Global library handle
+ const getBoolean Returns the next instance of boolean in the stream. If the stream does not co...
+ const getInt16 Returns the next instance of int16 in the stream. If the stream does not cont...
+ const getInt32 Returns the next instance of int32 in the stream. If the stream does not cont...
+ const getInt64 Returns the next instance of int64 in the stream. If the stream does not cont...
+ const getInt8 Returns the next instance of int8 in the stream. If the stream does not conta...
+ const getNumber Returns the next instance of number in the stream. If the stream does not con...
+ const getString Returns the next instance of string in the stream. If the stream does not con...
+ const getUInt16 Returns the next instance of uint16 in the stream. If the stream does not con...
+ const getUInt32 Returns the next instance of uint32 in the stream. If the stream does not con...
+ const getUInt64 Returns the next instance of uint64 in the stream. If the stream does not con...
+ const getUInt8 Returns the next instance of uint8 in the stream. If the stream does not cont...
+ const isEmpty Returns true if the stream has no more data to read; otherwise returns fa...
+ const new Creates a new empty stream.
+ const readBoolean Returns the next instance of boolean in the stream and move the read cursor t...
+ const readInt16 Returns the next instance of int16 in the stream and move the read cursor to ...
+ const readInt32 Returns the next instance of int32 in the stream and move the read cursor to ...
+ const readInt64 Returns the next instance of int64 in the stream and move the read cursor to ...
+ const readInt8 Returns the next instance of int8 in the stream and move the read cursor to t...
+ const readNumber Returns the next instance of number in the stream and move the read cursor to...
+ const readString Returns the next instance of string in the stream and move the read cursor to...
+ const readUInt16 Returns the next instance of uint16 in the stream and move the read cursor to...
+ const readUInt32 Returns the next instance of uint32 in the stream and move the read cursor to...
+ const readUInt64 Returns the next instance of uint64 in the stream and move the read cursor to...
+ const readUInt8 Returns the next instance of uint8 in the stream and move the read cursor to ...
+ const remove Moves the read cursor count bytes forward. The data before this position ca...
+ const size Returns the amount of remaining bytes after the read cursor.
+ const toBase64 Returns a string containing the Base64 representation of the following bytes ...
+ const toBase64Url Returns a string containing the Base64Url representation of the following byt...
+ const to_std_vector_uint8_t Returns the pointer to the internal std::vector<uint8_t> instance.
+ const write Writes the content of data to the stream. The data can be an instance of in...

Descriptions

Serializer.DataStream.<<

def (self, data)

Writes the content of data to the stream, then returns a reference to the stream. The data can be an instance of int8, int16, int32, int64, uint8, uint16, uint32, uint64, number, boolean, string or none; otherwise the data is cast to string to get inserted in the stream.

Serializer.DataStream.>>

def (self, data)

Reads some data from the stream and stores it in data, then returns a reference to the stream. The amount of data that is read depend on the type of data. If the type is int8, int16, int32, int64, uint8, uint16, uint32, uint64, number, boolean or string, the corresponding read function is used; otherwise the stream is passed to the constructor of the type to get the data to store in data.

Serializer.DataStream.containsBoolean

def (const self)

Returns true if the stream contains at least one boolean; otherwise returns false.

Serializer.DataStream.containsInt16

def (const self, count = 1)

Returns true if the stream contains at least count int16; otherwise returns false.

Serializer.DataStream.containsInt32

def (const self, count = 1)

Returns true if the stream contains at least count int32; otherwise returns false.

Serializer.DataStream.containsInt64

def (const self, count = 1)

Returns true if the stream contains at least count int64; otherwise returns false.

Serializer.DataStream.containsInt8

def (const self, count = 1)

Returns true if the stream contains at least count int8; otherwise returns false.

Serializer.DataStream.containsNumber

def (const self, count = 1)

Returns true if the stream contains at least count numbers; otherwise returns false.

Serializer.DataStream.containsString

def (const self)

Returns true if the stream contains at least one string; otherwise returns false. A string is detected if the stream contains a byte with the value 0.

Serializer.DataStream.containsUInt16

def (const self, count = 1)

Returns true if the stream contains at least count uint16; otherwise returns false.

Serializer.DataStream.containsUInt32

def (const self, count = 1)

Returns true if the stream contains at least count uint32; otherwise returns false.

Serializer.DataStream.containsUInt64

def (const self, count = 1)

Returns true if the stream contains at least count uint64; otherwise returns false.

Serializer.DataStream.containsUInt8

def (const self, count = 1)

Returns true if the stream contains at least count uint8; otherwise returns false.

Serializer.DataStream.d_ptr

null

Object data

Serializer.DataStream.fromBase64

def (data)

Creates a new stream containing the data of data decoded from Base64. Returns none if data is not a valid Base64 string.

Serializer.DataStream.fromBase64Url

def (data)

Creates a new stream containing the data of data decoded from Base64Url. Returns none if data is not a valid Base64Url string.

Serializer.DataStream.fromUtf8Bytes

def (bytes, count)

Creates a new stream containing the count first bytes from the bytes string.

Serializer.DataStream.g_lib

lib ('libmint-serializer')

Global library handle

Serializer.DataStream.getBoolean

def (const self)

Returns the next instance of boolean in the stream. If the stream does not contains enough data, none is returned instead. The read cursor is not modified.

Serializer.DataStream.getInt16

def (const self)

Returns the next instance of int16 in the stream. If the stream does not contains enough data, none is returned instead. The read cursor is not modified.

def (const self, count)

Returns an array containing the next count instances of int16 in the stream. If the stream does not contains enough data, none is returned instead. The read cursor is not modified.

Serializer.DataStream.getInt32

def (const self)

Returns the next instance of int32 in the stream. If the stream does not contains enough data, none is returned instead. The read cursor is not modified.

def (const self, count)

Returns an array containing the next count instances of int32 in the stream. If the stream does not contains enough data, none is returned instead. The read cursor is not modified.

Serializer.DataStream.getInt64

def (const self)

Returns the next instance of int64 in the stream. If the stream does not contains enough data, none is returned instead. The read cursor is not modified.

def (const self, count)

Returns an array containing the next count instances of int64 in the stream. If the stream does not contains enough data, none is returned instead. The read cursor is not modified.

Serializer.DataStream.getInt8

def (const self)

Returns the next instance of int8 in the stream. If the stream does not contains enough data, none is returned instead. The read cursor is not modified.

def (const self, count)

Returns an array containing the next count instances of int8 in the stream. If the stream does not contains enough data, none is returned instead. The read cursor is not modified.

Serializer.DataStream.getNumber

def (const self)

Returns the next instance of number in the stream. If the stream does not contains enough data, none is returned instead. The read cursor is not modified.

Serializer.DataStream.getString

def (const self)

Returns the next instance of string in the stream. If the stream does not contains enough data, none is returned instead. The read cursor is not modified.

def (const self, from, length = none)

Returns a string constructed with the data starting from the from byte after the read cursor. If length is provided, it is used as a number of byte to use; otherwise the data is used until the end of the stream. The constructed string ends at the first byte of value 0 found or where no more data is available. The read cursor is not modified.

Serializer.DataStream.getUInt16

def (const self)

Returns the next instance of uint16 in the stream. If the stream does not contains enough data, none is returned instead. The read cursor is not modified.

def (const self, count)

Returns an array containing the next count instances of uint16 in the stream. If the stream does not contains enough data, none is returned instead. The read cursor is not modified.

Serializer.DataStream.getUInt32

def (const self)

Returns the next instance of uint32 in the stream. If the stream does not contains enough data, none is returned instead. The read cursor is not modified.

def (const self, count)

Returns an array containing the next count instances of uint32 in the stream. If the stream does not contains enough data, none is returned instead. The read cursor is not modified.

Serializer.DataStream.getUInt64

def (const self)

Returns the next instance of uint64 in the stream. If the stream does not contains enough data, none is returned instead. The read cursor is not modified.

def (const self, count)

Returns an array containing the next count instances of uint64 in the stream. If the stream does not contains enough data, none is returned instead. The read cursor is not modified.

Serializer.DataStream.getUInt8

def (const self)

Returns the next instance of uint8 in the stream. If the stream does not contains enough data, none is returned instead. The read cursor is not modified.

def (const self, count)

Returns an array containing the next count instances of uint8 in the stream. If the stream does not contains enough data, none is returned instead. The read cursor is not modified.

Serializer.DataStream.isEmpty

def (const self)

Returns true if the stream has no more data to read; otherwise returns false.

Serializer.DataStream.new

def (self)

Creates a new empty stream.

def (self, other)

Creates a new stream containing the data of other.

If other is an instance of Serializer.DataStream, this instance is returned.

If other provides a toDataStream method, this method is used to create the returned value; otherwise other is sent to the write method to insert data in the stream.

Serializer.DataStream.readBoolean

def (self)

Returns the next instance of boolean in the stream and move the read cursor to the next byte right after the data. If the stream does not contains enough data, none is returned instead and the read cursor is not modified.

Serializer.DataStream.readInt16

def (self)

Returns the next instance of int16 in the stream and move the read cursor to the next byte right after the data. If the stream does not contains enough data, none is returned instead and the read cursor is not modified.

Serializer.DataStream.readInt32

def (self)

Returns the next instance of int32 in the stream and move the read cursor to the next byte right after the data. If the stream does not contains enough data, none is returned instead and the read cursor is not modified.

Serializer.DataStream.readInt64

def (self)

Returns the next instance of int64 in the stream and move the read cursor to the next byte right after the data. If the stream does not contains enough data, none is returned instead and the read cursor is not modified.

Serializer.DataStream.readInt8

def (self)

Returns the next instance of int8 in the stream and move the read cursor to the next byte right after the data. If the stream does not contains enough data, none is returned instead and the read cursor is not modified.

Serializer.DataStream.readNumber

def (self)

Returns the next instance of number in the stream and move the read cursor to the next byte right after the data. If the stream does not contains enough data, none is returned instead and the read cursor is not modified.

Serializer.DataStream.readString

def (self)

Returns the next instance of string in the stream and move the read cursor to the next byte right after the data. If the stream does not contains enough data, none is returned instead and the read cursor is not modified.

Serializer.DataStream.readUInt16

def (self)

Returns the next instance of uint16 in the stream and move the read cursor to the next byte right after the data. If the stream does not contains enough data, none is returned instead and the read cursor is not modified.

Serializer.DataStream.readUInt32

def (self)

Returns the next instance of uint32 in the stream and move the read cursor to the next byte right after the data. If the stream does not contains enough data, none is returned instead and the read cursor is not modified.

Serializer.DataStream.readUInt64

def (self)

Returns the next instance of uint64 in the stream and move the read cursor to the next byte right after the data. If the stream does not contains enough data, none is returned instead and the read cursor is not modified.

Serializer.DataStream.readUInt8

def (self)

Returns the next instance of uint8 in the stream and move the read cursor to the next byte right after the data. If the stream does not contains enough data, none is returned instead and the read cursor is not modified.

Serializer.DataStream.remove

def (self, count)

Moves the read cursor count bytes forward. The data before this position can not be reached anymore.

Serializer.DataStream.size

def (const self)

Returns the amount of remaining bytes after the read cursor.

Serializer.DataStream.toBase64

def (const self)

Returns a string containing the Base64 representation of the following bytes in the stream.

Serializer.DataStream.toBase64Url

def (const self)

Returns a string containing the Base64Url representation of the following bytes in the stream.

Serializer.DataStream.to_std_vector_uint8_t

def (const self)

Returns the pointer to the internal std::vector<uint8_t> instance.

Serializer.DataStream.write

def (self, data)

Writes the content of data to the stream. The data can be an instance of int8, int16, int32, int64, uint8, uint16, uint32, uint64, number, boolean, string or none; otherwise the data is cast to string to get inserted in the stream.

⚠️ **GitHub.com Fallback** ⚠️