logo top
Main Page   Widgets   glibmm Namespaces   Book  

Gio::FileInputStream Class Reference

FileInputStream provides input streams that take their content from a file. More...

Inheritance diagram for Gio::FileInputStream:

Inheritance graph
[legend]
List of all members.

Public Member Functions

virtual ~FileInputStream ()
GFileInputStream* gobj ()
 Provides access to the underlying C GObject.
const GFileInputStream* gobj () const
 Provides access to the underlying C GObject.
GFileInputStream* gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
Glib::RefPtr<FileInfoquery_info (const std::string& attributes, const Glib::RefPtr<Cancellable>& cancellable)
 Queries a file input stream the given attributes .his function blocks while querying the stream.
void query_info_async (const std::string& attributes, int io_priority, Glib::RefPtr<Cancellable>& cancellable, const SlotAsyncReady& slot)
 Queries the stream information asynchronously.
Glib::RefPtr<FileInfoquery_info_finish (const Glib::RefPtr<AsyncResult>& result)
 Finishes an asynchronous info query operation.
goffset tell () const
 Gets the current position in the stream.
bool can_seek () const
 Checks if a file input stream can be seeked.
bool seek (goffset offset, Glib::SeekType type, const Glib::RefPtr<Cancellable>& cancellable)
 Seeks in the file input stream.
bool seek (goffset offset, Glib::SeekType type)
 Seeks in the file input stream.

Related Functions

(Note that these are not member functions.)

Glib::RefPtr<Gio::FileInputStreamwrap (GFileInputStream* object, bool take_copy=false)
 A Glib::wrap() method for this object.

Detailed Description

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

FileInputStream implements Seekable, which allows the input stream to jump to arbitrary positions in the file, provided the filesystem of the file allows it. In addition to the generic Seekable API, FileInputStream has its own API for seeking and positioning. To find the position of a file input stream, use tell(). To find out if a file input stream supports seeking, use can_seek(). To position a file input stream, use seek().

Since glibmm 2.16:


Constructor & Destructor Documentation

virtual Gio::FileInputStream::~FileInputStream (  )  [virtual]


Member Function Documentation

GFileInputStream* Gio::FileInputStream::gobj (  )  [inline]

Provides access to the underlying C GObject.

Reimplemented from Gio::InputStream.

const GFileInputStream* Gio::FileInputStream::gobj (  )  const [inline]

Provides access to the underlying C GObject.

Reimplemented from Gio::InputStream.

GFileInputStream* Gio::FileInputStream::gobj_copy (  ) 

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

Reimplemented from Gio::InputStream.

Glib::RefPtr<FileInfo> Gio::FileInputStream::query_info ( const std::string attributes,
const Glib::RefPtr<Cancellable>&  cancellable 
)

Queries a file input stream the given attributes .his function blocks while querying the stream.

For the asynchronous (non-blocking) version of this function, see g_file_input_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.

Parameters:
attributes A file attribute query string.
cancellable Optional G::Cancellable object, 0 to ignore.
error A G::Error location to store the error occuring, or 0 to ignore.
Returns:
A G::FileInfo, or 0 on error.

void Gio::FileInputStream::query_info_async ( const std::string attributes,
int  io_priority,
Glib::RefPtr<Cancellable>&  cancellable,
const SlotAsyncReady slot 
)

Queries the stream information asynchronously.

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

The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be set.

When the operation is finished, slot will be called. You can then call query_info_finish() to get the result of the operation.

Parameters:
attributes A file attribute query string.
io_priority The I/O priority of the request.
cancellable A Cancellable object which can be used to cancel the operation.
slot A callback slot which will be called when the request is satisfied.

Glib::RefPtr<FileInfo> Gio::FileInputStream::query_info_finish ( const Glib::RefPtr<AsyncResult>&  result  ) 

Finishes an asynchronous info query operation.

Parameters:
result A G::AsyncResult.
error A G::Error location to store the error occuring, or 0 to ignore.
Returns:
G::FileInfo.

goffset Gio::FileInputStream::tell (  )  const

Gets the current position in the stream.

Returns:
A goffset with the position in the stream.

bool Gio::FileInputStream::can_seek (  )  const

Checks if a file input stream can be seeked.

Returns:
true if stream can be seeked. false otherwise.

bool Gio::FileInputStream::seek ( goffset  offset,
Glib::SeekType  type,
const Glib::RefPtr<Cancellable>&  cancellable 
)

Seeks in the file input stream.

If cancellable is not 0, 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.

Parameters:
offset A goffset to seek.
type A G::SeekType.
cancellable Optional G::Cancellable object, 0 to ignore.
error A G::Error location to store the error occuring, or 0 to ignore.
Returns:
true if the stream was successfully seeked to the position. false on error.

bool Gio::FileInputStream::seek ( goffset  offset,
Glib::SeekType  type 
)

Seeks in the file input stream.

Parameters:
offset An offset to seek.
type A SeekType.
Returns:
true if the stream was successfully seeked to the position. false on error.


Friends And Related Function Documentation

Glib::RefPtr<Gio::FileInputStream> wrap ( GFileInputStream *  object,
bool  take_copy = false 
) [related]

A Glib::wrap() method for this object.

Parameters:
object The C instance.
take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns:
A C++ instance that wraps this C instance.


The documentation for this class was generated from the following file:

Generated for glibmm 2.4 by Doxygen 1.5.1 © 1997-2001