This class represents a single file opened by FileSystem. It provides more information than Window’s input stream (stream, filename, mime type, anchor).
Note: Any pointer returned by a method of FSFile is valid only as long as the 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 obtain ten identical pointers.
FileSystemHandler, FileSystem, Overview
FSFile.new(InputStream stream, String loc, String mimetype,
String anchor,
DateTime modif)
Constructor. You probably won’t use it. See Notes for details.
If you are not sure of the meaning of these params, see the description of the GetXXXX() functions.
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 FSFile constructor would lead to memory leaks, you can write your own class derived from FSFile:
class MyFSFile : public FSFile
{
private:
void m_Mem;
public:
MyFSFile(.....)
MyFSFile() {free(m_Mem);}
// of course dtor is virtual ;-)
};
String *get_anchor()
Returns anchor (if present). The term of anchor can be easily explained using few examples:
index.htm#anchor /* 'anchor' is anchor /
index/wx001.htm / NO anchor here! /
archive/main.zip#zip:index.htm#global / 'global' /
archive/main.zip#zip:index.htm / NO anchor here! /
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 *get_location()
Returns full location of the file, including path and protocol. Examples :
http://www.wxwidgets.org
http://www.ms.mff.cuni.cz/vsla8348/wxhtml/archive.zip#zip:info.txt
file:/home/vasek/index.htm
relative-file.htm
String get_mime_type()
Returns the MIME type of the content of this file. It is either extension-based (see MimeTypesManager) or extracted from HTTP protocol Content-Type header.
DateTime get_modification_time()
Returns time when this file was modified.
InputStream get_stream()
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).
[This page automatically generated from the Textile source at Fri Oct 31 16:06:42 +0000 2008]