C# Класс Utilities.Binary.Extensions.ByteExtensions

Показать файл Открыть проект

Открытые методы

Метод Описание
Append ( this data, byte toAppend ) : byte[]

Appends the specified data to the source byte array

Base64ToByteArray ( this Input ) : byte[]

Converts base 64 string to a byte array

BinaryToByteArray ( this binary ) : byte[]

Convert binary string representation to byte array

BinaryToDecimal ( this text ) : string

Returns the decimal representation of a binary number.

BinaryToHex ( this text ) : string

Returns the hexadecimal representation of a binary number.

Compress ( this data, CompressionType compressionType = CompressionType.Deflate ) : byte[]

Compresses the data using the specified compression type

Compress ( this data, Encoding encodingUsing = null, CompressionType compressionType = CompressionType.Deflate ) : string

Compresses a string of data

DecimalToBinary ( this txt ) : string

Returns the binary representation of a binary number.

DecimalToHex ( this txt ) : string

Returns the hexadecimal representation of a decimal number.

Decompress ( this data, CompressionType CompressionType = CompressionType.Deflate ) : byte[]

Decompresses the byte array that is sent in

Decompress ( this data, Encoding EncodingUsing = null, CompressionType CompressionType = CompressionType.Deflate ) : string

Decompresses a string of data

HexToBinary ( this hex ) : string

Returns the binary representation of a hexadecimal number.

HexToByteArray ( this hex ) : byte[]

Converts a hexadecimal string to a byte array representation.

The string is assumed to be of even size.

HexToDecimal ( this hex ) : string

Returns the decimal representation of a hexadecimal number.

IsBinary ( this binary ) : bool

Validate if string is a valide binary representation

IsHex ( this hex ) : bool

Validate is string is a valide hex representation

IsUnicode ( this data ) : bool

Determines if a byte array is unicode

ToBase64String ( this data ) : string

Converts a byte array into a base 64 string

ToBinary ( this data ) : string

Convert byte array to a binary representation as a string

ToByteArray ( this input, Encoding encodingUsing = null ) : byte[]

Converts a string to a byte array

ToEncodedString ( this data, Encoding encodingUsing = null, int index, int count = -1 ) : string

Converts a byte array to a string

ToHex ( this data ) : string

Converts a byte array to a hexadecimal string representation.

ToHexNibble ( this data ) : byte

Convert byte to nibble (4 bit value)

ToInt32 ( this data ) : int

Convert byte array to a 32 bit int

ToNibbleString ( this data ) : string

Convert a byte array into a string with each byte represented as nibbles

Приватные методы

Метод Описание
GetStream ( MemoryStream Stream, CompressionMode Mode, CompressionType CompressionType ) : Stream

Описание методов

Append() публичный статический Метод

Appends the specified data to the source byte array
public static Append ( this data, byte toAppend ) : byte[]
data this Byte array to be appended
toAppend byte Byte array to append.
Результат byte[]

Base64ToByteArray() публичный статический Метод

Converts base 64 string to a byte array
public static Base64ToByteArray ( this Input ) : byte[]
Input this Input string
Результат byte[]

BinaryToByteArray() публичный статический Метод

Convert binary string representation to byte array
public static BinaryToByteArray ( this binary ) : byte[]
binary this Binary string
Результат byte[]

BinaryToDecimal() публичный статический Метод

Returns the decimal representation of a binary number.
public static BinaryToDecimal ( this text ) : string
text this Binary string to convert to decimal.
Результат string

BinaryToHex() публичный статический Метод

Returns the hexadecimal representation of a binary number.
public static BinaryToHex ( this text ) : string
text this Binary string to convert to hexadecimal.
Результат string

Compress() публичный статический Метод

Compresses the data using the specified compression type
public static Compress ( this data, CompressionType compressionType = CompressionType.Deflate ) : byte[]
data this data to compress
compressionType CompressionType Compression type
Результат byte[]

Compress() публичный статический Метод

Compresses a string of data
public static Compress ( this data, Encoding encodingUsing = null, CompressionType compressionType = CompressionType.Deflate ) : string
data this data to Compress
encodingUsing System.Text.Encoding Encoding that the data uses (defaults to UTF8)
compressionType CompressionType The compression type used
Результат string

DecimalToBinary() публичный статический Метод

Returns the binary representation of a binary number.
public static DecimalToBinary ( this txt ) : string
txt this Decimal string to convert to binary.
Результат string

DecimalToHex() публичный статический Метод

Returns the hexadecimal representation of a decimal number.
public static DecimalToHex ( this txt ) : string
txt this Hexadecimal string to convert to decimal.
Результат string

Decompress() публичный статический Метод

Decompresses the byte array that is sent in
public static Decompress ( this data, CompressionType CompressionType = CompressionType.Deflate ) : byte[]
data this data to decompress
CompressionType CompressionType The compression type used
Результат byte[]

Decompress() публичный статический Метод

Decompresses a string of data
public static Decompress ( this data, Encoding EncodingUsing = null, CompressionType CompressionType = CompressionType.Deflate ) : string
data this data to decompress
EncodingUsing System.Text.Encoding Encoding that the result should use (defaults to UTF8)
CompressionType CompressionType The compression type used
Результат string

HexToBinary() публичный статический Метод

Returns the binary representation of a hexadecimal number.
public static HexToBinary ( this hex ) : string
hex this Binary string to convert to hexadecimal.
Результат string

HexToByteArray() публичный статический Метод

Converts a hexadecimal string to a byte array representation.
The string is assumed to be of even size.
public static HexToByteArray ( this hex ) : byte[]
hex this Hexadecimal string to convert to byte array.
Результат byte[]

HexToDecimal() публичный статический Метод

Returns the decimal representation of a hexadecimal number.
public static HexToDecimal ( this hex ) : string
hex this Hexadecimal string to convert to decimal.
Результат string

IsBinary() публичный статический Метод

Validate if string is a valide binary representation
public static IsBinary ( this binary ) : bool
binary this
Результат bool

IsHex() публичный статический Метод

Validate is string is a valide hex representation
public static IsHex ( this hex ) : bool
hex this
Результат bool

IsUnicode() публичный статический Метод

Determines if a byte array is unicode
public static IsUnicode ( this data ) : bool
data this Input array
Результат bool

ToBase64String() публичный статический Метод

Converts a byte array into a base 64 string
public static ToBase64String ( this data ) : string
data this Input array
Результат string

ToBinary() публичный статический Метод

Convert byte array to a binary representation as a string
public static ToBinary ( this data ) : string
data this The byte array to be converted to a string
Результат string

ToByteArray() публичный статический Метод

Converts a string to a byte array
public static ToByteArray ( this input, Encoding encodingUsing = null ) : byte[]
input this input string
encodingUsing System.Text.Encoding The type of encoding the string is using (defaults to UTF8)
Результат byte[]

ToEncodedString() публичный статический Метод

Converts a byte array to a string
public static ToEncodedString ( this data, Encoding encodingUsing = null, int index, int count = -1 ) : string
data this input array
encodingUsing System.Text.Encoding The type of encoding the string is using (defaults to UTF8)
index int The index of the first byte to decode
count int /// Number of bytes starting at the index to convert (use -1 for the entire array starting at the /// index) ///
Результат string

ToHex() публичный статический Метод

Converts a byte array to a hexadecimal string representation.
public static ToHex ( this data ) : string
data this Byte array to convert to hexadecimal string.
Результат string

ToHexNibble() публичный статический Метод

Convert byte to nibble (4 bit value)
public static ToHexNibble ( this data ) : byte
data this the byte to be converted to a nibble
Результат byte

ToInt32() публичный статический Метод

Convert byte array to a 32 bit int
public static ToInt32 ( this data ) : int
data this The byte array to be converted
Результат int

ToNibbleString() публичный статический Метод

Convert a byte array into a string with each byte represented as nibbles
public static ToNibbleString ( this data ) : string
data this The byte array to be converted to a string of nibbles
Результат string