Class ByteEncoding
Implements a text encoding that simply reads and writes bytes without any changes. This corresponds to the Windows codepage 1252.
Namespace: Neon.Common
Assembly: Neon.Common.dll
Syntax
public class ByteEncoding : Encoding
Properties
Instance
Returns a ByteEncoding instance.
Declaration
public static ByteEncoding Instance { get; }
Property Value
Type | Description |
---|---|
ByteEncoding |
Methods
GetByteCount(char[], int, int)
When overridden in a derived class, calculates the number of bytes produced by encoding a set of characters from the specified character array.
Declaration
public override int GetByteCount(char[] chars, int index, int count)
Parameters
Type | Name | Description |
---|---|---|
char[] | chars | The character array containing the set of characters to encode. |
int | index | The index of the first character to encode. |
int | count | The number of characters to encode. |
Returns
Type | Description |
---|---|
int | The number of bytes produced by encoding the specified characters. |
Overrides
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ArgumentOutOfRangeException |
-or-
|
EncoderFallbackException | A fallback occurred (for more information, see Character Encoding in .NET) -and- EncoderFallback is set to EncoderExceptionFallback. |
GetBytes(char[], int, int, byte[], int)
When overridden in a derived class, encodes a set of characters from the specified character array into the specified byte array.
Declaration
public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex)
Parameters
Type | Name | Description |
---|---|---|
char[] | chars | The character array containing the set of characters to encode. |
int | charIndex | The index of the first character to encode. |
int | charCount | The number of characters to encode. |
byte[] | bytes | The byte array to contain the resulting sequence of bytes. |
int | byteIndex | The index at which to start writing the resulting sequence of bytes. |
Returns
Type | Description |
---|---|
int | The actual number of bytes written into |
Overrides
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
-or-
|
ArgumentOutOfRangeException |
-or-
-or-
|
ArgumentException |
|
EncoderFallbackException | A fallback occurred (for more information, see Character Encoding in .NET) -and- EncoderFallback is set to EncoderExceptionFallback. |
GetCharCount(byte[], int, int)
When overridden in a derived class, calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
Declaration
public override int GetCharCount(byte[] bytes, int index, int count)
Parameters
Type | Name | Description |
---|---|---|
byte[] | bytes | The byte array containing the sequence of bytes to decode. |
int | index | The index of the first byte to decode. |
int | count | The number of bytes to decode. |
Returns
Type | Description |
---|---|
int | The number of characters produced by decoding the specified sequence of bytes. |
Overrides
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ArgumentOutOfRangeException |
-or-
|
DecoderFallbackException | A fallback occurred (for more information, see Character Encoding in .NET) -and- DecoderFallback is set to DecoderExceptionFallback. |
GetChars(byte[], int, int, char[], int)
When overridden in a derived class, decodes a sequence of bytes from the specified byte array into the specified character array.
Declaration
public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)
Parameters
Type | Name | Description |
---|---|---|
byte[] | bytes | The byte array containing the sequence of bytes to decode. |
int | byteIndex | The index of the first byte to decode. |
int | byteCount | The number of bytes to decode. |
char[] | chars | The character array to contain the resulting set of characters. |
int | charIndex | The index at which to start writing the resulting set of characters. |
Returns
Type | Description |
---|---|
int | The actual number of characters written into |
Overrides
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
-or-
|
ArgumentOutOfRangeException |
-or-
-or-
|
ArgumentException |
|
DecoderFallbackException | A fallback occurred (for more information, see Character Encoding in .NET) -and- DecoderFallback is set to DecoderExceptionFallback. |
GetMaxByteCount(int)
When overridden in a derived class, calculates the maximum number of bytes produced by encoding the specified number of characters.
Declaration
public override int GetMaxByteCount(int charCount)
Parameters
Type | Name | Description |
---|---|---|
int | charCount | The number of characters to encode. |
Returns
Type | Description |
---|---|
int | The maximum number of bytes produced by encoding the specified number of characters. |
Overrides
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException |
|
EncoderFallbackException | A fallback occurred (for more information, see Character Encoding in .NET) -and- EncoderFallback is set to EncoderExceptionFallback. |
GetMaxCharCount(int)
When overridden in a derived class, calculates the maximum number of characters produced by decoding the specified number of bytes.
Declaration
public override int GetMaxCharCount(int byteCount)
Parameters
Type | Name | Description |
---|---|---|
int | byteCount | The number of bytes to decode. |
Returns
Type | Description |
---|---|
int | The maximum number of characters produced by decoding the specified number of bytes. |
Overrides
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException |
|
DecoderFallbackException | A fallback occurred (for more information, see Character Encoding in .NET) -and- DecoderFallback is set to DecoderExceptionFallback. |