Aztec® Programming Language
Version 1.1 Alpha 2

Copyright © 2010-2017, Aztec Development Group, All Rights Reserved

Download Aztec

Search        Contact Us

Well I've been sleepin' in the hotel doorway...

And tonight they say it's gonna rain.

- Jim Croce

public class TextStream from<FilterStream>





The TextStream class is an example of a "filter stream", which requires another stream to operate on. TextStream does not have its own data source like FileStream or SocketStream. It requires the use of another stream, and for reading purposes, it simply performs a type of filtering on the data from that stream.


In the case of TextStream, it filters incoming text characters looking for a line feed (string.LF) or a carriage return (string.CR) and LF combination. A single ReadRecord request will cause a single ASCII text "record" to be returned. If there is no LF or CR/LF by the time the end of stream is encountered, the entire set of characters is returned as a single text record. For efficiency purposes, the class also performs its own level of data buffering internally.


For write operations, a single text record is written to the stream appended by an LF or CR/LF combination.


Note that the ReadRecord() and WriteRecord() methods can be used together with the lower level Read() and Write() methods in FilterClass. Typically a stream will either be all text or all binary, but this model also supports any combination of binary and text together in a stream.

TextStream Methods

TextStream() Constructor for the TextStream class using an associated stream
ReadRecord() Reads a single text record from the associated stream
WriteRecord() Writes a single text record to the associated stream

Derived Classes

See Also



public method TextStream(StreamIO AssociatedStream)



Stream object associated with this filter stream

Return Value



Constructor for the TextStream class. The associated stream is passed in. All read and write operations performed on this filter stream will be performed against the associated stream.


TextStream Class


public method<string> ReadRecord(bool PeekOnly = false)



If true, read without advancing pointer

Return Value

Returns the next text record


This method reads the next text record from the associated stream. It reads characters until an LF character is reached, or a CR/LF combination. It stops reading at that point and returns the single text record preceding the line feed. It also supports the standard "PeekOnly" flag.


If the "associated stream" is specified as "Write", this method will fire a StreamException.


TextStream Class


public method WriteRecord(string TextRecord, bool UseCR = true)



Text string to be written

Return Value



This method writes a single text string to the associated stream as an ASCII "record". It writes the text string to the stream, followed by a line feed character. If the "UseCR" flag is true, it also places a carriage return character before the line feed (CR/LF versus LF).


If the "associated stream" is specified as "Read", this method will fire a StreamException.


TextStream Class


Copyright © 2010-2017

Aztec Development Group

All Rights Reserved

Download Aztec