Articles   Members Online: 3
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to implement TCollection.SaveToStream Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
30-Aug-02
Category
Others
Language
Delphi 2.x
Views
38
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

I need to implement a streaming capability for a TCollection class object. Is there 
anyone who knows how to do it?

Answer:

I do it via the following two utility procedures:

1   procedure ReadCollection(s: TStream; c: TCollection);
2   var
3     Reader: TReader;
4   begin
5     Reader := TReader.Create(s, 1024);
6     try
7       Reader.ReadValue; {collection marker}
8       Reader.ReadCollection(c);
9     finally
10      Reader.Free;
11    end;
12  end;
13  
14  procedure WriteCollection(s: TStream; c: TCollection);
15  var
16    Writer: TWriter;
17  begin
18    Writer := TWriter.Create(s, 1024);
19    try
20      Writer.WriteCollection(c);
21    finally
22      Writer.Free;
23    end;
24  end;


Both procedures assume that the stream has been created and positioned correctly.

			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC