Skip to content

Gio.FileInputStream

class — extends InputStream, Seekable

GFileInputStream provides input streams that take their content from a file.

GFileInputStream implements Seekable, which allows the input stream to jump to arbitrary positions in the file, provided the filesystem of the file allows it. To find the position of a file input stream, use Seekable.tell. To find out if a file input stream supports seeking, use Seekable.can_seek. To position a file input stream, use Seekable.seek.

Methods

query_info

def query_info(self, attributes: str, cancellable: Cancellable | None = ...) -> FileInfo

Queries a file input stream the given attributes. This function blocks while querying the stream. For the asynchronous (non-blocking) version of this function, see FileInputStream.query_info_async. While the stream is blocked, the stream will set the pending flag internally, and any other operations on the stream will fail with IOErrorEnum.PENDING.

Parameters:

  • attributes — a file attribute query string.
  • cancellable — optional Cancellable object, None to ignore.

query_info_async

def query_info_async(self, attributes: str, io_priority: int, cancellable: Cancellable | None = ..., callback: Callable[[FileInputStream | None, AsyncResult], None] | None = ...) -> None

Queries the stream information asynchronously. When the operation is finished callback will be called. You can then call FileInputStream.query_info_finish to get the result of the operation.

For the synchronous version of this function, see FileInputStream.query_info.

If cancellable is not None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IOErrorEnum.CANCELLED will be set

Parameters:

  • attributes — a file attribute query string.
  • io_priority — the I/O priority of the request
  • cancellable — optional Cancellable object, None to ignore.
  • callback — a GAsyncReadyCallback to call when the request is satisfied

query_info_finish

def query_info_finish(self, result: AsyncResult) -> FileInfo

Finishes an asynchronous info query operation.

Parameters:

Virtual methods

do_can_seek

def do_can_seek(self) -> bool

do_query_info

def do_query_info(self, attributes: str, cancellable: Cancellable | None = ...) -> FileInfo

Queries a file input stream the given attributes. This function blocks while querying the stream. For the asynchronous (non-blocking) version of this function, see FileInputStream.query_info_async. While the stream is blocked, the stream will set the pending flag internally, and any other operations on the stream will fail with IOErrorEnum.PENDING.

Parameters:

  • attributes — a file attribute query string.
  • cancellable — optional Cancellable object, None to ignore.

do_query_info_async

def do_query_info_async(self, attributes: str, io_priority: int, cancellable: Cancellable | None = ..., callback: Callable[[FileInputStream | None, AsyncResult], None] | None = ...) -> None

Queries the stream information asynchronously. When the operation is finished callback will be called. You can then call FileInputStream.query_info_finish to get the result of the operation.

For the synchronous version of this function, see FileInputStream.query_info.

If cancellable is not None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IOErrorEnum.CANCELLED will be set

Parameters:

  • attributes — a file attribute query string.
  • io_priority — the I/O priority of the request
  • cancellable — optional Cancellable object, None to ignore.
  • callback — a GAsyncReadyCallback to call when the request is satisfied

do_query_info_finish

def do_query_info_finish(self, result: AsyncResult) -> FileInfo

Finishes an asynchronous info query operation.

Parameters:

do_seek

def do_seek(self, offset: int, type: GLib.SeekType | int, cancellable: Cancellable | None = ...) -> bool

do_tell

def do_tell(self) -> int