Re: Streams
- From: Nicholas Sherlock <n_sherlock@xxxxxxxxxxx>
- Date: Tue, 30 Aug 2005 08:02:33 +1200
Richard wrote:
I have a typical text file that I have been writing to disk. Afterwards, I zip it up and delete the original.txt file.
Would I be better off writing it to a stream, then using compression routines that support compressing streams then writing to disk. Seems it would speed things up somewhat. We are talking 6 meg text files here.
It would be much tidier, but not necessarily faster - Windows may never actually dump the file to disk during your current method.
Are there any simple examples how to write a text file to a Stream?
That depends on how you want to build the file. I'd:
list:tstringlist; stream:tmemorystream;
stream:=tmemorystream.create;
try
list:=tstringlist.create;
try
list.add('Hello!');
list.add('Line 2');
list.savetostream(stream);
stream.seek(0,sofrombeginning); //rewind before compressing
docompress(stream);
finally
list.free;
end;
finally
stream.free;
end;Cheers, Nicholas Sherlock .
- Follow-Ups:
- Re: Streams
- From: Richard
- Re: Streams
- References:
- Streams
- From: Richard
- Streams
- Prev by Date: Streams
- Next by Date: Re: Help command
- Previous by thread: Streams
- Next by thread: Re: Streams
- Index(es):
Relevant Pages
|