e-CryptIt Engine - Compression Xojo Plugin |

# ZStream.Constructor Constructor (console safe)

One of two constructors for the ZStream class.

Constructor(
write as Boolean,
writer as IStreamWriter,
reader as IStreamReader)

#### Parameters

write
  True if the stream is in write mode.
writer
  A reference to a object that implements the IStreamWriter Interface. Pass nil to this parameter if you are not doing in memory compression.
reader
  A reference to a object that implements the IStreamReader Interface. Pass nil to this parameter if you are not doing in memory decompression.

#### Remarks

When using the reader parameter for in memory decompression or the writer parameter for in memory compression then you may not use the Seek method on the stream because neither IStreamWriter nor IStreamReader has any ability to do Seek or any such positioning.
Power user material:
You only use either the writer or the reader at the same time, the other one should be nil. You use the writer for compressing and the reader for decompressing.
You will get a fatal error if you pass nil to the f, parameter and if you pass nil to the writer parameter when compressing to a IStreamWriter and also if you pass nil to the reader parameter when decompressing to a IStreamReader. In future version we will catch this fatal error by throwing a Exception when such incorrect data is passed to the parameters.
When decompressing from a IStreamReader then the ZStream will never request more than 16384 bytes at each round. (Except if you for some reason put higher number than that in the Read function). The term rounds here means that before each call to the Read function you must have ensured that you have at least 16384 bytes avalible in the class that implements the IStreamReader Interface, and the same goes for when you construct the class then you must have at least one such buffer avalible.

#### See Also

ZStream Class