mscorlib(4.0.0.0) API with additions
System.Text.Decoder Class Referenceabstract

Converts a sequence of encoded bytes into a set of characters. More...

Inherited by System.Text.DecoderNLS, System.Xml.SafeAsciiDecoder, System.Xml.Ucs4Decoder, and System.Xml.UTF16Decoder.

Public Member Functions

virtual void Reset ()
 When overridden in a derived class, sets the decoder back to its initial state. More...
 
abstract int GetCharCount (byte[] bytes, int index, int count)
 When overridden in a derived class, calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. More...
 
virtual int GetCharCount (byte[] bytes, int index, int count, bool flush)
 When overridden in a derived class, calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. A parameter indicates whether to clear the internal state of the decoder after the calculation. More...
 
virtual unsafe int GetCharCount (byte *bytes, int count, bool flush)
 When overridden in a derived class, calculates the number of characters produced by decoding a sequence of bytes starting at the specified byte pointer. A parameter indicates whether to clear the internal state of the decoder after the calculation. More...
 
abstract int GetChars (byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)
 When overridden in a derived class, decodes a sequence of bytes from the specified byte array and any bytes in the internal buffer into the specified character array. More...
 
virtual int GetChars (byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex, bool flush)
 When overridden in a derived class, decodes a sequence of bytes from the specified byte array and any bytes in the internal buffer into the specified character array. A parameter indicates whether to clear the internal state of the decoder after the conversion. More...
 
virtual unsafe int GetChars (byte *bytes, int byteCount, char *chars, int charCount, bool flush)
 When overridden in a derived class, decodes a sequence of bytes starting at the specified byte pointer and any bytes in the internal buffer into a set of characters that are stored starting at the specified character pointer. A parameter indicates whether to clear the internal state of the decoder after the conversion. More...
 
virtual void Convert (byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex, int charCount, bool flush, out int bytesUsed, out int charsUsed, out bool completed)
 Converts an array of encoded bytes to UTF-16 encoded characters and stores the result in a character array. More...
 
virtual unsafe void Convert (byte *bytes, int byteCount, char *chars, int charCount, bool flush, out int bytesUsed, out int charsUsed, out bool completed)
 Converts a buffer of encoded bytes to UTF-16 encoded characters and stores the result in another buffer. More...
 

Protected Member Functions

 Decoder ()
 Initializes a new instance of the T:System.Text.Decoder class. More...
 

Properties

DecoderFallback Fallback [get, set]
 Gets or sets a T:System.Text.DecoderFallback object for the current T:System.Text.Decoder object. More...
 
DecoderFallbackBuffer FallbackBuffer [get]
 Gets the T:System.Text.DecoderFallbackBuffer object associated with the current T:System.Text.Decoder object. More...
 

Detailed Description

Converts a sequence of encoded bytes into a set of characters.

Definition at line 11 of file Decoder.cs.

Constructor & Destructor Documentation

◆ Decoder()

System.Text.Decoder.Decoder ( )
protected

Initializes a new instance of the T:System.Text.Decoder class.

Definition at line 80 of file Decoder.cs.

Member Function Documentation

◆ Convert() [1/2]

virtual void System.Text.Decoder.Convert ( byte []  bytes,
int  byteIndex,
int  byteCount,
char []  chars,
int  charIndex,
int  charCount,
bool  flush,
out int  bytesUsed,
out int  charsUsed,
out bool  completed 
)
virtual

Converts an array of encoded bytes to UTF-16 encoded characters and stores the result in a character array.

Parameters
bytesA byte array to convert.
byteIndexThe first element of bytes to convert.
byteCountThe number of elements of bytes to convert.
charsAn array to store the converted characters.
charIndexThe first element of chars in which data is stored.
charCountThe maximum number of elements of chars to use in the conversion.
flushtrue to indicate that no further data is to be converted; otherwise, false.
bytesUsedWhen this method returns, contains the number of bytes that were used in the conversion. This parameter is passed uninitialized.
charsUsedWhen this method returns, contains the number of characters from chars that were produced by the conversion. This parameter is passed uninitialized.
completedWhen this method returns, contains true if all the characters specified by byteCount were converted; otherwise, false. This parameter is passed uninitialized.
Exceptions
T:System.ArgumentNullExceptionchars or bytes is null (Nothing).
T:System.ArgumentOutOfRangeExceptioncharIndex , charCount , byteIndex , or byteCount is less than zero.-or-The length of chars - charIndex is less than charCount .-or-The length of bytes - byteIndex is less than byteCount .
T:System.ArgumentExceptionThe output buffer is too small to contain any of the converted input. The output buffer should be greater than or equal to the size indicated by the Overload:System.Text.Decoder.GetCharCount method.
T:System.Text.DecoderFallbackExceptionA fallback occurred (see Character Encoding in the .NET Framework for fuller explanation)-and- P:System.Text.Decoder.Fallback is set to T:System.Text.DecoderExceptionFallback.

Definition at line 283 of file Decoder.cs.

◆ Convert() [2/2]

virtual unsafe void System.Text.Decoder.Convert ( byte *  bytes,
int  byteCount,
char *  chars,
int  charCount,
bool  flush,
out int  bytesUsed,
out int  charsUsed,
out bool  completed 
)
virtual

Converts a buffer of encoded bytes to UTF-16 encoded characters and stores the result in another buffer.

Parameters
bytesThe address of a buffer that contains the byte sequences to convert.
byteCountThe number of bytes in bytes to convert.
charsThe address of a buffer to store the converted characters.
charCountThe maximum number of characters in chars to use in the conversion.
flushtrue to indicate no further data is to be converted; otherwise, false.
bytesUsedWhen this method returns, contains the number of bytes that were produced by the conversion. This parameter is passed uninitialized.
charsUsedWhen this method returns, contains the number of characters from chars that were used in the conversion. This parameter is passed uninitialized.
completedWhen this method returns, contains true if all the characters specified by byteCount were converted; otherwise, false. This parameter is passed uninitialized.
Exceptions
T:System.ArgumentNullExceptionchars or bytes is null (Nothing).
T:System.ArgumentOutOfRangeExceptioncharCount or byteCount is less than zero.
T:System.ArgumentExceptionThe output buffer is too small to contain any of the converted input. The output buffer should be greater than or equal to the size indicated by the Overload:System.Text.Decoder.GetCharCount method.
T:System.Text.DecoderFallbackExceptionA fallback occurred (see Character Encoding in the .NET Framework for fuller explanation)-and- P:System.Text.Decoder.Fallback is set to T:System.Text.DecoderExceptionFallback.

Definition at line 338 of file Decoder.cs.

◆ GetCharCount() [1/3]

abstract int System.Text.Decoder.GetCharCount ( byte []  bytes,
int  index,
int  count 
)
pure virtual

When overridden in a derived class, calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.

Parameters
bytesThe byte array containing the sequence of bytes to decode.
indexThe index of the first byte to decode.
countThe number of bytes to decode.
Returns
The number of characters produced by decoding the specified sequence of bytes and any bytes in the internal buffer.
Exceptions
T:System.ArgumentNullExceptionbytes is null (Nothing).
T:System.ArgumentOutOfRangeExceptionindex or count is less than zero.-or- index and count do not denote a valid range in bytes .
T:System.Text.DecoderFallbackExceptionA fallback occurred (see Character Encoding in the .NET Framework for fuller explanation)-and- P:System.Text.Decoder.Fallback is set to T:System.Text.DecoderExceptionFallback.

◆ GetCharCount() [2/3]

virtual int System.Text.Decoder.GetCharCount ( byte []  bytes,
int  index,
int  count,
bool  flush 
)
virtual

When overridden in a derived class, calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. A parameter indicates whether to clear the internal state of the decoder after the calculation.

Parameters
bytesThe byte array containing the sequence of bytes to decode.
indexThe index of the first byte to decode.
countThe number of bytes to decode.
flushtrue to simulate clearing the internal state of the encoder after the calculation; otherwise, false.
Returns
The number of characters produced by decoding the specified sequence of bytes and any bytes in the internal buffer.
Exceptions
T:System.ArgumentNullExceptionbytes is null (Nothing).
T:System.ArgumentOutOfRangeExceptionindex or count is less than zero.-or- index and count do not denote a valid range in bytes .
T:System.Text.DecoderFallbackExceptionA fallback occurred (see Character Encoding in the .NET Framework for fuller explanation)-and- P:System.Text.Decoder.Fallback is set to T:System.Text.DecoderExceptionFallback.

Definition at line 129 of file Decoder.cs.

◆ GetCharCount() [3/3]

virtual unsafe int System.Text.Decoder.GetCharCount ( byte *  bytes,
int  count,
bool  flush 
)
virtual

When overridden in a derived class, calculates the number of characters produced by decoding a sequence of bytes starting at the specified byte pointer. A parameter indicates whether to clear the internal state of the decoder after the calculation.

Parameters
bytesA pointer to the first byte to decode.
countThe number of bytes to decode.
flushtrue to simulate clearing the internal state of the encoder after the calculation; otherwise, false.
Returns
The number of characters produced by decoding the specified sequence of bytes and any bytes in the internal buffer.
Exceptions
T:System.ArgumentNullExceptionbytes is null (Nothing in Visual Basic .NET).
T:System.ArgumentOutOfRangeExceptioncount is less than zero.
T:System.Text.DecoderFallbackExceptionA fallback occurred (see Character Encoding in the .NET Framework for fuller explanation)-and- P:System.Text.Decoder.Fallback is set to T:System.Text.DecoderExceptionFallback.

Definition at line 149 of file Decoder.cs.

◆ GetChars() [1/3]

abstract int System.Text.Decoder.GetChars ( byte []  bytes,
int  byteIndex,
int  byteCount,
char []  chars,
int  charIndex 
)
pure virtual

When overridden in a derived class, decodes a sequence of bytes from the specified byte array and any bytes in the internal buffer into the specified character array.

Parameters
bytesThe byte array containing the sequence of bytes to decode.
byteIndexThe index of the first byte to decode.
byteCountThe number of bytes to decode.
charsThe character array to contain the resulting set of characters.
charIndexThe index at which to start writing the resulting set of characters.
Returns
The actual number of characters written into chars .
Exceptions
T:System.ArgumentNullExceptionbytes is null (Nothing).-or- chars is null (Nothing).
T:System.ArgumentOutOfRangeExceptionbyteIndex or byteCount or charIndex is less than zero.-or- byteindex and byteCount do not denote a valid range in bytes .-or- charIndex is not a valid index in chars .
T:System.ArgumentExceptionchars does not have enough capacity from charIndex to the end of the array to accommodate the resulting characters.
T:System.Text.DecoderFallbackExceptionA fallback occurred (see Character Encoding in the .NET Framework for fuller explanation)-and- P:System.Text.Decoder.Fallback is set to T:System.Text.DecoderExceptionFallback.

◆ GetChars() [2/3]

virtual int System.Text.Decoder.GetChars ( byte []  bytes,
int  byteIndex,
int  byteCount,
char []  chars,
int  charIndex,
bool  flush 
)
virtual

When overridden in a derived class, decodes a sequence of bytes from the specified byte array and any bytes in the internal buffer into the specified character array. A parameter indicates whether to clear the internal state of the decoder after the conversion.

Parameters
bytesThe byte array containing the sequence of bytes to decode.
byteIndexThe index of the first byte to decode.
byteCountThe number of bytes to decode.
charsThe character array to contain the resulting set of characters.
charIndexThe index at which to start writing the resulting set of characters.
flushtrue to clear the internal state of the decoder after the conversion; otherwise, false.
Returns
The actual number of characters written into the chars parameter.
Exceptions
T:System.ArgumentNullExceptionbytes is null (Nothing).-or- chars is null (Nothing).
T:System.ArgumentOutOfRangeExceptionbyteIndex or byteCount or charIndex is less than zero.-or- byteindex and byteCount do not denote a valid range in bytes .-or- charIndex is not a valid index in chars .
T:System.ArgumentExceptionchars does not have enough capacity from charIndex to the end of the array to accommodate the resulting characters.
T:System.Text.DecoderFallbackExceptionA fallback occurred (see Character Encoding in the .NET Framework for fuller explanation)-and- P:System.Text.Decoder.Fallback is set to T:System.Text.DecoderExceptionFallback.

Definition at line 209 of file Decoder.cs.

◆ GetChars() [3/3]

virtual unsafe int System.Text.Decoder.GetChars ( byte *  bytes,
int  byteCount,
char *  chars,
int  charCount,
bool  flush 
)
virtual

When overridden in a derived class, decodes a sequence of bytes starting at the specified byte pointer and any bytes in the internal buffer into a set of characters that are stored starting at the specified character pointer. A parameter indicates whether to clear the internal state of the decoder after the conversion.

Parameters
bytesA pointer to the first byte to decode.
byteCountThe number of bytes to decode.
charsA pointer to the location at which to start writing the resulting set of characters.
charCountThe maximum number of characters to write.
flushtrue to clear the internal state of the decoder after the conversion; otherwise, false.
Returns
The actual number of characters written at the location indicated by the chars parameter.
Exceptions
T:System.ArgumentNullExceptionbytes is null (Nothing).-or- chars is null (Nothing).
T:System.ArgumentOutOfRangeExceptionbyteCount or charCount is less than zero.
T:System.ArgumentExceptioncharCount is less than the resulting number of characters.
T:System.Text.DecoderFallbackExceptionA fallback occurred (see Character Encoding in the .NET Framework for fuller explanation)-and- P:System.Text.Decoder.Fallback is set to T:System.Text.DecoderExceptionFallback.

Definition at line 234 of file Decoder.cs.

◆ Reset()

virtual void System.Text.Decoder.Reset ( )
virtual

When overridden in a derived class, sets the decoder back to its initial state.

Definition at line 87 of file Decoder.cs.

Property Documentation

◆ Fallback

DecoderFallback System.Text.Decoder.Fallback
getset

Gets or sets a T:System.Text.DecoderFallback object for the current T:System.Text.Decoder object.

Returns
A T:System.Text.DecoderFallback object.
Exceptions
T:System.ArgumentNullExceptionThe value in a set operation is null (Nothing).
T:System.ArgumentExceptionA new value cannot be assigned in a set operation because the current T:System.Text.DecoderFallbackBuffer object contains data that has not been decoded yet.

Definition at line 25 of file Decoder.cs.

◆ FallbackBuffer

DecoderFallbackBuffer System.Text.Decoder.FallbackBuffer
get

Gets the T:System.Text.DecoderFallbackBuffer object associated with the current T:System.Text.Decoder object.

Returns
A T:System.Text.DecoderFallbackBuffer object.

Definition at line 52 of file Decoder.cs.


The documentation for this class was generated from the following file: