Converts base data types to an xtd::array of bytes, and an xtd::array of bytes to base data types.
true
on little-endian systems and false
on big-endian systems. On little-endian systems, lower-order bytes precede higher-order bytes. On big-endian system, higher-order bytes precede lower-order bytes. The following table illustrates the difference in the xtd::byte xtd::arrays that result from passing the integer 1,234,567,890 (0x499602D2) to the get_bytes(int32) method. The bytes are listed in order from the xtd::byte at index 0 to the xtd::byte at index 3. Little-endian | D2-02-96-49 |
Big-endian | 49-96-02-D2 |
Public Types | |
enum class | endian { little , big } |
Represents the xtd::byte order ("endianness") in which data is stored in this computer architecture. More... | |
Public Fields | |
static constexpr bool | is_big_endian |
Indicates the xtd::byte order ("endianness") in which data is stored in this computer architecture. | |
static constexpr bool | is_little_endian |
Indicates the xtd::byte order ("endianness") in which data is stored in this computer architecture. | |
static constexpr endian | endianness |
Indicates the xtd::byte order ("endianness") in which data is stored in this computer architecture. | |
Public Static Methods | |
static int64 | double_to_int64_bits (double value) noexcept |
Converts the specified double-precision floating point number to a 64-bit signed integer. | |
static xtd::array< xtd::byte > | get_bytes (bool value) noexcept |
Returns the specified Boolean value as an xtd::array of bytes. | |
static xtd::array< xtd::byte > | get_bytes (char value) noexcept |
Returns the specified Char value as an xtd::array of bytes. | |
static xtd::array< xtd::byte > | get_bytes (char16 value) noexcept |
Returns the specified Char value as an xtd::array of bytes. | |
static xtd::array< xtd::byte > | get_bytes (char32 value) noexcept |
Returns the specified Char value as an xtd::array of bytes. | |
static xtd::array< xtd::byte > | get_bytes (wchar value) noexcept |
Returns the specified Char value as an xtd::array of bytes. | |
static xtd::array< xtd::byte > | get_bytes (double value) noexcept |
Returns the specified double value as an xtd::array of bytes. | |
static xtd::array< xtd::byte > | get_bytes (sbyte value) noexcept |
Returns the specified xtd::byte value as an xtd::array of bytes. | |
static xtd::array< xtd::byte > | get_bytes (int16 value) noexcept |
Returns the specified int16 value as an xtd::array of bytes. | |
static xtd::array< xtd::byte > | get_bytes (int32 value) noexcept |
Returns the specified int32 value as an xtd::array of bytes. | |
static xtd::array< xtd::byte > | get_bytes (int64 value) noexcept |
Returns the specified int64 value as an xtd::array of bytes. | |
static xtd::array< xtd::byte > | get_bytes (float value) noexcept |
Returns the specified single value as an xtd::array of bytes. | |
static xtd::array< xtd::byte > | get_bytes (xtd::byte value) noexcept |
Returns the specified xtd::byte value as an xtd::array of bytes. | |
static xtd::array< xtd::byte > | get_bytes (uint16 value) noexcept |
Returns the specified uint16 value as an xtd::array of bytes. | |
static xtd::array< xtd::byte > | get_bytes (uint32 value) noexcept |
Returns the specified uint32 value as an xtd::array of bytes. | |
static xtd::array< xtd::byte > | get_bytes (uint64 value) noexcept |
Returns the specified uint64 value as an xtd::array of bytes. | |
static float | int32_bits_to_single (int32 value) noexcept |
Converts the specified 32-bit signed integer to a single-precision floating point number. | |
static double | int64_bits_to_double (int64 value) noexcept |
Converts the specified 64-bit signed integer to a double-precision floating point number. | |
static int32 | single_to_int32_bits (float value) noexcept |
Converts the specified single-precision floating point number to a 32-bit signed integer. | |
static bool | to_boolean (const xtd::array< xtd::byte > &value, xtd::size start_index) |
Returns a Boolean value converted from one xtd::byte at a specified position in a xtd::byte xtd::array. | |
static bool | to_boolean (const read_only_span< xtd::byte > &value, xtd::size start_index) |
Returns a Boolean value converted from one xtd::byte at a specified position in a xtd::byte xtd::read_only_span. | |
static char32 | to_char (const xtd::array< xtd::byte > &value, xtd::size start_index) |
Returns a char32 converted from two bytes at a specified position in a xtd::byte xtd::array. | |
static char32 | to_char (const read_only_span< xtd::byte > &value, xtd::size start_index) |
Returns a char32 converted from two bytes at a specified position in a xtd::byte xtd::read_only_span. | |
static double | to_double (const xtd::array< xtd::byte > &value, xtd::size start_index) |
Returns a double-precision floating point number converted from eight bytes at a specified position in a xtd::byte xtd::array. | |
static double | to_double (const read_only_span< xtd::byte > &value, xtd::size start_index) |
Returns a double-precision floating point number converted from eight bytes at a specified position in a xtd::byte xtd::read_only_span. | |
static int16 | to_int16 (const xtd::array< xtd::byte > &value, xtd::size start_index) |
Returns a 16-bit signed integer converted from two bytes at a specified position in a xtd::byte xtd::array. | |
static int16 | to_int16 (const read_only_span< xtd::byte > &value, xtd::size start_index) |
Returns a 16-bit signed integer converted from two bytes at a specified position in a xtd::byte xtd::read_only_span. | |
static int32 | to_int32 (const xtd::array< xtd::byte > &value, xtd::size start_index) |
Returns a 32-bit signed integer converted from two bytes at a specified position in a xtd::byte xtd::array. | |
static int32 | to_int32 (const read_only_span< xtd::byte > &value, xtd::size start_index) |
Returns a 32-bit signed integer converted from two bytes at a specified position in a xtd::byte xtd::read_only_span. | |
static int64 | to_int64 (const xtd::array< xtd::byte > &value, xtd::size start_index) |
Returns a 64-bit signed integer converted from two bytes at a specified position in a xtd::byte xtd::array. | |
static int64 | to_int64 (const read_only_span< xtd::byte > &value, xtd::size start_index) |
Returns a 64-bit signed integer converted from two bytes at a specified position in a xtd::byte xtd::read_only_span. | |
static float | to_single (const xtd::array< xtd::byte > &value, xtd::size start_index) |
Returns a single-precision floating point number converted from eight bytes at a specified position in a xtd::byte xtd::array. | |
static float | to_single (const read_only_span< xtd::byte > &value, xtd::size start_index) |
Returns a single-precision floating point number converted from eight bytes at a specified position in a xtd::byte xtd::read_only_span. | |
static uint16 | to_uint16 (const xtd::array< xtd::byte > &value, xtd::size start_index) |
Returns a 16-bit unsigned integer converted from two bytes at a specified position in a xtd::byte xtd::array. | |
static uint16 | to_uint16 (const read_only_span< xtd::byte > &value, xtd::size start_index) |
Returns a 16-bit unsigned integer converted from two bytes at a specified position in a xtd::byte xtd::read_only_span. | |
static uint32 | to_uint32 (const xtd::array< xtd::byte > &value, xtd::size start_index) |
Returns a 32-bit signed integer converted from two bytes at a specified position in a xtd::byte xtd::array. | |
static uint32 | to_uint32 (const read_only_span< xtd::byte > &value, xtd::size start_index) |
Returns a 32-bit signed integer converted from two bytes at a specified position in a xtd::byte xtd::read_only_span. | |
static uint64 | to_uint64 (const xtd::array< xtd::byte > &value, xtd::size start_index) |
Returns a 64-bit unsigned integer converted from two bytes at a specified position in a xtd::byte xtd::array. | |
static uint64 | to_uint64 (const read_only_span< xtd::byte > &value, xtd::size start_index) |
Returns a 64-bit unsigned integer converted from two bytes at a specified position in a xtd::byte xtd::read_only_span. | |
static xtd::string | to_string (const xtd::array< xtd::byte > &value) |
Converts the numeric value of each element of a specified xtd::array of bytes to its equivalent hexadecimal xtd::string representation. | |
static xtd::string | to_string (const read_only_span< xtd::byte > &value) |
Converts the numeric value of each element of a specified xtd::array of bytes to its equivalent hexadecimal xtd::string representation. | |
static xtd::string | to_string (const xtd::array< xtd::byte > &value, xtd::size start_index) |
Converts the numeric value of each element of a specified sub xtd::array of bytes to its equivalent hexadecimal xtd::string representation. | |
static xtd::string | to_string (const read_only_span< xtd::byte > &value, xtd::size start_index) |
Converts the numeric value of each element of a specified sub xtd::array of bytes to its equivalent hexadecimal xtd::string representation. | |
static xtd::string | to_string (const xtd::array< xtd::byte > &value, xtd::size start_index, xtd::size length) |
Converts the numeric value of each element of a specified sub xtd::array of bytes to its equivalent hexadecimal xtd::string representation. | |
static xtd::string | to_string (const read_only_span< xtd::byte > &value, xtd::size start_index, xtd::size length) |
Converts the numeric value of each element of a specified sub xtd::array of bytes to its equivalent hexadecimal xtd::string representation. | |
|
strong |
Represents the xtd::byte order ("endianness") in which data is stored in this computer architecture.
Enumerator | |
---|---|
little | Represnets "Little-endian" order. |
big | Represnets "Big-endian" order. |
|
staticnoexcept |
Converts the specified double-precision floating point number to a 64-bit signed integer.
value | The number to convert. |
|
staticnoexcept |
Returns the specified Boolean value as an xtd::array of bytes.
value | A Boolean value. |
|
staticnoexcept |
Returns the specified Char value as an xtd::array of bytes.
value | A Char value. |
|
staticnoexcept |
Returns the specified Char value as an xtd::array of bytes.
value | A Char value. |
|
staticnoexcept |
Returns the specified Char value as an xtd::array of bytes.
value | A Char value. |
|
staticnoexcept |
Returns the specified Char value as an xtd::array of bytes.
value | A Char value. |
|
staticnoexcept |
Returns the specified double value as an xtd::array of bytes.
value | A double value. |
|
staticnoexcept |
Returns the specified xtd::byte value as an xtd::array of bytes.
value | A xtd::byte value. |
|
staticnoexcept |
Returns the specified int16 value as an xtd::array of bytes.
value | A int16 value. |
|
staticnoexcept |
Returns the specified int32 value as an xtd::array of bytes.
value | A int32 value. |
|
staticnoexcept |
Returns the specified int64 value as an xtd::array of bytes.
value | A int64 value. |
|
staticnoexcept |
Returns the specified single value as an xtd::array of bytes.
value | A single value. |
|
staticnoexcept |
Returns the specified xtd::byte value as an xtd::array of bytes.
value | A xtd::byte value. |
|
staticnoexcept |
Returns the specified uint16 value as an xtd::array of bytes.
value | A uint16 value. |
|
staticnoexcept |
Returns the specified uint32 value as an xtd::array of bytes.
value | A uint32 value. |
|
staticnoexcept |
Returns the specified uint64 value as an xtd::array of bytes.
value | A uint64 value. |
|
staticnoexcept |
Converts the specified 32-bit signed integer to a single-precision floating point number.
value | The number to convert. |
|
staticnoexcept |
Converts the specified 64-bit signed integer to a double-precision floating point number.
value | The number to convert. |
|
staticnoexcept |
Converts the specified single-precision floating point number to a 32-bit signed integer.
value | The number to convert. |
|
static |
Returns a Boolean value converted from one xtd::byte at a specified position in a xtd::byte xtd::array.
value | An xtd::array of bytes. |
start_index | The starting position within value. |
true
if the xtd::byte at start_index in value is nonzero; otherwise, false
. argument_null_exception | value is null |
argument_out_of_range_exception | start_index is less than zero or greater than the length of value minus 1. |
|
static |
Returns a Boolean value converted from one xtd::byte at a specified position in a xtd::byte xtd::read_only_span.
value | An xtd::read_only_span of bytes. |
start_index | The starting position within value. |
true
if the xtd::byte at start_index in value is nonzero; otherwise, false
. argument_null_exception | value is null |
argument_out_of_range_exception | start_index is less than zero or greater than the length of value minus 1. |
|
static |
Returns a char32 converted from two bytes at a specified position in a xtd::byte xtd::array.
value | An xtd::array of bytes. |
start_index | The starting position within value. |
argument_exception | start_index equals the length of value minus 1. |
argument_null_exception | value is null |
argument_out_of_range_exception | start_index is less than zero or greater than the length of value minus 1. |
|
static |
Returns a char32 converted from two bytes at a specified position in a xtd::byte xtd::read_only_span.
value | An xtd::read_only_span of bytes. |
start_index | The starting position within value. |
argument_exception | start_index equals the length of value minus 1. |
argument_null_exception | value is null |
argument_out_of_range_exception | start_index is less than zero or greater than the length of value minus 1. |
|
static |
Returns a double-precision floating point number converted from eight bytes at a specified position in a xtd::byte xtd::array.
value | An xtd::array of bytes. |
start_index | The starting position within value. |
argument_exception | start_index equals the length of value minus 1. |
argument_null_exception | value is null |
argument_out_of_range_exception | start_index is less than zero or greater than the length of value minus 1. |
|
static |
Returns a double-precision floating point number converted from eight bytes at a specified position in a xtd::byte xtd::read_only_span.
value | An xtd::read_only_span of bytes. |
start_index | The starting position within value. |
argument_exception | start_index equals the length of value minus 1. |
argument_null_exception | value is null |
argument_out_of_range_exception | start_index is less than zero or greater than the length of value minus 1. |
|
static |
Returns a 16-bit signed integer converted from two bytes at a specified position in a xtd::byte xtd::array.
value | An xtd::array of bytes. |
start_index | The starting position within value. |
argument_exception | start_index equals the length of value minus 1. |
argument_null_exception | value is null |
argument_out_of_range_exception | start_index is less than zero or greater than the length of value minus 1. |
|
static |
Returns a 16-bit signed integer converted from two bytes at a specified position in a xtd::byte xtd::read_only_span.
value | An xtd::read_only_span of bytes. |
start_index | The starting position within value. |
argument_exception | start_index equals the length of value minus 1. |
argument_null_exception | value is null |
argument_out_of_range_exception | start_index is less than zero or greater than the length of value minus 1. |
|
static |
Returns a 32-bit signed integer converted from two bytes at a specified position in a xtd::byte xtd::array.
value | An xtd::array of bytes. |
start_index | The starting position within value. |
argument_exception | start_index equals the length of value minus 1. |
argument_null_exception | value is null |
argument_out_of_range_exception | start_index is less than zero or greater than the length of value minus 1. |
|
static |
Returns a 32-bit signed integer converted from two bytes at a specified position in a xtd::byte xtd::read_only_span.
value | An xtd::read_only_span of bytes. |
start_index | The starting position within value. |
argument_exception | start_index equals the length of value minus 1. |
argument_null_exception | value is null |
argument_out_of_range_exception | start_index is less than zero or greater than the length of value minus 1. |
|
static |
Returns a 64-bit signed integer converted from two bytes at a specified position in a xtd::byte xtd::array.
value | An xtd::array of bytes. |
start_index | The starting position within value. |
argument_exception | start_index equals the length of value minus 1. |
argument_null_exception | value is null |
argument_out_of_range_exception | start_index is less than zero or greater than the length of value minus 1. |
|
static |
Returns a 64-bit signed integer converted from two bytes at a specified position in a xtd::byte xtd::read_only_span.
value | An xtd::read_only_span of bytes. |
start_index | The starting position within value. |
argument_exception | start_index equals the length of value minus 1. |
argument_null_exception | value is null |
argument_out_of_range_exception | start_index is less than zero or greater than the length of value minus 1. |
|
static |
Returns a single-precision floating point number converted from eight bytes at a specified position in a xtd::byte xtd::array.
value | An xtd::array of bytes. |
start_index | The starting position within value. |
argument_exception | start_index equals the length of value minus 1. |
argument_null_exception | value is null |
argument_out_of_range_exception | start_index is less than zero or greater than the length of value minus 1. |
|
static |
Returns a single-precision floating point number converted from eight bytes at a specified position in a xtd::byte xtd::read_only_span.
value | An xtd::read_only_span of bytes. |
start_index | The starting position within value. |
argument_exception | start_index equals the length of value minus 1. |
argument_null_exception | value is null |
argument_out_of_range_exception | start_index is less than zero or greater than the length of value minus 1. |
|
static |
Returns a 16-bit unsigned integer converted from two bytes at a specified position in a xtd::byte xtd::array.
value | An xtd::array of bytes. |
start_index | The starting position within value. |
argument_exception | start_index equals the length of value minus 1. |
argument_null_exception | value is null |
argument_out_of_range_exception | start_index is less than zero or greater than the length of value minus 1. |
|
static |
Returns a 16-bit unsigned integer converted from two bytes at a specified position in a xtd::byte xtd::read_only_span.
value | An xtd::read_only_span of bytes. |
start_index | The starting position within value. |
argument_exception | start_index equals the length of value minus 1. |
argument_null_exception | value is null |
argument_out_of_range_exception | start_index is less than zero or greater than the length of value minus 1. |
|
static |
Returns a 32-bit signed integer converted from two bytes at a specified position in a xtd::byte xtd::array.
value | An xtd::array of bytes. |
start_index | The starting position within value. |
argument_exception | start_index equals the length of value minus 1. |
argument_null_exception | value is null |
argument_out_of_range_exception | start_index is less than zero or greater than the length of value minus 1. |
|
static |
Returns a 32-bit signed integer converted from two bytes at a specified position in a xtd::byte xtd::read_only_span.
value | An xtd::read_only_span of bytes. |
start_index | The starting position within value. |
argument_exception | start_index equals the length of value minus 1. |
argument_null_exception | value is null |
argument_out_of_range_exception | start_index is less than zero or greater than the length of value minus 1. |
|
static |
Returns a 64-bit unsigned integer converted from two bytes at a specified position in a xtd::byte xtd::array.
value | An xtd::array of bytes. |
start_index | The starting position within value. |
argument_exception | start_index equals the length of value minus 1. |
argument_null_exception | value is null |
argument_out_of_range_exception | start_index is less than zero or greater than the length of value minus 1. |
|
static |
Returns a 64-bit unsigned integer converted from two bytes at a specified position in a xtd::byte xtd::read_only_span.
value | An xtd::read_only_span of bytes. |
start_index | The starting position within value. |
argument_exception | start_index equals the length of value minus 1. |
argument_null_exception | value is null |
argument_out_of_range_exception | start_index is less than zero or greater than the length of value minus 1. |
|
static |
Converts the numeric value of each element of a specified xtd::array of bytes to its equivalent hexadecimal xtd::string representation.
value | An xtd::array of bytes. |
argument_null_exception | value is null. |
|
static |
Converts the numeric value of each element of a specified xtd::array of bytes to its equivalent hexadecimal xtd::string representation.
value | An xtd::read_only_span of bytes. |
argument_null_exception | value is null. |
|
static |
Converts the numeric value of each element of a specified sub xtd::array of bytes to its equivalent hexadecimal xtd::string representation.
value | An xtd::array of bytes. |
start_index | The starting position within value. |
argument_null_exception | value is null. |
argument_out_of_range_exception | start_index is less than zero or greater than the length of value minus 1. |
|
static |
Converts the numeric value of each element of a specified sub xtd::array of bytes to its equivalent hexadecimal xtd::string representation.
value | An xtd::read_only_span of bytes. |
start_index | The starting position within value. |
argument_null_exception | value is null. |
argument_out_of_range_exception | start_index is less than zero or greater than the length of value minus 1. |
|
static |
Converts the numeric value of each element of a specified sub xtd::array of bytes to its equivalent hexadecimal xtd::string representation.
value | An xtd::array of bytes. |
start_index | The starting position within value. |
length | The number of xtd::array elements in value to convert. |
argument_null_exception | value is null. |
argument_out_of_range_exception | start_index or length is less than zero. -or- start_index is greater than zero and is greater than or equal to the length of value. |
argument_exception | The combination of start_index and length does not specify a position within value; that is, the start_index parameter is greater than the length of value minus the length parameter. |
|
static |
Converts the numeric value of each element of a specified sub xtd::array of bytes to its equivalent hexadecimal xtd::string representation.
value | An xtd::read_only_span of bytes. |
start_index | The starting position within value. |
length | The number of xtd::array elements in value to convert. |
argument_null_exception | value is null. |
argument_out_of_range_exception | start_index or length is less than zero. -or- start_index is greater than zero and is greater than or equal to the length of value. |
argument_exception | The combination of start_index and length does not specify a position within value; that is, the start_index parameter is greater than the length of value minus the length parameter. |
|
staticconstexpr |
Indicates the xtd::byte order ("endianness") in which data is stored in this computer architecture.
true
if the architecture is big-endian; false
if it is little-endian.
|
staticconstexpr |
Indicates the xtd::byte order ("endianness") in which data is stored in this computer architecture.
true
if the architecture is little-endian; false
if it is big-endian.
|
staticconstexpr |
Indicates the xtd::byte order ("endianness") in which data is stored in this computer architecture.