work with memory chunks
Create a new chunk of the specified size. If you specify the data, it
is copied into the chunk. If you do not specify the data, the chunk is
allocated and left empty, and you can then add data using zchunk_append.
Destroy a chunk
Resizes chunk max_size as requested; chunk_cur size is set to zero
Return chunk cur size
Return chunk max size
Return chunk data
Set chunk data from user-supplied data; truncate if too large. Data may
be null. Returns actual size of chunk
Fill chunk data from user-supplied octet
Append user-supplied data to chunk, return resulting chunk size. If the
data would exceeded the available space, it is truncated. If you want to
grow the chunk to accommodate new data, use the zchunk_extend method.
Append user-supplied data to chunk, return resulting chunk size. If the
data would exceeded the available space, the chunk grows in size.
Copy as much data from 'source' into the chunk as possible; returns the
new size of chunk. If all data from 'source' is used, returns exhausted
on the source chunk. Source can be consumed as many times as needed until
it is exhausted. If source was already exhausted, does not change chunk.
Returns true if the chunk was exhausted by consume methods, or if the
chunk has a size of zero.
Read chunk from an open file descriptor
Write chunk to an open file descriptor
Try to slurp an entire file into a chunk. Will read up to maxsize of
the file. If maxsize is 0, will attempt to read the entire file and
fail with an assertion if that cannot fit into memory. Returns a new
chunk containing the file data, or NULL if the file could not be read.
Create copy of chunk, as new chunk object. Returns a fresh zchunk_t
object, or null if there was not enough heap memory. If chunk is null,
returns null.
Return chunk data encoded as printable hex string. Caller must free
string when finished with it.
Return chunk data copied into freshly allocated string
Caller must free string when finished with it.
Return TRUE if chunk body is equal to string, excluding terminator
Transform zchunk into a zframe that can be sent in a message.
Transform a zframe into a zchunk.
Calculate SHA1 digest for chunk, using zdigest class.
Dump chunk to FILE stream, for debugging and tracing.
Dump message to stderr, for debugging and tracing.
See zchunk_fprint for details
Probe the supplied object, and report if it looks like a zchunk_t.