toKapacity
Converts this numerical value into a Kapacity instance based on the specified unit and standard.
By default, this uses the Metric (SI) standard (powers of 1,000). For example, converting 5L with a unit of Megabytes will result in 5,000,000 bytes. If useMetric is set to false, the Binary (IEC) standard (powers of 1,024) is used instead, resulting in 5,242,880 bytes.
Return
A strictly-typed Kapacity representing the exact total in bytes.
Parameters
The unit of measurement this value represents (e.g., Kilobyte, Megabyte).
If true, calculates using the base-10 Metric standard (1 KB = 1,000 bytes). If false, calculates using the base-2 Binary standard (1 KiB = 1,024 bytes). Defaults to true.
Converts this double-precision fractional value into a Kapacity instance based on the specified unit and standard.
The resulting byte count is rounded to the nearest whole byte. By default, this uses the Metric (SI) standard (powers of 1,000). For example, converting 1.5 with a unit of Megabytes will result in 1,500,000 bytes. If useMetric is set to false, the Binary (IEC) standard (powers of 1,024) is used instead, resulting in 1,572,864 bytes.
Return
A strictly-typed Kapacity representing the exact total in bytes.
Parameters
The unit of measurement this value represents (e.g., Kilobyte, Megabyte).
If true, calculates using the base-10 Metric standard (1 KB = 1,000 bytes). If false, calculates using the base-2 Binary standard (1 KiB = 1,024 bytes). Defaults to true.
Converts this single-precision fractional value into a Kapacity instance based on the specified unit and standard.
The resulting byte count is rounded to the nearest whole byte. By default, this uses the Metric (SI) standard (powers of 1,000). If useMetric is set to false, the Binary (IEC) standard (powers of 1,024) is used instead.
Note on Precision: Because Float relies on 24-bit precision, representing large capacities (generally above 16 Megabytes) may result in a loss of exact byte-level precision. For large fractional capacities, prefer using Double.
Return
A strictly-typed Kapacity representing the calculated total in bytes.
Parameters
The unit of measurement this value represents (e.g., Kilobyte, Megabyte).
If true, calculates using the base-10 Metric standard (1 KB = 1,000 bytes). If false, calculates using the base-2 Binary standard (1 KiB = 1,024 bytes). Defaults to true.
Converts this unsigned numerical value into a Kapacity instance based on the specified unit and standard.
By default, this uses the Metric (SI) standard (powers of 1,000). For example, converting 5uL with a unit of Megabytes will result in 5,000,000 bytes. If useMetric is set to false, the Binary (IEC) standard (powers of 1,024) is used instead, resulting in 5,242,880 bytes.
Return
A strictly-typed Kapacity representing the exact total in bytes.
Parameters
The unit of measurement this value represents (e.g., Kilobyte, Megabyte).
If true, calculates using the base-10 Metric standard (1 KB = 1,000 bytes). If false, calculates using the base-2 Binary standard (1 KiB = 1,024 bytes). Defaults to true.