Vips.Dbuf¶
Fields¶
Name |
Type |
Access |
Description |
|---|---|---|---|
allocated_size |
r |
||
data |
r |
||
data_size |
r |
||
write_point |
r |
Methods¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Vips.Dbuf¶
- allocate(size)¶
- Parameters:
size (
int) – the size to allocate- Returns:
FALSEon out of memory,TRUEotherwise.- Return type:
Make sure self has at least size bytes available after the write point.
- destroy()¶
Destroy self. This frees any allocated memory. Useful for dbufs on the stack.
- get_write(size)¶
- Parameters:
- Returns:
start of write area.
- Return type:
Return a pointer to an area you can write to, return length of area in size. Use [method`Dbuf`.allocate] before this call to set a minimum amount of space to have available.
The write point moves to just beyond the returned block. Use [method`Dbuf`.seek] to move it back again.
- init()¶
Initialize self. You can also just init to zero, eg.
VipsDbuf buf = {0};.Destroy with [method`Dbuf`.destroy].
- minimum_size(size)¶
- Parameters:
size (
int) – the minimum size- Returns:
FALSEon out of memory,TRUEotherwise.- Return type:
Make sure self is at least size bytes.
- read(data, size)¶
- Parameters:
- Returns:
the number of bytes transferred.
- Return type:
Up to size bytes are read from the buffer and copied to data. The number of bytes transferred is returned.
- reset()¶
Reset the buffer to empty. No memory is freed, just the data size and write point are reset.
- seek(offset, whence)¶
- Parameters:
- Return type:
Move the write point. whence can be
SEEK_SET,SEEK_CUR,SEEK_END, with the usual meaning.
- steal(size)¶
- Parameters:
- Returns:
The pointer held by self.
- Return type:
Destroy a buffer, but rather than freeing memory, a pointer is returned. This must be freed with [func`GLib`.free].
A
\0is appended, but not included in the character count. This is so the pointer can be safely treated as a C string.
- string(size)¶
- Parameters:
- Returns:
The pointer held by self.
- Return type:
Return a pointer to self's internal data.
A
\0is appended, but not included in the character count. This is so the pointer can be safely treated as a C string.
- truncate()¶
Truncate the data so that it ends at the write point. No memory is freed.
- write(data, size)¶
- Parameters:
- Returns:
FALSEon out of memory,TRUEotherwise.- Return type:
Append size bytes from data. self expands if necessary.