HexEncoding
Summary description for HexEncoding. http://www.codeproject.com/KB/recipes/hexencoding.aspx
Erbt von: Encoding
Methoden
public override int GetByteCount(string hexString)
result = hexEncoding.GetByteCount(hexString)
When overridden in a derived class, calculates the number of bytes produced by encoding the characters in the specified String.
- hexString
- The String containing the set of characters to encode.
Rückgabe: The number of bytes produced by encoding the specified characters.
public override int GetByteCount(char[] chars, int index, int count)
result = hexEncoding.GetByteCount(chars, index, count)
When overridden in a derived class, calculates the number of bytes produced by encoding a set of characters from the specified character array.
- chars
- The character array containing the set of characters to encode.
- index
- The index of the first character to encode.
- count
- The number of characters to encode.
Rückgabe: The number of bytes produced by encoding the specified characters.
public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex)
result = hexEncoding.GetBytes(chars, charIndex, charCount, bytes, byteIndex)
When overridden in a derived class, encodes a set of characters from the specified character array into the specified byte array.
- chars
- The character array containing the set of characters to encode.
- charIndex
- The index of the first character to encode.
- charCount
- The number of characters to encode.
- bytes
- The byte array to contain the resulting sequence of bytes.
- byteIndex
- The index at which to start writing the resulting sequence of bytes.
Rückgabe: The actual number of bytes written into .
public override byte[] GetBytes(string hexString)
result = hexEncoding.GetBytes(hexString)
Creates a byte array from the hexadecimal string. Each two characters are combined to create one byte. First two hexadecimal characters become first byte in returned array. Non-hexadecimal characters are ignored.
- hexString
- string to convert to byte array
Rückgabe: byte array, in the same left-to-right order as the hexString
public static byte[] GetBytes(char[] chars, int charIndex, int charCount, int discarded)
result = HexEncoding.GetBytes(chars, charIndex, charCount, discarded)
Creates a byte array from the hexadecimal string. Each two characters are combined to create one byte. First two hexadecimal characters become first byte in returned array. Non-hexadecimal characters are ignored.
- chars
- The character array containing the set of characters to encode.
- charIndex
- The index of the first character to encode.
- charCount
- The number of characters to encode.
- discarded
- number of characters in string ignored.
Rückgabe: byte array, in the same left-to-right order as the hexString.
public override int GetCharCount(byte[] bytes, int index, int count)
result = hexEncoding.GetCharCount(bytes, index, count)
When overridden in a derived class, calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
- bytes
- The byte array containing the sequence of bytes to decode.
- index
- The index of the first byte to decode.
- count
- The number of bytes to decode.
Rückgabe: The number of characters produced by decoding the specified sequence of bytes.
public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)
result = hexEncoding.GetChars(bytes, byteIndex, byteCount, chars, charIndex)
When overridden in a derived class, decodes a sequence of bytes from the specified byte array into the specified character array.
- bytes
- The byte array containing the sequence of bytes to decode.
- byteIndex
- The index of the first byte to decode.
- byteCount
- The number of bytes to decode.
- chars
- The character array to contain the resulting set of characters.
- charIndex
- The index at which to start writing the resulting set of characters.
Rückgabe: The actual number of characters written into .
public override int GetMaxByteCount(int charCount)
result = hexEncoding.GetMaxByteCount(charCount)
When overridden in a derived class, calculates the maximum number of bytes produced by encoding the specified number of characters.
- charCount
- The number of characters to encode.
Rückgabe: The maximum number of bytes produced by encoding the specified number of characters.
public override int GetMaxCharCount(int byteCount)
result = hexEncoding.GetMaxCharCount(byteCount)
When overridden in a derived class, calculates the maximum number of characters produced by decoding the specified number of bytes.
- byteCount
- The number of bytes to decode.
Rückgabe: The maximum number of characters produced by decoding the specified number of bytes.
private static byte HexToByte(string hexString)
result = HexEncoding.HexToByte(hexString)
Converts 1 or 2 character string into equivalant byte value
- hexString
- 1 or 2 character string.
Rückgabe: byte
public static bool IsHexDigit(char c)
result = HexEncoding.IsHexDigit(c)
Returns true is c is a hexadecimal digit (A-F, a-f, 0-9)
- c
- Character to test.
Rückgabe: true if hex digit, false if not.