Configures whether the methods that send and receive characters convert between the local character format and another character format when reading and writing to the underlying communication channel.

Namespace:  Quanser.Communications
Assembly:  Quanser.Communications (in Quanser.Communications.dll)

Syntax

Visual Basic (Declaration)
Public Sub SetCharacterFormat ( _
	format As Stream..::.CharacterFormat _
)
C#
public void SetCharacterFormat(
	Stream..::.CharacterFormat format
)
Visual C++
public:
void SetCharacterFormat(
	Stream..::.CharacterFormat format
)
JavaScript
function setCharacterFormat(format);

Parameters

format
Type: Quanser.Communications..::.Stream..::.CharacterFormat
The character format to use for the underlying communication channel. The local character format is converted to and from this format when communicating with the peer. If the format is set to CharacterFormat.Auto then the stream will look for a Unicode BOM character as the first character received in order to determine the character format to use.

Remarks

This method may be used to cause the Stream object to convert between character formats when sending and receiving characters (or arrays of characters).

Character format conversions are only necessary when communicating between platforms that use a different character format. For example, Unix systems may use UTF-32 or UTF-8 wide characters while Windows uses UTF-16 wide characters. By default, the character format is assumed to be the same as the local character format.

Examples

This example configures the stream to use UTF-32 characters.
C# Copy Code
stream.SetCharacterFormat(Stream.CharacterFormat.Utf32);
Visual Basic Copy Code
stream.SetCharacterFormat(Stream.CharacterFormat.Utf32)
Visual C++ Copy Code
stream->SetCharacterFormat(Stream::CharacterFormat::Utf32);

Exceptions

ExceptionCondition
Quanser.Communications..::.StreamException If the character format cannot be configured then an exception is thrown. This situation should never occur unless the underlying stream has been closed.

See Also