Converts an array of byte values to its representation as a Word data type.
function BytesToWord( const AValue: TIdBytes; const AIndex: Integer = 0 ): Word;
Parameters |
Description |
AValue |
Byte values to convert to a Word. |
AIndex |
Initial position in the array of bytes to use when converting bytes value to the ordinal data type. Default value is 0. |
Word - Word representation for the byte values.
BytesToWord is a Word function used to convert the byte values in AValue to its representation as a Word data type.
AIndex is a zero-based offset that indicates the initial byte position in the array of bytes to use when converting bytes value to the ordinal data type. The default value is 0.
Please note that AValue must have an allocated length large enough to store the required number of bytes for the ordinal data type starting at the specified offset. When AValue is too small, an EAssertionFailed exception will be raised and the return value for the function is the value 0 (zero).
For the .Net platform, the ToUInt16 method is called from the FCL System.BitConverter class to prepare the return value for the function using the specified offset into the array of bytes.
For all other platforms where pointer operations are supported, the return value is derived by casting and de-referencing a pointer for the ordinal data type using the specified offset into the array of bytes.
Exceptions |
Description |
EAssertionFailed |
Raised when the array of bytes is too small to provide the required number of bytes for the ordinal data type at the specified offset into the array of bytes. |
Internet Direct (Indy) version 10.1.5
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved. Website http://www.indyproject.org. Post feedback to the Indy Documentation newsgroup. |