Gsf.Output

g GObject.Object GObject.Object Gsf.Output Gsf.Output GObject.Object->Gsf.Output

Subclasses:

Gsf.Outfile, Gsf.OutputBzip, Gsf.OutputCsv, Gsf.OutputGZip, Gsf.OutputGio, Gsf.OutputIOChannel, Gsf.OutputIconv, Gsf.OutputMemory, Gsf.OutputStdio

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

error_id ()

class

unwrap (wrapper, wrapee)

class

wrap (wrapper, wrapee)

close ()

container ()

error ()

get_modtime ()

is_closed ()

name ()

puts (line)

seek (offset, whence)

set_container (container)

set_modtime (modtime)

set_name (name)

set_name_from_filename (filename)

size ()

tell ()

write (data)

Virtual Methods

Inherited:

GObject.Object (7)

do_Close ()

do_Seek (offset, whence)

do_Write (data)

Properties

Name

Type

Flags

Short Description

container

Gsf.Outfile

r/w

The parent Gsf.Outfile

is-closed

bool

r

Whether the output is closed

modtime

GLib.DateTime

r/w/co

An optional GLib.DateTime representing the time the output was last changed

name

str

r/w

The output’s name

position

int

r

The output’s current position

size

int

r

The output’s size

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

cur_offset

int

r

cur_size

int

r

err

GLib.Error

r

g_object

GObject.Object

r

printf_buf

str

r

printf_buf_size

int

r

wrapped_by

GObject.Object

r

Class Details

class Gsf.Output(**kwargs)
Bases:

GObject.Object

Abstract:

Yes

Structure:

Gsf.OutputClass

Class representing an output stream, counterpart to Gsf.Input.

classmethod error_id()
Return type:

int

classmethod unwrap(wrapper, wrapee)
Parameters:
Returns:

True if the unwrapping succeeded.

Return type:

bool

classmethod wrap(wrapper, wrapee)
Parameters:
Returns:

True if the wrapping succeeded.

Return type:

bool

close()
Returns:

False on error

Return type:

bool

Close a stream.

container()
Returns:

self's container

Return type:

Gsf.Outfile or None

error()
Returns:

the last error logged on the output

Return type:

GLib.Error or None

get_modtime()
Returns:

A GLib.DateTime representing when the output was last modified

Return type:

GLib.DateTime or None

is_closed()
Returns:

True if self has already been closed.

Return type:

bool

name()
Returns:

self's name in utf8 form.

Return type:

str or None

Give the name of self.

puts(line)
Parameters:

line (str) – Nul terminated string to write

Returns:

True if successful, False if not

Return type:

bool

Like fputs, this assumes that the line already ends with a newline

seek(offset, whence)
Parameters:
  • offset (int) – Relative amount to reposition

  • whence (GLib.SeekType) – What the offset is relative to.

Returns:

False on error.

Return type:

bool

Reposition in output stream self. whence specifies what the offset is relative to: the beginning of the stream (GLib.SeekType.SET), current position in the stream (GLib.SeekType.CUR) or the end of the stream (GLib.SeekType.END). This function is similar to

fseek 3.

set_container(container)
Parameters:

container (Gsf.Outfile or None) – Gsf.Outfile

Returns:

True if the assignment was ok.

Return type:

bool

This is a utility routine that should only be used by derived outputs.

set_modtime(modtime)
Parameters:

modtime (GLib.DateTime or None) – the new modification time.

Returns:

True if the assignment was ok.

Return type:

bool

set_name(name)
Parameters:

name (str or None) – the new name

Returns:

True if the assignment was ok.

Return type:

bool

This is a utility routine that should only be used by derived outputs.

set_name_from_filename(filename)
Parameters:

filename (str or None) – the (fs-sys encoded) filename

Returns:

True if the assignment was ok.

Return type:

bool

This is a utility routine that should only be used by derived outputs.

size()
Returns:

the size of the output, or -1 if it does not have a size.

Return type:

int

Determine the size of the output stream self.

tell()
Returns:

the current position in the file

Return type:

int

Tell the current position in self, similar to

ftell 3.

write(data)
Parameters:

data (bytes) – Data to write.

Returns:

False on error.

Return type:

bool

Write num_bytes of data to self.

do_Close() virtual
Returns:

False on error

Return type:

bool

Close a stream.

do_Seek(offset, whence) virtual
Parameters:
  • offset (int) – Relative amount to reposition

  • whence (GLib.SeekType) – What the offset is relative to.

Returns:

False on error.

Return type:

bool

Reposition in output stream output. whence specifies what the offset is relative to: the beginning of the stream (GLib.SeekType.SET), current position in the stream (GLib.SeekType.CUR) or the end of the stream (GLib.SeekType.END). This function is similar to

fseek 3.

do_Write(data) virtual
Parameters:

data (bytes) – Data to write.

Returns:

False on error.

Return type:

bool

Write num_bytes of data to output.

Property Details

Gsf.Output.props.container
Name:

container

Type:

Gsf.Outfile

Default Value:

None

Flags:

READABLE, WRITABLE

The container, optionally None, in which this output lives.

Gsf.Output.props.is_closed
Name:

is-closed

Type:

bool

Default Value:

False

Flags:

READABLE

True if the output has been closed.

Gsf.Output.props.modtime
Name:

modtime

Type:

GLib.DateTime

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The time the output was last updated. This must be set on object construction and represents the timestamp to put on the resulting file or Gsf.Outfile member. Not all derived classes will actually do anything with this property.

Gsf.Output.props.name
Name:

name

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

The output’s name

Gsf.Output.props.position
Name:

position

Type:

int

Default Value:

0

Flags:

READABLE

The current position in the output.

Gsf.Output.props.size
Name:

size

Type:

int

Default Value:

0

Flags:

READABLE

The current file size.