Internals - Stream Modules

# Stream Modules

A stream is an object which accepts sequences of characters. It is a destination of data which can be thought of much like an output stream in C++ or an ANSI C-file stream for writing data to a disk or another peripheral device. The Library defines a generic stream class in the HTStream module, but almost all stream modules define their own sub class definition of the stream object.

## Protocol Streams

These are normally internal streams that parses or generates protocol specific information to communicate with remote servers.

HTTP Request Stream
  This stream is one of the first real protocol streams - more are to come!

## Converters and Presenters

Streams that can be used to convert data from one media type to another or create a graphic object and present it to the user. These are streams that save the data to a local file and then calls an external program, for example a postscript viewer. These are normally initialized as a application preference.

SGML Tokenizer
  Parses the data and generates a structured stream. Each parser instance is created with reference to a particular DTD structure.
Plain to HTML Converter
  This stream takes a plain file and converts it into HTML. Like the SGML tokenizer, it also converts a generic stream into a structured stream.
Plain Text Presentation
  Takes plain ASCII text and presents it to the user as preformatted text.
HTTP/MIME header parser
  Parse a MIME format message and puts all the information in an Anchor object
WAIS source file Stream
  Parses a WAIS source description file. By default, this is enabled even if direct WAIS access is not present (no linking with the freeWAIS library).
Guessing Stream
  If the input format is unknown at the time when putting up a stream stack, then this module scans a part of the stream and on a statistical basis determines the type of stream needed from the content-type.
External Parser with Call back
  This is a call back stream module where the implementation is defined in the application and not in the Library.
Save Locally
  The HTSaveLocally stream saves the data object to a local file.
Save Locally and Execute Application
  The HTSaveAndExecute stream saves the data object to a local file and calls an external application, for example a post script viewer.
Save Locally and Execute Application
  The HTSaveAndCallBack stream saves the data object to a local file, calls an external application and when the stream is freed, the libwww application gets called with a specified call back function.

## I/O Streams

Streams that can write data to a socket or an ANSI C FILE object. This can be used when redirecting a request to a local file of when saving a document in the cache.

ANSI C File Writer stream
  Writes to an ANSI C FILE * object, as opened by fopen, etc.
Cache Writer Stream
  This is the stream that's used by the cache manager
Socket Writer Stream
  Writes to a socket or something opened with the UNIX file I/O open function.
Net to Text Converter
  Converts "Net ASCII" line terminators `<CRLF>` into the equivalent C representation which is a '\n'.

## Basic Streams

A set of basic utility streams with no or little internal contents but required in order to cascade streams.

Tee Stream
  Just writes into two streams at once. Useful for taking a copy for a cache.
Black Hole
  A quite expensive way of piping data into a hole for then to be forgotten forever.
Through Line
  A short circuited stream that returns the same output sink as it is called with.