Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Streaming Iterators

Tango has a set of classes to split streaming text into elements matching a specific pattern. These classes operate upon an InputStream, and are templated for char, wchar, and dchar data types. For example, there’s an iterator for producing lines of text based upon finding embedded end-of-line markers. Iterator classes are clients of Buffer, and can therefore be mixed with reader and/or writer clients also.

Iterator results are usually aliased directly from the containing buffer, thus avoiding heap activity where an application doesn’t need it. Where the resultant element is to be retained by the application, it should be copied before continuing.

Iterator Exceptions

An overflow exception is thrown where the size of a single element is larger than the containing buffer. Either the containing buffer is too small, or the element is overly large (a typical IO buffer is eight or sixteen kilobytes in size). Increase the buffer size to accommodate huge elements.