ZBytesWriter class

A zenoh bytes writer for assembling raw byte payloads.

Wraps z_owned_bytes_writer_t. Call finish to produce a ZBytes, or dispose to release native resources without finishing.

This object holds a native handle, so it cannot cross an isolate boundary: a copy would share this one's native address while carrying its own fresh disposal flag, and the second release would be a use-after-free. Sending it throws ArgumentError naming the class.

It carries a NativeFinalizer safety net: if it is dropped without an explicit release, its native resources are reclaimed when the object is collected. ⛔ The net is not a substitute for releasing it explicitly — a finalizer runs at an unpredictable time, or not at all if the program exits first.

Implemented types

Constructors

ZBytesWriter()
Creates an empty bytes writer.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

append(ZBytes bytes) → void
Appends owned bytes into the writer, consuming them.
dispose() → void
Releases native resources held by this writer.
finish() ZBytes
Finishes the writer and returns the produced ZBytes.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
writeAll(Uint8List data) → void
Writes all bytes from data into the writer.

Operators

operator ==(Object other) bool
The equality operator.
inherited