Class ByteUtil
Utility methods to deal with Byte arrays.
Inherited Members
Namespace: Libplanet
Assembly: Libplanet.dll
Syntax
public static class ByteUtil
Methods
| Improve this Doc View SourceCalculateHashCode(Byte[])
Calculates a deterministic hash code from a given
bytes
. It is mostly used to implement
GetHashCode() method.
Declaration
[Pure]
public static int CalculateHashCode(byte[] bytes)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | bytes | A Byte array, which completely determines (or encodes) an object, to calculate a hash code. |
Returns
Type | Description |
---|---|
Int32 | A hash code determined from the given
|
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the given
|
Hex(Byte[])
Renders a hexadecimal string from a Byte array.
Declaration
[Pure]
public static string Hex(byte[] bytes)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | bytes | A Byte array to renders
the corresponding hexadecimal string. It must not be |
Returns
Type | Description |
---|---|
String | A hexadecimal string which encodes the given
|
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the given
|
ParseHex(String)
Converts a hexadecimal string to a Byte array.
Declaration
[Pure]
public static byte[] ParseHex(string hex)
Parameters
Type | Name | Description |
---|---|---|
String | hex | A String which encodes
Bytes in hexadecimal. Its length must be zero or
an even number. It must not be |
Returns
Type | Description |
---|---|
Byte[] | A Byte array that the given
|
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the given
|
ArgumentOutOfRangeException | Thrown when the length
of the given |
FormatException | Thrown when the given
|