Top | ![]() |
![]() |
![]() |
![]() |
const gchar * | mirage_stream_get_filename () |
gboolean | mirage_stream_is_writable () |
gboolean | mirage_stream_move_file () |
gssize | mirage_stream_read () |
gssize | mirage_stream_write () |
gboolean | mirage_stream_seek () |
goffset | mirage_stream_tell () |
GInputStream * | mirage_stream_get_g_input_stream () |
MirageStream is a basic unit of file access abstraction used in libMirage. It supports basic I/O operations, such as read, write, seek and tell.
Streams in libMirage are designed around the idea of filter stream chains, where several filter streams (MirageFilterStream) can be chained on top of a stream that abstracts direct access to the file (MirageFileStream).
const gchar *
mirage_stream_get_filename (MirageStream *self
);
Retrieves the name to file on which the stream is opened. If self
is
a filter stream in the filter stream chain, the filename is obtained from
the stream at the bottom of the chain.
gboolean
mirage_stream_is_writable (MirageStream *self
);
Queries the stream (chain) for write support. For the stream to be writable, the stream object implementation itself must support write operations, and any stream objects below it in the stream chain must also be writable.
gboolean mirage_stream_move_file (MirageStream *self
,const gchar *new_filename
,GError **error
);
Attempts to move the file on top of which the stream (chain) is opened
to new_filename
. If supported, native move operations are used,
otherwise a copy + delete fallback is used.
gssize mirage_stream_read (MirageStream *self
,void *buffer
,gsize count
,GError **error
);
Attempts to read count
bytes from stream into the buffer starting at
buffer
. Will block during the operation.
gssize mirage_stream_write (MirageStream *self
,const void *buffer
,gsize count
,GError **error
);
Attempts to write count
bytes to stream from the buffer starting at
buffer
. Will block during the operation.
gboolean mirage_stream_seek (MirageStream *self
,goffset offset
,GSeekType type
,GError **error
);
Seeks in the stream by the given offset
, modified by type
.
goffset
mirage_stream_tell (MirageStream *self
);
Retrieves the current position within the stream.
GInputStream *
mirage_stream_get_g_input_stream (MirageStream *self
);
Constructs and returns a compatibility object inheriting a GInputStream. This is to allow regular GIO stream objects (for example, a GDataInputStream) to be chained on top of our filter stream chain.
struct MirageStreamInterface { GTypeInterface parent_iface; /* Interface methods */ const gchar *(*get_filename) (MirageStream *self); gboolean (*is_writable) (MirageStream *self); gboolean (*move_file) (MirageStream *self, const gchar *new_filename, GError **error); gssize (*read) (MirageStream *self, void *buffer, gsize count, GError **error); gssize (*write) (MirageStream *self, const void *buffer, gsize count, GError **error); gboolean (*seek) (MirageStream *self, goffset offset, GSeekType type, GError **error); goffset (*tell) (MirageStream *self); };
Provides an interface for implementing I/O streams.