Stream extensions

streamex implements some extensions to be used together with streams from the classes unit.

TStream, Treader and TWriter classes Binary component stream reader with BiDi support TBidirBinaryObjectReader is a class descendent from TBinaryObjectReader, which implements the necessary support for BiDi data: the position in the stream (not available in the standard streaming) is emulated. Position in the stream Position exposes the position of the stream in the reader for use in the class. Binary component stream writer with BiDi support TBidirBinaryObjectReader is a class descendent from TBinaryObjectWriter, which implements the necessary support for BiDi data. Position in the stream Position exposes the position of the stream in the writer for use in the class. Stream reader with BiDi Support TDelphiReader is a descendent of TReader which has support for BiDi Streaming. It overrides the stream reading methods for strings, and makes sure the stream can be positioned in the case of strings. For this purpose, it makes use of the driver class. Return the driver class as a TBidirBinaryObjectReader class GetDriver simply returns the used driver and typecasts it as TBidirBinaryObjectReader class. The driver instance. Overrides the standard ReadStr method ReadStr makes sure the methods are used, to store additional information about the stream position when reading the strings. String read from stream Read data from stream Read reads raw data from the stream. It reads Count bytes from the stream and places them in Buf. It forces the use of the class when reading. Buffer to contain the data Number of bytes to read from the stream Position in the stream Position in the stream. Stream writer with BiDi Support TDelphiWriter is a descendent of TWriter which has support for BiDi Streaming. It overrides the stream writing methods for strings, and makes sure the stream can be positioned in the case of strings. For this purpose, it makes use of the driver class. Return the driver class as a TBidirBinaryObjectWriter class GetDriver simply returns the used driver and typecasts it as TBidirBinaryObjectWriter class. The driver instance Flushes the stream buffer FlushBuffer flushes the internal buffer of the writer. It simply calls the FlushBuffer method of the driver class. Write raw data to the stream Write writes Count bytes from Buf to the buffer, updating the position as needed. Buffer containing data to write Number of bytes to write Write a string to the stream WriteStr writes a string to the stream, forcing the use of the class methods, which update the position of the stream. String to write Write value type WriteValue overrides the same method in TWriter to force the use of the methods, which update the position of the stream. Value to write to stream Position in the stream Position exposes the position in the stream as exposed by the instance used when streaming. Helper for stream classes, introducing some endianness methods TStreamHelper is a TStream helper class which introduces some helper routines to read/write multi-byte integer values in a way that is endianness-safe. TStream Read a Word from the stream, little endian ReadWordLE reads a word from the stream, little-endian (LSB first). If not enough data is available an EReadError exception is raised. The word value Read a DWord from the stream, little endian ReadWordLE reads a DWord from the stream, little-endian (LSB first). If not enough data is available an EReadError exception is raised. The DWord value Read a QWord from the stream, little endian ReadWordLE reads a QWord from the stream, little-endian (LSB first). If not enough data is available an EReadError exception is raised. The QWord value Write a word value, little endian WriteWordLE writes a Word-sized value to the stream, little-endian (LSB first). If not all data (2 bytes) can be written, an EWriteError exception is raised. The word value to write to stream Write a DWord value, little endian WriteDWordLE writes a DWord-sized value to the stream, little-endian (LSB first). If not all data (4 bytes) can be written, an EWriteError exception is raised. DWord value to write Write a QWord value, little endian WriteQWordLE writes a QWord-sized value to the stream, little-endian (LSB first). If not all data (8 bytes) can be written, an EWriteError exception is raised. QWord value to write Read a Word from the stream, big endian ReadWordBE reads a word from the stream, big-endian (MSB first). If not enough data is available an EReadError exception is raised. The word value Read a DWord from the stream, big endian ReadWordBE reads a DWord from the stream, big-endian (MSB first). If not enough data is available an EReadError exception is raised. The DWord value Read a QWord from the stream, big endian ReadWordBE reads a QWord from the stream, big-endian (MSB first). If not enough data is available an EReadError exception is raised. The QWord value Write a word value, big endian WriteWordBE writes a Word-sized value to the stream, big-endian (MSB first). If not all data (2 bytes) can be written, an EWriteError exception is raised. The word value to write to stream Write a DWord value, big endian WriteDWordBE writes a DWord-sized value to the stream, big-endian (MSB first). If not all data (4 bytes) can be written, an EWriteError exception is raised. DWord value to write Write a QWord value, big endian WriteQWordBE writes a QWord-sized value to the stream, big-endian (MSB first). If not all data (8 bytes) can be written, an EWriteError exception is raised. QWord value to write