This class handles the coordination between file names, URLs, and streams, and serves as a focus for configuration dependencies in W3Kit. Expensive operations are performed lazily whenever possible.
Currently only local documents are handled. In future versions of W3Kit, lazily-cached remote documents will likely be implemented.
The document name input to these messages is interpreted relative to directories specified by the W3Kit CGI Extension variables (see below). The filename extension can also be omitted from the input name, since it can normally be deduced from the specified MIME type (see below).
Note that temporaryLocal:mimeType: creates a temporary file unique to this run of the program, which is what you want most of the time. In contrast, newLocal:mimeType: creates a fixed, definite file.
+ temporaryLocal:(const char *)aName mimeType:(const char *)aType; + newLocal:(const char *)aName mimeType:(const char *)aType; + findLocal:(const char *)aName mimeType:(const char *)aType; + newOutputMimeType:(const char *)aType; + findOutputMimeType:(const char *)aType; - closeStream; - remove; - free;
The "name" method returns a name suitable for locating the document again with findLocal:mimeType:. For security reasons, when a W3Document is archived, only the name and mimeType are remembered, and they are then used to recalculate the path upon unarchiving.
If possible, the I/O streams are opened lazily (i.e., only when you actually ask for them).
- (const char *)name; - (const char *)URL; - (const char *)mimeType; - (const char *)path; - (const char *)directory; - (const char *)filename; - (const char *)extension; - (Stream *)inputStream; - (Stream *)outputStream; - (BOOL)isOpen; - (BOOL)isTemporary;Core setup methods for various kinds of documents. These are not normally used directly by application programs.
- setOutputMimeType:(const char *)aType create:(BOOL)willCreate; - setLocal:(const char *)name mimeType:(const char *)aType searchDirectories:(const char *const *)tryDirs searchURLs:(const char *const *)tryURLs create:(BOOL)willCreate check:(BOOL)willCheck makeUnique:(BOOL)willUnique makeTemporary:(BOOL)willTemp;
The checkDirectories method returns a NULL-terminated search path for documents. The documentDirectory method returns the name of the directory where new documents will be created (usually this is the just the first element of checkDirectories).
+ (const char * const *)checkDirectories; + (const char * const *)checkURLs; + (const char *)documentDirectory; + (const char *)documentURL; + (const char *)temporaryDirectory; + (const char *)temporaryURL; + (const char *)binaryDirectory; + (const char *)binaryURL; + (const char *)actionURL;The following method returns the preferred extension corresponding to a MIME type. The caller frees the result.
This will be used in creating or finding such files unless an explicit extension is supplied (currently all typed files are required to use some sort of extension).
+ (char *)extensionForMimeType:(const char *)aType;
Author: Paul Burchard
Comments to:
webmaster@www.geom.uiuc.edu
Created: Apr 18 1994 ---
Last modified: Tue Jun 18 10:42:37 1996