Data
An extension for Data
that provides helper methods for converting between Data
and privmx.endpoint.core.Buffer
as well as C++ std.string
.
Methods
asBuffer()
Converts the contents of this Data
instance into a privmx.endpoint.core.Buffer
.
This helper function creates a Buffer
instance from the bytes of the Data
object.
Returns
privmx.endpoint.core.Buffer
·
A privmx.endpoint.core.Buffer
instance representing the data.
init(from:)
Initializes a Data
object from the bytes of a privmx.endpoint.core.Buffer
.
This initializer converts the contents of the provided Buffer
into a Data
instance.
Params
buffer
privmx.endpoint.core.Buffer
The privmx.endpoint.core.Buffer
to convert to Data
.
rawCppString()
Converts the underlying Data
to a C++ std.string
.
This helper function creates a std.string
representation of the Data
object by interpreting the data as a C string.
Returns
std.string
·
A std.string
representation of the Data
contents.
init(from:)
Initializes a Data
object from a C++ std.string
.
This initializer creates a Data
instance by converting the provided C++ std.string
into a UTF-8 encoded Data
object.
Params
str
std.string
The C++ std.string
to convert to Data
.
Returns
`` ·
A Data
representation of the given std.string
.
We use cookies on our website. We use them to ensure the proper functioning of the site and, if you agree, for purposes we set, such as analytics or marketing.