Gsf.Input¶
- Subclasses:
Gsf.Infile
,Gsf.InputGZip
,Gsf.InputGio
,Gsf.InputHTTP
,Gsf.InputMemory
,Gsf.InputProxy
,Gsf.InputStdio
,Gsf.InputTextline
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
|
|
|
|
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r |
The parent |
||
r |
End of file |
||
r |
An optional |
||
r |
The input’s name |
||
r |
The input’s current position |
||
r |
Amount of data remaining |
||
r |
The input’s size |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
cur_offset |
r |
||
g_object |
r |
Class Details¶
- class Gsf.Input(**kwargs)¶
- Bases:
- Abstract:
Yes
- Structure:
Class representing an input stream.
- classmethod error_id()¶
- Returns:
A utility quark to flag a
GLib.Error
as being an input problem.- Return type:
- classmethod mmap_new(filename)¶
- Parameters:
filename (
str
) – The file on disk that you want to mmap- Raises:
- Returns:
A new
Gsf.InputMemory
- Return type:
- container()¶
- Returns:
self's container
- Return type:
Gsf.Infile
orNone
- copy(output)¶
- Parameters:
output (
Gsf.Output
) – a non-nullGsf.Output
- Returns:
True
on success- Return type:
Copy the contents from self to output from their respective current positions. So if you want to be sure to copy *everything*, make sure to call
Gsf.Input.seek
(input, 0,GLib.SeekType.SET
) andGsf.Output.seek
(output, 0,GLib.SeekType.SET
) first, if applicable.
- dump(dump_as_hex)¶
-
Dumps self's contents to STDOUT, optionally in hex format.
- dup()¶
- Raises:
- Returns:
the duplicate
- Return type:
Duplicates self leaving the new one at the same offset.
- find_vba()¶
- Raises:
- Returns:
- Return type:
A utility routine that attempts to find the VBA file withint a stream.
- get_modtime()¶
- Returns:
A
GLib.DateTime
representing when the input was last modified, orNone
if not known.- Return type:
- name()¶
-
The name of the input stream.
- read(num_bytes)¶
-
Read num_bytes. Does not change the current position if there is an error. Will only read if the entire amount can be read.
- seek(offset, whence)¶
- Parameters:
offset (
int
) – target offsetwhence (
GLib.SeekType
) – determines whether the offset is relative to the beginning or the end of the stream, or to the current location.
- Returns:
True
on error.- Return type:
Move the current location in the input stream.
- seek_emulate(pos)¶
- Parameters:
pos (
int
) – absolute position to seek to- Returns:
True
if the emulation failed.- Return type:
Emulate forward seeks by reading.
- set_container(container)¶
- Parameters:
container (
Gsf.Infile
orNone
) –- Returns:
True
if the assignment was ok.- Return type:
- set_modtime(modtime)¶
- Parameters:
modtime (
GLib.DateTime
orNone
) – the new modification time.- Returns:
True
if the assignment was ok.- Return type:
protected.
- set_name_from_filename(filename)¶
- Parameters:
filename (
str
) – the (fs-sys encoded) filename- Returns:
True
if the assignment was ok.- Return type:
protected.
- set_size(size)¶
- sibling(name)¶
-
UNIMPLEMENTED BY ANY BACKEND and it is probably unnecessary. gsf_input_get_container provides enough power to do what is necessary.
Attempts to open a ‘sibling’ of self. The caller is responsible for managing the resulting object.
- uncompress()¶
- Returns:
A stream equivalent to the source stream, but uncompressed if the source was compressed.
- Return type:
This functions takes ownership of the incoming reference and yields a new one as its output.
- do_Dup() virtual¶
-
Duplicates input leaving the new one at the same offset.
- do_OpenSibling(name) virtual¶
-
UNIMPLEMENTED BY ANY BACKEND and it is probably unnecessary. gsf_input_get_container provides enough power to do what is necessary.
Attempts to open a ‘sibling’ of input. The caller is responsible for managing the resulting object.
- do_Seek(offset, whence) virtual¶
- Parameters:
offset (
int
) – target offsetwhence (
GLib.SeekType
) – determines whether the offset is relative to the beginning or the end of the stream, or to the current location.
- Returns:
True
on error.- Return type:
Move the current location in the input stream.
Property Details¶
- Gsf.Input.props.container¶
- Name:
container
- Type:
- Default Value:
- Flags:
The container, optionally
None
, in which this input lives.
- Gsf.Input.props.modtime¶
- Name:
modtime
- Type:
- Default Value:
- Flags:
The time the input was last updated. This represents the timestamp from the originating file or GsfInfile member. It is not supported by all derived classes.
- Gsf.Input.props.position¶
-
The current position in the input.
- Gsf.Input.props.remaining¶
-
The number of bytes remaining in the file.