|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
CHtmlStream does not have a base class.
CHtmlStream is a class that manages in-memory HTML. HTML memory files are useful for temporarily storing raw bytes or serialized objects prior to their transmission. Although it is not derived from CFile, CHtmlStream behaves like the CFile–derived class CMemFile, except CHtmlStream is used to store data in a temporary buffer prior to sending it out, and the data stored in a CHtmlStream memory file cannot be read.
CHtmlStream objects usually are created automatically and handed to you by CHttpServer::ConstructStream; however, you can override CHttpServer::ConstructStream and provide your own special functionality.
CHtmlStream objects can automatically allocate their own memory or you can attach your own memory block to the CHtmlStream object by calling Attach. In either case, memory for growing the memory file automatically is allocated in nGrowBytes-sized increments if nGrowBytes is not zero. Set nGrowBytes with a parameter to the constructor.
The memory will automatically be deleted upon destruction of the CHtmlStream object if the memory was originally allocated by the CHtmlStream object; otherwise, you are responsible for deallocating the memory you attached to the object.
CHtmlStream uses the run-time library functions malloc, realloc, and free to allocate, reallocate, and deallocate memory; and the intrinsic memcpy to block copy memory when growing the buffer. To change this behavior or the behavior when CHtmlStream grows a file, derive your own class from CHtmlStream and override the appropriate functions.