unit uFileStreamTx;

interface

uses Classes, SysUtils;

type
  TFileStreamTx = class(TFileStream)
  private
    asStream : TStringStream;
  public
    Constructor Create(const FileName: string; Mode: Word);
    Destructor Destroy; override;
    function ReadLine(): string;
    procedure WriteLine(const sLine : String);
  end;

implementation

{ TFileStreamTx }

const
  iDelta = 4096;

constructor TFileStreamTx.Create(const FileName: string; Mode: Word);
begin
  inherited Create(FileName, Mode);
end;

destructor TFileStreamTx.Destroy;
begin
  FreeAndNil(asStream);
  inherited;
end;

function TFileStreamTx.ReadLine: string;
var
  iIndex : Integer;
  astr : String;
begin
  Read(astr, iDelta);
  asStream := TStringStream.Create(astr);
  iIndex := 1;
  while (asStream.DataString[iIndex] <> #13) do
    Inc(iIndex);
  Inc(iIndex);
  Result := asStream.ReadString(iIndex);
end;

procedure TFileStreamTx.WriteLine(const sLine: String);
begin

end;

end.
 