mdbs99 / james

James is a collection of object-oriented Pascal primitives for Lazarus and Delphi
MIT License
53 stars 20 forks source link

Only one save() method in IDataStream #84

Closed fabriciofx closed 6 years ago

fabriciofx commented 6 years ago

Nowadays, IDataStream has 3 save() methods:

function Save(Stream: TStream): IDataStream; overload;
function Save(Strings: TStrings): IDataStream; overload;
function Save(const FileName: string): IDataStream; overload;

So, my suggestion is to have only one save() method, like this:

function Save(Stream: TStream): IDataStream; overload;

When we want to save to a file, we can do something like it:

IDataStream ds = TDataStream.New();
ds.Save(TFileStream.New());

and, to save to strings, we can do something like it:

IDataStream ds = TDataStream.New();
ds.Save(TStringsStream.New());