function Read(var Buffer; ACount: Longint): Longint; override;
function Write(const Buffer; ACount: Longint): Longint; override;
function Seek(AOffset: Longint; AOrigin: Word): Longint; override;
procedure LoadFromStream(AStream: TStream);
procedure SaveToStream(AStream: TStream);
procedure LoadFromFile(const FileName: string);
procedure SaveToFile(const FileName: string);
procedure SetSize(ANewSize: Longint); override;
procedure Clear;
procedure Dequeue(ACount: Longint); //<Removes a specified number of bytes from the queue. @param(ACount The number of bytes to remove from the queue.)
procedure Enqueue(const Buffer; ACount: Longint); //<Adds a specified number of bytes from a given buffer to the end of the queue. @param(Buffer The buffer containing the data to enqueue.) @param(ACount The number of bytes to enqueue from the buffer.)
procedure Lock(AOffset, ASize: Longint); //<Restricts the visible area of the stream. @param(AOffset is the starting position of the area.) @param(ASize The size of the area.)
procedure Unlock; //<Removes the restrictions from the stream and resets the visible area to the original size.
property Memory: Pointer read FMemory;
end;
{ TStreamWrapper }
{The @name is just a placeholder for the type used in the
@link(TStreamWrapper). It is currently in place to work around a problem with
constructor Create(AStream: TStreamType; AOwnsStream: Boolean = True); //<Creates a new instance of @classname. @param(AStream The underlying stream to perform the actual operations on.) @param(AOwnsStream Defines wheather to free the stream on destruction of @classname or not. Defaults to @false.)
destructor Destroy; override; //<Is called when the current instance of @classname is destroyed. If it owns the underlying stream it is destroyed aswell.
protected
FStream: TStream;
FOwnsStream: Boolean;
function GetStream: TStreamType;
procedure SetStream(AStream: TStreamType);
public
property Raw: TStreamType read GetStream write SetStream; //<Provides raw access to the underlying stream. Useful for manipulation of the stream position and other class specific calls.
function ReadBoolean: Boolean; //<Implementation of @link(IStream.ReadBoolean).
function ReadByte: Byte; //<Implementation of @link(IStream.ReadByte).
function ReadCardinal: Cardinal; //<Implementation of @link(IStream.ReadCardinal).
function ReadInteger: Integer; //<Implementation of @link(IStream.ReadInteger).
function ReadInt64: Int64; //<Implementation of @link(IStream.ReadInt64).
function ReadSmallInt: SmallInt; //<Implementation of @link(IStream.ReadSmallInt).
function ReadWord: Word; //<Implementation of @link(IStream.ReadWord).
function ReadString: string; //<Implementation of @link(IStream.ReadString).
function ReadStringFixed(ALength: Integer): string; //<Implementation of @link(IStream.ReadStringFixed).
procedure WriteBoolean(AValue: Boolean); //<Implementation of @link(IStream.WriteBoolean).
procedure WriteByte(AValue: Byte); //<Implementation of @link(IStream.WriteByte).
procedure WriteCardinal(AValue: Cardinal); //<Implementation of @link(IStream.WriteCardinal).
procedure WriteInteger(AValue: Integer); //<Implementation of @link(IStream.WriteInteger).
procedure WriteInt64(AValue: Int64); //<Implementation of @link(IStream.WriteInt64).
procedure WriteSmallInt(AValue: SmallInt); //<Implementation of @link(IStream.WriteSmallInt).
procedure WriteWord(AValue: Word); //<Implementation of @link(IStream.WriteWord).
procedure WriteString(AValue: string); //<Implementation of @link(IStream.WriteString).
procedure WriteStringFixed(AValue: string; ALength: Integer); //<Implementation of @link(IStream.WriteStringFixed).
function Read(ABuffer: PByte; ACount: Cardinal): Cardinal; //<Implementation of @link(IStream.Read).
function Write(ABuffer: PByte; ACount: Cardinal): Cardinal; //<Implementation of @link(IStream.Write).
procedure Skip(ACount: Cardinal); //<Implementation of @link(IStream.Skip).
end;
{@name is used to have a progress (see @link(TOnProgressEvent)) for a copy
action of the content of one stream into another. This is especially useful
for writing and reading to @link(TFileStream).
@param(ASource The stream from which the content is copied.)
@param(ATarget The stream to which the content is copied.)
@param(ACount Specifies the amount to copy. 0 means, that the whole stream is processed.)
@param(AOnProgress The callback for the @link(TOnProgressEvent). Defaults to @nil.)