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
Constructor. |
|
Detaches the stream from the wx.FSFile object. |
|
Returns anchor (if present). |
|
Returns full location of the file, including path and protocol. |
|
Returns the MIME type of the content of this file. |
|
Returns time when this file was modified. |
|
Returns pointer to the stream. |
See |
|
See |
|
See |
|
See |
wx.
FSFile
(Object)¶Possible constructors:
FSFile(stream, location, mimetype, anchor, modif)
This class represents a single file opened by FileSystem.
__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.
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.
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
.
string
GetLocation
(self)¶Returns full location of the file, including path and protocol.
Examples:
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.
string
GetModificationTime
(self)¶Returns time when this file was modified.
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).
Location
¶See GetLocation
MimeType
¶See GetMimeType
ModificationTime
¶