Camel.DataWrapper¶
- Subclasses:
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Properties¶
None
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class Camel.DataWrapper(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
- classmethod new()¶
- Returns:
a new
Camel.DataWrapper
object- Return type:
Create a new
Camel.DataWrapper
object.
- calculate_decoded_size_sync(cancellable)¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
, orNone
- Raises:
- Returns:
how many bytes the self would use when saved, or -1 on error.
- Return type:
Calculates decoded size of the self by saving it to a null-stream and returns how many bytes had been written. It’s using
Camel.DataWrapper.decode_to_stream_sync
() internally.New in version 3.24.
- calculate_size_sync(cancellable)¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
, orNone
- Raises:
- Returns:
how many bytes the self would use when saved, or -1 on error.
- Return type:
Calculates size of the self by saving it to a null-stream and returns how many bytes had been written. It’s using
Camel.DataWrapper.write_to_stream_sync
() internally.New in version 3.24.
- construct_from_data_sync(data, data_len, cancellable)¶
- Parameters:
data (
object
) – data to setdata_len (
int
) – length of datacancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
- Raises:
- Returns:
- Return type:
Constructs the content of self from data of length data_len.
New in version 3.46.
- construct_from_input_stream(input_stream, io_priority, cancellable, callback, *user_data)¶
- Parameters:
input_stream (
Gio.InputStream
) – aGio.InputStream
io_priority (
int
) – the I/O priority of the requestcancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the request is satisfieduser_data (
object
orNone
) – data to pass to the callback function
Asynchronously constructs the content of self from input_stream.
When the operation is finished, callback will be called. You can then call
Camel.DataWrapper.construct_from_input_stream_finish
() to get the result of the operation.New in version 3.12.
- construct_from_input_stream_finish(result)¶
- Parameters:
result (
Gio.AsyncResult
) – aGio.AsyncResult
- Raises:
- Returns:
- Return type:
Finishes the operation started with
Camel.DataWrapper.construct_from_input_stream
().New in version 3.12.
- construct_from_input_stream_sync(input_stream, cancellable)¶
- Parameters:
input_stream (
Gio.InputStream
) – aGio.InputStream
cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
- Raises:
- Returns:
- Return type:
Constructs the content of self from input_stream.
New in version 3.12.
- construct_from_stream(stream, io_priority, cancellable, callback, *user_data)¶
- Parameters:
stream (
Camel.Stream
) – an inputCamel.Stream
io_priority (
int
) – the I/O priority of the requestcancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the request is satisfieduser_data (
object
orNone
) – data to pass to the callback function
Asynchronously constructs the content of self from the given stream.
When the operation is finished, callback will be called. You can then call
Camel.DataWrapper.construct_from_stream_finish
() to get the result of the operation.New in version 3.0.
- construct_from_stream_finish(result)¶
- Parameters:
result (
Gio.AsyncResult
) – aGio.AsyncResult
- Raises:
- Returns:
- Return type:
Finishes the operation started with
Camel.DataWrapper.construct_from_stream
().New in version 3.0.
- construct_from_stream_sync(stream, cancellable)¶
- Parameters:
stream (
Camel.Stream
) – an inputCamel.Stream
cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
- Raises:
- Returns:
- Return type:
Constructs the content of self from the given stream.
New in version 3.0.
- decode_to_output_stream(output_stream, io_priority, cancellable, callback, *user_data)¶
- Parameters:
output_stream (
Gio.OutputStream
) – aGio.OutputStream
io_priority (
int
) – the I/O priority of the requestcancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the request is satisfieduser_data (
object
orNone
) – data to pass to the callback function
Asynchronously writes the decoded data content to output_stream.
When the operation is finished, callback will be called. You can then call
Camel.DataWrapper.decode_to_output_stream_finish
() to get the result of the operation.New in version 3.12.
- decode_to_output_stream_finish(result)¶
- Parameters:
result (
Gio.AsyncResult
) – aGio.AsyncResult
- Raises:
- Returns:
the number of bytes written, or -1 on error
- Return type:
Finishes the operation started with
Camel.DataWrapper.decode_to_output_stream
().New in version 3.12.
- decode_to_output_stream_sync(output_stream, cancellable)¶
- Parameters:
output_stream (
Gio.OutputStream
) – aGio.OutputStream
cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
- Raises:
- Returns:
the number of bytes written, or -1 on error
- Return type:
Writes the decoded data content to output_stream.
This function may block even if the given output stream does not. For example, the content may have to be fetched across a network before it can be written to output_stream.
New in version 3.12.
- decode_to_stream(stream, io_priority, cancellable, callback, *user_data)¶
- Parameters:
stream (
Camel.Stream
) – aCamel.Stream
for decoded data to be written toio_priority (
int
) – the I/O priority of the requestcancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the request is satisfieduser_data (
object
orNone
) – data to pass to the callback function
Asynchronously writes the decoded data content to stream.
When the operation is finished, callback will be called. You can then call
Camel.DataWrapper.decode_to_stream_finish
() to get the result of the operation.New in version 3.0.
- decode_to_stream_finish(result)¶
- Parameters:
result (
Gio.AsyncResult
) – aGio.AsyncResult
- Raises:
- Returns:
the number of bytes written, or -1 on error
- Return type:
Finishes the operation started with
Camel.DataWrapper.decode_to_stream
().New in version 3.0.
- decode_to_stream_sync(stream, cancellable)¶
- Parameters:
stream (
Camel.Stream
) – aCamel.Stream
for decoded data to be written tocancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
- Raises:
- Returns:
the number of bytes written, or -1 on error
- Return type:
Writes the decoded data content to stream.
This function may block even if the given output stream does not. For example, the content may have to be fetched across a network before it can be written to stream.
New in version 3.0.
- get_byte_array()¶
- Returns:
the
GLib.ByteArray
for self- Return type:
Returns the
GLib.ByteArray
being used to hold the contents of self.Note, it’s up to the caller to use this in a thread-safe manner.
New in version 3.2.
- get_encoding()¶
- Returns:
An encoding (
Camel.TransferEncoding
) of the self- Return type:
New in version 3.24.
- get_mime_type_field()¶
- Returns:
the parsed form of the data wrapper’s MIME type
- Return type:
- is_offline()¶
- Returns:
whether self is “offline” (data stored remotely) or not. Some optional code paths may choose to not operate on offline data.
- Return type:
- set_encoding(encoding)¶
- Parameters:
encoding (
Camel.TransferEncoding
) – an encoding to set
Sets encoding (
Camel.TransferEncoding
) for the self. It doesn’t re-encode the content, if the encoding changes.New in version 3.24.
- set_mime_type(mime_type)¶
- Parameters:
mime_type (
str
) – a MIME type
This sets the data wrapper’s MIME type.
It might fail, but you won’t know. It will allow you to set Content-Type parameters on the data wrapper, which are meaningless. You should not be allowed to change the MIME type of a data wrapper that contains data, or at least, if you do, it should invalidate the data.
- set_mime_type_field(mime_type)¶
- Parameters:
mime_type (
Camel.ContentType
orNone
) – aCamel.ContentType
This sets the data wrapper’s MIME type. It adds its own reference to mime_type, if not
None
.It suffers from the same flaws as
Camel.DataWrapper.set_mime_type
().
- set_offline(offline)¶
- Parameters:
offline (
bool
) – whether the self is “offline”
Sets whether the self is “offline”. It applies only to this concrete instance. See
Camel.DataWrapper.is_offline
().New in version 3.24.
- take_mime_type_field(mime_type)¶
- Parameters:
mime_type (
Camel.ContentType
orNone
) – aCamel.ContentType
Sets mime-type filed to be mime_type and consumes it, aka unlike
Camel.DataWrapper.set_mime_type_field
(), this doesn’t add its own reference to mime_type.It suffers from the same flaws as
Camel.DataWrapper.set_mime_type
().New in version 3.24.
- write_to_output_stream(output_stream, io_priority, cancellable, callback, *user_data)¶
- Parameters:
output_stream (
Gio.OutputStream
) – aGio.OutputStream
io_priority (
int
) – the I/O priority of the requestcancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the request is satisfieduser_data (
object
orNone
) – data to pass to the callback function
Asynchronously writes the content of self to output_stream in a machine-independent format appropriate for the data.
When the operation is finished, callback will be called. You can then call
Camel.DataWrapper.write_to_output_stream_finish
() to get the result of the operation.New in version 3.12.
- write_to_output_stream_finish(result)¶
- Parameters:
result (
Gio.AsyncResult
) – aGio.AsyncResult
- Raises:
- Returns:
the number of bytes written, or -1 on error
- Return type:
Finishes the operation started with
Camel.DataWrapper.write_to_output_stream
().New in version 3.12.
- write_to_output_stream_sync(output_stream, cancellable)¶
- Parameters:
output_stream (
Gio.OutputStream
) – aGio.OutputStream
cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
- Raises:
- Returns:
the number of bytes written, or -1 on error
- Return type:
Writes the content of self to output_stream in a machine-independent format appropriate for the data.
This function may block even if the given output stream does not. For example, the content may have to be fetched across a network before it can be written to output_stream.
New in version 3.12.
- write_to_stream(stream, io_priority, cancellable, callback, *user_data)¶
- Parameters:
stream (
Camel.Stream
) – aCamel.Stream
for writed data to be written toio_priority (
int
) – the I/O priority of the requestcancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the request is satisfieduser_data (
object
orNone
) – data to pass to the callback function
Asynchronously writes the content of self to stream in a machine-independent format appropriate for the data. It should be possible to construct an equivalent data wrapper object later by passing this stream to
Camel.DataWrapper.construct_from_stream
().When the operation is finished, callback will be called. You can then call
Camel.DataWrapper.write_to_stream_finish
() to get the result of the operation.New in version 3.0.
- write_to_stream_finish(result)¶
- Parameters:
result (
Gio.AsyncResult
) – aGio.AsyncResult
- Raises:
- Returns:
the number of bytes written, or -1 or error
- Return type:
Finishes the operation started with
Camel.DataWrapper.write_to_stream
().New in version 3.0.
- write_to_stream_sync(stream, cancellable)¶
- Parameters:
stream (
Camel.Stream
) – aCamel.Stream
for outputcancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
- Raises:
- Returns:
the number of bytes written, or -1 on error
- Return type:
Writes the content of self to stream in a machine-independent format appropriate for the data. It should be possible to construct an equivalent data wrapper object later by passing this stream to
Camel.DataWrapper.construct_from_stream_sync
().This function may block even if the given output stream does not. For example, the content may have to be fetched across a network before it can be written to stream.
New in version 3.0.
- do_construct_from_input_stream_sync(input_stream, cancellable) virtual¶
- Parameters:
input_stream (
Gio.InputStream
) – aGio.InputStream
cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
- Returns:
- Return type:
Constructs the content of data_wrapper from input_stream.
New in version 3.12.
- do_construct_from_stream_sync(stream, cancellable) virtual¶
- Parameters:
stream (
Camel.Stream
) – an inputCamel.Stream
cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
- Returns:
- Return type:
Constructs the content of data_wrapper from the given stream.
New in version 3.0.
- do_decode_to_output_stream_sync(output_stream, cancellable) virtual¶
- Parameters:
output_stream (
Gio.OutputStream
) – aGio.OutputStream
cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
- Returns:
the number of bytes written, or -1 on error
- Return type:
Writes the decoded data content to output_stream.
This function may block even if the given output stream does not. For example, the content may have to be fetched across a network before it can be written to output_stream.
New in version 3.12.
- do_decode_to_stream_sync(stream, cancellable) virtual¶
- Parameters:
stream (
Camel.Stream
) – aCamel.Stream
for decoded data to be written tocancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
- Returns:
the number of bytes written, or -1 on error
- Return type:
Writes the decoded data content to stream.
This function may block even if the given output stream does not. For example, the content may have to be fetched across a network before it can be written to stream.
New in version 3.0.
- do_get_mime_type() virtual¶
- Returns:
the MIME type which must be freed by the caller
- Return type:
- do_get_mime_type_field() virtual¶
- Returns:
the parsed form of the data wrapper’s MIME type
- Return type:
- do_is_offline() virtual¶
- Returns:
whether data_wrapper is “offline” (data stored remotely) or not. Some optional code paths may choose to not operate on offline data.
- Return type:
- do_set_mime_type(mime_type) virtual¶
- Parameters:
mime_type (
str
) – a MIME type
This sets the data wrapper’s MIME type.
It might fail, but you won’t know. It will allow you to set Content-Type parameters on the data wrapper, which are meaningless. You should not be allowed to change the MIME type of a data wrapper that contains data, or at least, if you do, it should invalidate the data.
- do_set_mime_type_field(mime_type) virtual¶
- Parameters:
mime_type (
Camel.ContentType
orNone
) – aCamel.ContentType
This sets the data wrapper’s MIME type. It adds its own reference to mime_type, if not
None
.It suffers from the same flaws as
Camel.DataWrapper.set_mime_type
().
- do_write_to_output_stream_sync(output_stream, cancellable) virtual¶
- Parameters:
output_stream (
Gio.OutputStream
) – aGio.OutputStream
cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
- Returns:
the number of bytes written, or -1 on error
- Return type:
Writes the content of data_wrapper to output_stream in a machine-independent format appropriate for the data.
This function may block even if the given output stream does not. For example, the content may have to be fetched across a network before it can be written to output_stream.
New in version 3.12.
- do_write_to_stream_sync(stream, cancellable) virtual¶
- Parameters:
stream (
Camel.Stream
) – aCamel.Stream
for outputcancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
- Returns:
the number of bytes written, or -1 on error
- Return type:
Writes the content of data_wrapper to stream in a machine-independent format appropriate for the data. It should be possible to construct an equivalent data wrapper object later by passing this stream to
Camel.DataWrapper.construct_from_stream_sync
().This function may block even if the given output stream does not. For example, the content may have to be fetched across a network before it can be written to stream.
New in version 3.0.