unit buffers_export; {$M+} interface uses buffers, classes; // TODO seekable or at least resetable? type TTextBufferStream = class(TStream) private fBlock : ITextBufferBlockIterator; fItem : TTextBufferBlockIteratorItem; public destructor Destroy; override; function Read(var Buffer; Count: Longint): Longint; override; // function Write(const Buffer; Count: Longint): Longint; override; published constructor Create(aBlock : ITextBufferBlockIterator); end; implementation destructor TTextBufferStream.Destroy; begin inherited Destroy; end; constructor TTextBufferStream.Create(aBlock : ITextBufferBlockIterator); begin fBlock := aBlock; fItem := nil; end; function TTextBufferStream.Read(var Buffer; Count: Longint): Longint; begin fItem := fBlock.Next; // FIXME not always. depends on requested block size. if not Assigned(fItem) then begin // EOF. Result := 0; Exit; end; Move(fItem.Beginning, Buffer, fItem.Size); // FIXME not always. Result := fItem.Size; // TODO. end; { // TODO Write Procedure TTextBufferStream.SetSize(NewSize: Longint); Procedure TTextBufferStream.SetSize(const NewSize: Int64); function TTextBufferStream.Seek(const Offset: Int64; Origin: TSeekOrigin): Int64; raise EFOpenError.Createfmt(SFOpenError,[AFilename]); } end.