Contents - Index - Previous - Next


OnGetNextBuffer Event 

 

Applies to

TVCLUnZip component

 

Declaration

property OnGetNextBuffer: TGetNextBuffer = procedure(Sender: TObject; var Buffer: PChar; FName: string; AmountUsed: LongInt; BufferNum: Integer; var Quit: Boolean); of object;

 

 

Description

Before this event can be called, BufferLength must be set to a value greater than zero.  

When unzipping to a memory buffer, if your BufferLength is smaller than the uncompressed size of the file being processed, this event will be called to:  

 

1. Pass you the buffer that was just processed in the Buffer parameter so that you may do whatever you need to do with it.  The AmountUsed parameter will contain the amount of bytes that were written to the buffer.  AmountUsed will typically be the same as BufferLength except for the end of the file which may not fill up the buffer. 

 

2. Allow you to pass back a new buffer pointer, also in the Buffer parameter.  You don't have to change the Buffer pointer if you wish the same buffer to be used again.  If you wish to change the length of the buffer you can by resetting the BufferLength property to a new value. 

 

Also passed to you by this event are:  

 

FName The name of the file associated with the processing of this buffer at this time.  

BufferNum The sequential number of this buffer being passed in for this file.  The first buffer is number 1.  

Quit If this is passed to you as True then this is the last buffer to be processed for this file.  You may also set this to True at any time to stop processing on the current file.  If you do this then a EUserCanceled exception will be thrown that you may wish to trap.  

  

For an example see  BufferLength.