THKStreams v1.0 by Harry Kakoulidis 12/1999
kcm@mailbox.gr
http://kakoulidis.homepage.com

This is Freeware. Please copy HKStrm10.zip unchanged.
If you find bugs, have options etc. Please send at my e-mail.

The use of this component is at your own risk.
I do not take any responsibility for any damages.

HKStreams is a component that enables you to easily save and load many streams into one file. The streams can be stored with LHA compression if wanted, and can also be encrypted with blowfish. THKStreams is also smart, if you load afterwards an encrypted or compressed (or both) file, it will now how to read it, and can also call your event that asks the user for a password if needed. Source and EXE demo included.

Installation
------------
Add to a package both pas units. The component will be registered to a page HAKA. Change if you want.

Example
-------
Please follow the example for an easy to follow implentation. Few of the following are needed to do a simple job.


Published
---------
*** Compressed : will the file be saved with compression?
*** Encrypted : will it be encrypted?
*** Key : Password if encrypted
*** OnAskForKey : Event triggered if THKStreams encounters a encrypted file. It is a function that you should return a password. For example opening a dialog box that asks the user a password.


Public
------
*** StreamList : it is a StringList with all of your ID's. The objects point to the corresponding streams.


Runtime procedures
------------------
*** Procedure LoadFromFile(const Filename : string);
*** Procedure SaveToFile(const Filename : string);
*** Procedure LoadFromStream(ms : TStream);
*** Procedure SaveToStream(ms : TStream);

Easy to understand

*** Procedure AddStream(Const ID : string; Source : TStream);
*** Procedure RemoveStream(Const ID : String);
*** Procedure GetStream(Const ID : string; Dest : TStream);

Procedures to add/remove/retrieve streams. Notice that you have to pass a string that identifies the stream in the list. ID's are case sensitive

*** Procedure ClearStreams;
Frees all streams. 


Notes
-----
All the I/O seems to work fine, and I have tested it with large files to. However, because I haven't done a great job in the LoadFromFile & Savetofile procedures, saving and loading need's triple the memory of the size of the file. So you might have problems with a very big file (>30mb). Try in this case breaking it down to more files.

