wiki:ICryptoolStreamUsage

Version 2 (modified by Matthäus Wander, 12 years ago) (diff)

work in progress

CStream is a replacement for the now obsolete CryptoolStream class. With CStream a plugin can pass data as byte stream to other plugins.

Features:

  • Supports 0..n concurrent readers on one CStream
  • Clean separation between writer and reader -- reading plugins can't disturb the writing plugin or other reading instances
  • Does not forget data -- new readers can be created at any time and support random seeking
  • Uses internal byte array as underlying buffer and switches automagically to a temporary file, if data exceeds a certain size
  • Supports the .NET Dispose pattern, but does not require you to use it -- the garbage collector will clean up for you
  • Supports chunked streaming -- receivers can read and process data even if the sender has not finished writing
  • Supports POSIX-like Read() and offers also a more convenient ReadFully()

How to use CStreamWriter

source:/trunk/Documentation/Developer/CStream/CStreamWriter.png

  • Create a CT2 output property with type CStream
  • In Execute() create a new CStreamWriter. Set the output property TODO: FINISH
  • In Execute() either: # Create a CStreamWriter and pass subsequently one or more byte[] in Write() calls. Finish stream with Close(). # Create a CStreamWriter, pass an existing byte[] in constructor and set autoClose to true.

How to use CStreamReader

source:/trunk/Documentation/Developer/CStream/CStreamReader.png