Skip to content

Latest commit

 

History

History
23 lines (12 loc) · 1.52 KB

PJStreamWrapper.md

File metadata and controls

23 lines (12 loc) · 1.52 KB

PJStreamWrapper Unit

Project: Stream Extension Classes

Applies to: ~>3.0

Description

This unit defines TPJStreamWrapper which is a base class for descendants that "wrap" TStream instances to provide a filter or to add functionality.

The wrapped TStream instance is used to do physical i/o. TPJStreamWrapper simply replicates the facilities in the wrapped stream. It is for descendant classes to add functionality.

Declarations

Optional Conditionally Defined Symbol [~>3.1]

There is an error in TStringStream's Seek implementation that occurs only in non-Unicode versions of the Classes unit. Calls to Seek using the soFromEnd origin incorrectly handle offsets: positive offsets move back from the end of the stream. This behaviour is the opposite of all other stream classes which require a negative offset to move back from the end of the stream. Note that Unicode implementations of TStringStream do not have this error.

By default TPJStreamWrapper fixes this problem and all wrapped streams behave correctly and in the same way.

If you prefer this bug to be replicated in wrapped TStringStream classes, or if this change in behaviour from earlier versions of TPJStreamWrapper may break existing code, you can revert to the earlier behaviour by commenting out the FIX_TSTRINGSTREAM_SEEK_ERROR defined symbol in the unit source code.