Encoder: GetByteCount

GetByteCount

Returns the number of encoded bytes the set of characters would produce.



 Public Function GetByteCount(
	  ByRef Chars ( ) As Integer,
	  ByVal Index As Long,
	  ByVal Count As Long,
	  ByVal Flush As Boolean ) As Long

Parameters

Chars
[ByRef] Integer. The set of characters that would be used to produce the encoded bytes.
Index
[ByVal] Long. The first character in the array to begin the encoding count.
Count
[ByVal] Long. The number of characters to be included in the encoding count.
Flush
[ByVal] Boolean. True to simulate clearing the internal state of the encoder after the calculation; otherwise, False.

Return Values

Long -  The number of bytes produced by encoding the specified characters and any characters in the internal buffer.

Remarks

This method does not affect the state of the encoder.

To calculate the exact array size that GetBytes requires to store the resulting bytes, the application should use GetByteCount.

If GetBytes is called with Flush set to False, the encoder stores trailing characters at the end of the data block in an internal buffer and uses them in the next encoding operation. The application should call GetByteCount on a block of data immediately before calling GetBytes on the same block, so that any trailing characters from the previous block are included in the calculation.

See Also

Project CorLib Overview

Class Encoder Overview