Gio.MemoryOutputStream¶
- Subclasses:
None
Methods¶
- Inherited:
Gio.OutputStream (29), GObject.Object (37), Gio.PollableOutputStream (5), Gio.Seekable (5)
- Structs:
class |
|
|
|
|
|
|
Virtual Methods¶
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/co |
|||
r |
|||
r/w/co |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class Gio.MemoryOutputStream(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
GMemoryOutputStream
is a class for using arbitrary memory chunks as output for GIO streaming output operations.As of GLib 2.34,
GMemoryOutputStream
trivially implements [iface`Gio`.PollableOutputStream]: it always polls as ready.- classmethod new_resizable()[source]¶
- Return type:
Creates a new
Gio.MemoryOutputStream
, usingGLib.realloc
() andGLib.free
() for memory allocation.New in version 2.36.
- get_data()[source]¶
- Returns:
pointer to the stream’s data, or
None
if the data has been stolen- Return type:
Gets any loaded data from the self.
Note that the returned pointer may become invalid on the next write or truncate operation on the stream.
- get_data_size()[source]¶
- Returns:
the number of bytes written to the stream
- Return type:
Returns the number of bytes from the start up to including the last byte written in the stream that has not been truncated away.
New in version 2.18.
- get_size()[source]¶
- Returns:
the number of bytes allocated for the data buffer
- Return type:
Gets the size of the currently allocated data area (available from
Gio.MemoryOutputStream.get_data
()).You probably don’t want to use this function on resizable streams. See
Gio.MemoryOutputStream.get_data_size
() instead. For resizable streams the size returned by this function is an implementation detail and may be change at any time in response to operations on the stream.If the stream is fixed-sized (ie: no realloc was passed to g_memory_output_stream_new()) then this is the maximum size of the stream and further writes will return
Gio.IOErrorEnum.NO_SPACE
.In any case, if you want the number of bytes currently written to the stream, use
Gio.MemoryOutputStream.get_data_size
().
- steal_as_bytes()[source]¶
- Returns:
the stream’s data
- Return type:
Returns data from the self as a
GLib.Bytes
. self must be closed before calling this function.New in version 2.34.
- steal_data()[source]¶
-
Gets any loaded data from the self. Ownership of the data is transferred to the caller; when no longer needed it must be freed using the free function set in self's
Gio.MemoryOutputStream
:destroy-function
property.self must be closed before calling this function.
New in version 2.26.
Property Details¶
- Gio.MemoryOutputStream.props.data¶
- Name:
data
- Type:
- Default Value:
- Flags:
Pointer to buffer where data will be written.
New in version 2.24.
- Gio.MemoryOutputStream.props.data_size¶
-
Size of data written to the buffer.
New in version 2.24.
- Gio.MemoryOutputStream.props.size¶
- Name:
size
- Type:
- Default Value:
0
- Flags:
Current size of the data buffer.
New in version 2.24.