[Prev][Next][Index][Thread]

Re: Streaming a requested document to a memory buffer



> Hello,
> 
> I would like to receive the requested data in a memory buffer that the application
> provides in order to roll my own processing of the data. Is there any way to
> accomplish this? I have looked through all the header files and a lot of the sources,
> but couldn't find anything. The LineModeBrowser doesn't seem to have this feature
> either. Is this not possible (or against the spirit of the library) or have I simply
> overlooked something. My idea was that there is something like an HTMemoryStream
> or such. Of course, I could use one of streams that write to a file and read the file
> back into memory, but that seems very clumsy to me.
> 
> I would greatly appreciate any suggestions or pointers to the documentation.

There are two ways you can do that - depending on what you want:

1) You can use the HTXParse stream (look into HTXParse.html). This provides a 
unlimited buffering of the input. This is the approach used by Arena that has 
its own HTML parser.

2) You can use the HTBufWrite stream in the HTConLen module. This stream 
provides a max size buffer. This is used, for example, when calculating 
content length of a document. You can see an example of this in the Line Mode 
Browser.

-- 

Henrik Frystyk Nielsen, <frystyk@w3.org>
World-Wide Web Consortium, MIT/LCS NE43-356
545 Technology Square, Cambridge MA 02139, USA