Decoder: GetChars

GetChars

Returns the decoded unicode characters from a block of bytes.



 Public Function GetChars(
	  ByRef Bytes ( ) As Byte,
	  ByVal ByteIndex As Long,
	  ByVal ByteCount As Long,
	  ByRef Chars ( ) As Integer,
	  ByVal CharIndex As Long,
	  Optional ByVal Flush As Boolean ) As Long

Parameters

Bytes
[ByRef] Byte. The bytes to be used in decoding to characters.
ByteIndex
[ByVal] Long. The starting index to begin decoding bytes into characters.
ByteCount
[ByVal] Long. The number of bytes to be used in the decoding process.
Chars
[ByRef] Integer. The output array for the decoded unicode characters.
CharIndex
[ByVal] Long. The starting index in the array to begin storing characters.
Flush
[ByVal] Optional. Boolean. Tells the Decoder to clear any state after the call.

Return Values

Long -  The number of characters actually decoded.

Remarks

GetChars converts an array of bytes into Unicode characters. Since Unicode characters could span a boundry between calls the method will store any state needed to resume converting characters in the next call. This allows for unknown chunks of data to be to converted without needed to enure each chunk contains complete characters. A typical scenario would be streaming data from a network.

Because there is state stored between calls, the caller must inform the method that the last chunk of data is being processed so the method can correctly account for any state that might have persisted. This is achieved by passing True for the Flush parameter.

See Also

Project CorLib Overview

Class Decoder Overview