phoenix_title wx.FSFile

This class represents a single file opened by wx.FileSystem.

It provides more information than wxWidgets’ input streams (stream, filename, mime type, anchor).

Note

Any pointer returned by a method of wx.FSFile is valid only as long as the wx.FSFile object exists. For example a call to GetStream doesn’t create the stream but only returns the pointer to it. In other words after 10 calls to GetStream you will have obtained ten identical pointers.

See also

wx.FileSystemHandler, wx.FileSystem, FileSystem Overview


class_hierarchy Class Hierarchy

Inheritance diagram for class FSFile:

method_summary Methods Summary

__init__

Constructor.

DetachStream

Detaches the stream from the wx.FSFile object.

GetAnchor

Returns anchor (if present).

GetLocation

Returns full location of the file, including path and protocol.

GetMimeType

Returns the MIME type of the content of this file.

GetModificationTime

Returns time when this file was modified.

GetStream

Returns pointer to the stream.


property_summary Properties Summary

Anchor

See GetAnchor

Location

See GetLocation

MimeType

See GetMimeType

ModificationTime

See GetModificationTime

Stream

See GetStream


api Class API

class wx.FSFile(Object)

Possible constructors:

FSFile(stream, location, mimetype, anchor, modif)

This class represents a single file opened by FileSystem.


Methods

__init__(self, stream, location, mimetype, anchor, modif)

Constructor.

You probably won’t use it. See the Note for details.

It is seldom used by the application programmer but you will need it if you are writing your own virtual FS. For example you may need something similar to MemoryInputStream , but because MemoryInputStream doesn’t free the memory when destroyed and thus passing a memory stream pointer into wx.FSFile constructor would lead to memory leaks, you can write your own class derived from wx.FSFile:

class MyFSFile(wx.FSFile):

    def __init__(self):

        wx.FSFile.__init__(self)

If you are not sure of the meaning of these params, see the description of the GetXXXX() functions.

Parameters:
  • stream (wx.InputStream) – The input stream that will be used to access data

  • location (string) – The full location (aka filename) of the file

  • mimetype (string) – MIME type of this file. It may be left empty, in which case the type will be determined from file’s extension (location must not be empty in this case).

  • anchor (string) – Anchor. See GetAnchor for details.

  • modif (wx.DateTime) – Modification date and time for this file.



DetachStream(self)

Detaches the stream from the wx.FSFile object.

That is, the stream obtained with GetStream will continue its existence after the wx.FSFile object is deleted.

You will have to delete the stream yourself.

Return type:

wx.InputStream



GetAnchor(self)

Returns anchor (if present).

The term of anchor can be easily explained using few examples:

Usually an anchor is presented only if the MIME type is ‘text/html’. But it may have some meaning with other files; for example myanim.avi#200 may refer to position in animation or reality.wrl.MyView may refer to a predefined view in VRML.

Return type:

string



GetLocation(self)

Returns full location of the file, including path and protocol.

Examples:

Return type:

string



GetMimeType(self)

Returns the MIME type of the content of this file.

It is either extension-based (see wx.MimeTypesManager) or extracted from HTTP protocol Content-Type header.

Return type:

string



GetModificationTime(self)

Returns time when this file was modified.

Return type:

wx.DateTime



GetStream(self)

Returns pointer to the stream.

You can use the returned stream to directly access data. You may suppose that the stream provide Seek and GetSize functionality (even in the case of the HTTP protocol which doesn’t provide this by default. Html uses local cache to work around this and to speed up the connection).

Return type:

wx.InputStream


Properties

Anchor

See GetAnchor



Location

See GetLocation



MimeType

See GetMimeType



ModificationTime

See GetModificationTime



Stream

See GetStream