-
-
Notifications
You must be signed in to change notification settings - Fork 1
BZip2.Compressor.Compress
BZip2.Compressor.Compress
Function Compress(ReadFrom As Readable, WriteTo As Writeable, ReadCount As Integer = -1) As Boolean
Name | Type | Comment |
---|---|---|
ReadFrom | Readable |
The stream from which to read uncompressed data. |
WriteTo | Writeable |
The stream to which compressed data will be written. |
ReadCount | Integer |
Optional. If specified, the number of uncompressed bytes to read. |
This method processes uncompressed bytes from ReadFrom
into the compressor, and writes any compressed bytes that were emitted to WriteTo
. If ReadCount
is specified then exactly ReadCount
uncompressed bytes are read; otherwise uncompressed bytes will continue to be read until ReadFrom.EOF=True
.
The unprocessed portion of the input is retained by the compressor until a subsequent call to this method.
BZip2
does not necessarily consume uncompressed data immediately. The "sliding window" determines the size of the compression buffer, and the size of the compression buffer determines how many uncompressed bytes have to be consumed in order to emit one or more compressed bytes.
If the compressor needed more uncompressed bytes than were provided then zero bytes will be emitted and Avail_Out
will be >0
. Call Compress
again with more uncompressed bytes until Avail_Out=0
. If there are no more uncompressed bytes then call Compressor.Finish.
Wiki home | Project page | Bugs | Become a sponsor
Text and code examples are Copyright ©2018-24 Andrew Lambert, offered under the CC BY-SA 3.0 License.