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.
public func asBuffer() -> privmx.endpoint.core.Buffer
Type | Description |
---|---|
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.
public init(from buffer: privmx.endpoint.core.Buffer) throws
Name | Type | Description |
---|---|---|
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.
public func rawCppString() -> std.string
Type | Description |
---|---|
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.
public init(from str: std.string)
Name | Type | Description |
---|---|---|
str | std.string | The C++ `std.string` to convert to `Data`. |
Type | Description |
---|---|
A `Data` representation of the given `std.string`. |