FileOutputStream

class FileOutputStream(**properties: Any)

Superclasses: OutputStream, Object

Implemented Interfaces: Seekable

Constructors:

FileOutputStream(**properties)

Methods

class FileOutputStream
get_etag() str | None

Gets the entity tag for the file when it has been written. This must be called after the stream has been written and closed, as the etag can change while writing.

query_info(attributes: str, cancellable: Cancellable | None = None) FileInfo

Queries a file output stream for the given attributes. This function blocks while querying the stream. For the asynchronous version of this function, see 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 PENDING.

Can fail if the stream was already closed (with error being set to CLOSED), the stream has pending operations (with error being set to PENDING), or if querying info is not supported for the stream’s interface (with error being set to NOT_SUPPORTED). In all cases of failure, None will be returned.

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 CANCELLED will be set, and None will be returned.

Parameters:
  • attributes – a file attribute query string.

  • cancellable – optional Cancellable object, None to ignore.

query_info_async(attributes: str, io_priority: int, cancellable: Cancellable | None = None, callback: Callable[[...], None] | None = None, *user_data: Any) None

Asynchronously queries the stream for a FileInfo. When completed, callback will be called with a AsyncResult which can be used to finish the operation with query_info_finish().

For the synchronous version of this function, see query_info().

Parameters:
  • attributes – a file attribute query string.

  • io_priority – the I/O priority of the request

  • cancellable – optional Cancellable object, None to ignore.

  • callback – callback to call when the request is satisfied

  • user_data – the data to pass to callback function

query_info_finish(result: AsyncResult) FileInfo

Finalizes the asynchronous query started by query_info_async().

Parameters:

result – a AsyncResult.

Virtual Methods

class FileOutputStream
do_can_seek() bool
do_can_truncate() bool
do_get_etag() str | None

Gets the entity tag for the file when it has been written. This must be called after the stream has been written and closed, as the etag can change while writing.

do_query_info(attributes: str, cancellable: Cancellable | None = None) FileInfo

Queries a file output stream for the given attributes. This function blocks while querying the stream. For the asynchronous version of this function, see 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 PENDING.

Can fail if the stream was already closed (with error being set to CLOSED), the stream has pending operations (with error being set to PENDING), or if querying info is not supported for the stream’s interface (with error being set to NOT_SUPPORTED). In all cases of failure, None will be returned.

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 CANCELLED will be set, and None will be returned.

Parameters:
  • attributes – a file attribute query string.

  • cancellable – optional Cancellable object, None to ignore.

do_query_info_async(attributes: str, io_priority: int, cancellable: Cancellable | None = None, callback: Callable[[...], None] | None = None, *user_data: Any) None

Asynchronously queries the stream for a FileInfo. When completed, callback will be called with a AsyncResult which can be used to finish the operation with query_info_finish().

For the synchronous version of this function, see query_info().

Parameters:
  • attributes – a file attribute query string.

  • io_priority

    the I/O priority of the request

  • cancellable – optional Cancellable object, None to ignore.

  • callback – callback to call when the request is satisfied

  • user_data – the data to pass to callback function

do_query_info_finish(result: AsyncResult) FileInfo

Finalizes the asynchronous query started by query_info_async().

Parameters:

result – a AsyncResult.

do_seek(offset: int, type: SeekType, cancellable: Cancellable | None = None) bool
Parameters:
  • offset

  • type

  • cancellable

do_tell() int
do_truncate_fn(size: int, cancellable: Cancellable | None = None) bool

The type of the None singleton.

Parameters:
  • size

  • cancellable

Fields

class FileOutputStream
parent_instance
priv