Click or drag to resize

RadixCodec Class

Represents a radix value codec for conversion of base-10 integer values to and from other base values.
Inheritance Hierarchy
SystemObject
  GSFRadixCodec

Namespace: GSF
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.177-beta
Syntax
public class RadixCodec
View Source

The RadixCodec type exposes the following members.

Constructors
 NameDescription
Public methodRadixCodec Creates a new RadixCodec.
Top
Properties
 NameDescription
Public propertyRadix Gets the radix, i.e., target base value, for this RadixCodec.
Public propertyStatic memberRadix16 Gets a radix-16 value (hex) encoding.
Public propertyStatic memberRadix2 Gets a radix-2 value (binary) encoding.
Public propertyStatic memberRadix256 Gets a radix-256 value encoding.
Public propertyStatic memberRadix32 Gets a radix-32 value encoding.
Public propertyStatic memberRadix36 Gets a radix-36 value encoding.
Public propertyStatic memberRadix64 Gets a radix-64 value encoding.
Public propertyStatic memberRadix64B Gets a radix-64 value encoding with the standard Base64 character sequence (results are unpadded).
Public propertyStatic memberRadix65535 Gets a radix-65535 value encoding. This is the largest supported radix.
Public propertyStatic memberRadix8 Gets a radix-8 value (octal) encoding.
Public propertyStatic memberRadix86 Gets a radix-86 value encoding.
Top
Methods
 NameDescription
Public methodDecode(Type, String) Converts a radix value to an integer value.
Public methodDecodeT(String) Converts a radix value to an integer value.
Public methodEncode(Int16) Converts integer value to a radix value.
Public methodEncode(Int24) Converts integer value to a radix value.
Public methodEncode(Int32) Converts integer value to a radix value.
Public methodEncode(Int64) Converts integer value to a radix value.
Public methodEncode(UInt16) Converts integer value to a radix value.
Public methodEncode(UInt24) Converts integer value to a radix value.
Public methodEncode(UInt32) Converts integer value to a radix value.
Public methodEncode(UInt64) Converts integer value to a radix value.
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Public methodTryDecode(String, Int24) Attempts to convert a radix value to an integer value.
Public methodTryDecode(String, UInt24) Attempts to convert a radix value to an integer value.
Public methodTryDecode(String, Int16) Attempts to convert a radix value to an integer value.
Public methodTryDecode(String, Int32) Attempts to convert a radix value to an integer value.
Public methodTryDecode(String, Int64) Attempts to convert a radix value to an integer value.
Public methodTryDecode(String, UInt16) Attempts to convert a radix value to an integer value.
Public methodTryDecode(String, UInt32) Attempts to convert a radix value to an integer value.
Public methodTryDecode(String, UInt64) Attempts to convert a radix value to an integer value.
Top
Fields
 NameDescription
Public fieldDigits Defines the available digits for a radix value codec.
Top
Extension Methods
 NameDescription
Public Extension MethodGetEnumValueOrDefault Gets the enumeration constant for value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
Public Extension MethodGetEnumValueOrDefaultT Gets the enumeration constant for this value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
Top
Remarks

The primary use case of this class is to provide compact string-based encodings of integer values, e.g., storing an unsigned 32-bit integer value in a string-based database field that only holds 6 characters; the maximum UInt32 value of 4294967295 requires 10 characters of storage as a string.

The codec algorithm for RadixCodec works much like base-64 encoding but with variable base sizes and an integer source data focus, not a byte-array. The encoded base value strings are not intended to provide binary compression, many of the radix value encodings of integers produced by this class will have a byte-size that is greater than native bytes that make up integer. Since the encodings produced by this class do not manage arbitrary sized bytes arrays nor do they include padding, the encodings are not intended to comply with RFC 3548.

See Also

Reference

GSF Namespace