FileIOStream

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, bool ownedRef)

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.

getFileIOStreamStruct
GFileIOStream* getFileIOStreamStruct()

Get the main Gtk struct

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.

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().

queryInfoFinish
FileInfo queryInfoFinish(AsyncResultIF result)

Finalizes the asynchronous query started by g_file_io_stream_query_info_async().

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.

Static functions

getType
GType getType()

Variables

gFileIOStream
GFileIOStream* gFileIOStream;

the main Gtk struct

Inherited Members

From IOStream

gIOStream
GIOStream* gIOStream;

the main Gtk struct

getIOStreamStruct
GIOStream* getIOStreamStruct()

Get the main Gtk struct

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.
getType
GType getType()
spliceFinish
bool spliceFinish(AsyncResultIF result)

Finishes an asynchronous io stream splice operation.

clearPending
void clearPending()

Clears the pending flag on @stream.

close
bool 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.

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.

closeFinish
bool closeFinish(AsyncResultIF result)

Closes a stream.

getInputStream
InputStream getInputStream()

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

getOutputStream
OutputStream getOutputStream()

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

hasPending
bool hasPending()

Checks if a stream has pending actions.

isClosed
bool isClosed()

Checks if a stream is closed.

setPending
bool 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.

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.

From SeekableIF

getSeekableStruct
GSeekable* getSeekableStruct()

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

canSeek
bool canSeek()

Tests if the stream supports the #GSeekableIface.

canTruncate
bool canTruncate()

Tests if the stream can be truncated.

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

Seeks in the stream by the given @offset, modified by @type.

tell
long tell()

Tells the current position within the stream.

truncate
bool truncate(long offset, Cancellable cancellable)

Truncates a stream with a given #offset.

Meta