FileIOStream

Description GFileIOStream provides io streams that both read and write to the same file handle. GFileIOStream implements GSeekable, which allows the io stream to jump to arbitrary positions in the file and to truncate the file, provided the filesystem of the file supports these operations. To find the position of a file io stream, use g_seekable_tell(). To find out if a file io stream supports seeking, use g_seekable_can_seek(). To position a file io stream, use g_seekable_seek(). To find out if a file io stream supports truncating, use g_seekable_can_truncate(). To truncate a file io stream, use g_seekable_truncate(). The default implementation of all the GFileIOStream operations and the implementation of GSeekable just call into the same operations on the output stream.

Constructors

this
this(GFileIOStream* gFileIOStream)

Sets our main struct and passes it to the parent class

Members

Functions

getEtag
string getEtag()

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. Since 2.22

getFileIOStreamStruct
GFileIOStream* getFileIOStreamStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getStruct
void* getStruct()

the main Gtk struct as a void*

queryInfo
FileInfo queryInfo(string attributes, Cancellable cancellable)

Queries a file io stream for the given attributes. This function blocks while querying the stream. For the asynchronous version of this function, see g_file_io_stream_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 G_IO_ERROR_PENDING. Can fail if the stream was already closed (with error being set to G_IO_ERROR_CLOSED), the stream has pending operations (with error being set to G_IO_ERROR_PENDING), or if querying info is not supported for the stream's interface (with error being set to G_IO_ERROR_NOT_SUPPORTED). I all cases of failure, NULL will be returned. If cancellable is not NULL, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED will be set, and NULL will be returned. Since 2.22

queryInfoAsync
void queryInfoAsync(string attributes, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)

Asynchronously queries the stream for a GFileInfo. When completed, callback will be called with a GAsyncResult which can be used to finish the operation with g_file_io_stream_query_info_finish(). For the synchronous version of this function, see g_file_io_stream_query_info(). Since 2.22

queryInfoFinish
FileInfo queryInfoFinish(AsyncResultIF result)

Finalizes the asynchronous query started by g_file_io_stream_query_info_async(). Since 2.22

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.

Mixins

__anonymous
mixin SeekableT!(GFileIOStream)
Undocumented in source.

Variables

gFileIOStream
GFileIOStream* gFileIOStream;

the main Gtk struct

Inherited Members

From IOStream

gIOStream
GIOStream* gIOStream;

the main Gtk struct

getIOStreamStruct
GIOStream* getIOStreamStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getStruct
void* getStruct()

the main Gtk struct as a void*

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.
getInputStream
InputStream getInputStream()

Gets the input stream for this object. This is used for reading. Since 2.22

getOutputStream
OutputStream getOutputStream()

Gets the output stream for this object. This is used for writing. Since 2.22

spliceAsync
void spliceAsync(IOStream stream2, GIOStreamSpliceFlags flags, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)

Asyncronously splice the output stream of stream1 to the input stream of stream2, and splice the output stream of stream2 to the input stream of stream1. When the operation is finished callback will be called. You can then call g_io_stream_splice_finish() to get the result of the operation. Since 2.28

spliceFinish
int spliceFinish(AsyncResultIF result)

Finishes an asynchronous io stream splice operation. Since 2.28

close
int close(Cancellable cancellable)

Closes the stream, releasing resources related to it. This will also closes the individual input and output streams, if they are not already closed. Once the stream is closed, all other operations will return G_IO_ERROR_CLOSED. Closing a stream multiple times will not return an error. Closing a stream will automatically flush any outstanding buffers in the stream. Streams will be automatically closed when the last reference is dropped, but you might want to call this function to make sure resources are released as early as possible. Some streams might keep the backing store of the stream (e.g. a file descriptor) open after the stream is closed. See the documentation for the individual stream for details. On failure the first error that happened will be reported, but the close operation will finish as much as possible. A stream that failed to close will still return G_IO_ERROR_CLOSED for all operations. Still, it is important to check and report the error to the user, otherwise there might be a loss of data as all data might not be written. If cancellable is not NULL, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED will be returned. Cancelling a close will still leave the stream closed, but some streams can use a faster close that doesn't block to e.g. check errors. The default implementation of this method just calls close on the individual input/output streams. Since 2.22

closeAsync
void closeAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)

Requests an asynchronous close of the stream, releasing resources related to it. When the operation is finished callback will be called. You can then call g_io_stream_close_finish() to get the result of the operation. For behaviour details see g_io_stream_close(). The asynchronous methods have a default fallback that uses threads to implement asynchronicity, so they are optional for inheriting classes. However, if you override one you must override all. Since 2.22

closeFinish
int closeFinish(AsyncResultIF result)

Closes a stream. Since 2.22

isClosed
int isClosed()

Checks if a stream is closed. Since 2.22

hasPending
int hasPending()

Checks if a stream has pending actions. Since 2.22

setPending
int setPending()

Sets stream to have actions pending. If the pending flag is already set or stream is closed, it will return FALSE and set error. Since 2.22

clearPending
void clearPending()

Clears the pending flag on stream. Since 2.22

From SeekableIF

getSeekableTStruct
GSeekable* getSeekableTStruct()
Undocumented in source.
getStruct
void* getStruct()

the main Gtk struct as a void*

tell
long tell()

Tells the current position within the stream.

canSeek
int canSeek()

Tests if the stream supports the GSeekableIface.

seek
int seek(long offset, GSeekType type, Cancellable cancellable)

Seeks in the stream by the given offset, modified by type. If cancellable is not NULL, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED will be returned.

canTruncate
int canTruncate()

Tests if the stream can be truncated.

truncate
int truncate(long offset, Cancellable cancellable)

Truncates a stream with a given offset. If cancellable is not NULL, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED will be returned. If an operation was partially finished when the operation was cancelled the partial result will be returned, without an error. Virtual: truncate_fn

Meta