Returns the character format of the stream.
Namespace:
Quanser.CommunicationsAssembly: Quanser.Communications (in Quanser.Communications.dll)
Syntax
Visual Basic (Declaration) |
---|
Public Function GetCharacterFormat As Stream..::.CharacterFormat |
C# |
---|
public Stream..::.CharacterFormat GetCharacterFormat() |
Visual C++ |
---|
public: Stream..::.CharacterFormat GetCharacterFormat() |
JavaScript |
---|
function getCharacterFormat(); |
Return Value
The character format in use for the underlying communication channel.Remarks
Returns the character format of the stream. If the character format has not yet been determined then CharacterFormat.Auto is returned. Otherwise the character format detected or set manually is returned.
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 determines the character format with the underlying communication channel.
C# | Copy Code |
---|---|
Stream.CharacterFormat format = stream.GetCharacterFormat(); Console.WriteLine("Character format is " + format); |
Visual Basic | Copy Code |
---|---|
Stream.CharacterFormat format = stream.GetCharacterFormat() Console.WriteLine("Character format is " & format); |
Visual C++ | Copy Code |
---|---|
Stream::CharacterFormat format = stream->GetCharacterFormat(); Console::WriteLine("Character format is " + format); |
Exceptions
Exception | Condition |
---|---|
Quanser.Communications..::.StreamException | If the character format cannot be determined then an exception is thrown. This situation should never occur unless the underlying stream has been closed. |