Topic Path: Symbol Reference > Classes > TIdBuffer Class > TIdBuffer Methods > ExtractToBytes Method
ContentsIndexHome
PreviousUpNext
TIdBuffer.ExtractToBytes Method

Reads and optionally removes byte values from the internal storage for the buffer.

procedure ExtractToBytes(
    var VBytes: TIdBytes; 
    AByteCount: Integer = -1; 
    AAppend: Boolean = True; 
    AIndex: Integer = -1
);
Parameters 
Description 
VBytes 
Storage for values extracted from the buffer.
 
AByteCount 
Number of bytes requested from the buffer. Default value is -1.
 
AAppend 
Causes bytes from the buffer to be appended to the byte storage. Default value is True.
 
AIndex 
Initial position where extracted bytes are stored in the data type. Default value is -1. 

ExtractToBytes is a procedure used to copy and optionally remove values from the internal storage for the buffer into a TIdBytes data type. 

VBytes is the TIdBytes data type to use as storage for values extracted from the buffer. 

AByteCount indicates the number of bytes requested from the buffer. The default value is -1, and causes the number of bytes in Size to be extracted into VBytes. When AByteCount contains a positive non-zero value, the requested number of bytes must already exist in the buffer or an EIdNotEnoughDataInBuffer will be raised. 

AAppend indicates if bytes from the buffer should be appended to any existing values found in VBytes. The default value is True, and causes VBytes to be resized to accomodate the additional number of bytes required in Size or AByteCount. 

AIndex marks the initial position where bytes extracted from the buffer are stored in VBytes. The default value is -1, and indicates that byte values should be stored sequentially starting at the lowest position in the VBytes byte array. This value also causes the requested number of bytes to be Removed from the contents of the buffer using the Remove method. When AIndex contains zero or a positive value, the existing content in the buffer is not removed after the copy operation. 

ExtractToBytes calls the CopyTIdBytes routine to perform the copy operation required for the method.

Exceptions 
Description 
Raised when the buffer does not contain enough data for the requested number of bytes. 
Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.