Data
An extension for Data that provides helper methods for converting between Data
and privmx.endpoint.core.Buffer as well as C++ std.string.
Static Methods
from(hex:)
Decodes a string in Hex.
Params
hex
String
string to decode
Returns
privmx.endpoint.core.Buffer ·
decoded Data
from(hex:)
Decodes a string in Hex.
Params
hex
std.string
string to decode
Returns
privmx.endpoint.core.Buffer ·
decoded Data
from(base32:)
Decodes a string in Base32.
Params
base32
String
string to decode
Returns
privmx.endpoint.core.Buffer ·
decoded Data
from(base32:)
Decodes a string in Base32.
Params
base32
std.string
string to decode
Returns
privmx.endpoint.core.Buffer ·
decoded Data
from(base64:)
Decodes a string in Base64.
Params
base64
String
string to decode
Returns
Data ·
decoded Data
from(base64:)
Decodes a string in Base64.
Params
base64
std.string
string to decode
Returns
Data ·
decoded Data
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.
toHex()
Encodes Data to a string in Hex format.
Returns
String ·
toBase32()
Encodes Data to a string in Base32 format.
Returns
String ·
toBase64()
Encodes Data to a string in Base64 format.
Returns
String ·
We use cookies on our website. We use them to ensure proper functioning of the site and, if you agree, for purposes such as analytics, marketing, and targeting ads.