A quantity of binary data, represented as a value (e.g. 30.5) and unit (e.g. mb).
value
30.5
unit
mb
The value of this data size.
Returns Int if possible and Float otherwise.
Int
Float
Facts:
1.mb.value == 1 2.2.mib.value == 2.2
The unit of this data size.
1.mb.unit == "mb" 2.2.mib.unit == "mib"
Tells if this data size has a value of zero or greater.
2.mb.isPositive !(-2.mb.isPositive)
Tells if this data size has a binary unit, for example mib.
mib
Returns true for unit b (bytes).
true
b
Tells if this data size has a decimal unit, for example mb.
Returns the class of this.
this
Returns a string representation of this.
This method is used to convert the values of string interpolation expressions to strings.
Returns this |> transform if this is non-null, and null otherwise.
this |> transform
null
This method is the complement of the ?? operator and the equivalent of an Option type's map and flatMap methods.
??
Option
map
flatMap
Tells if this data size is greater than or equal to start and less than or equal to inclusiveEnd.
start
inclusiveEnd
3.kb.isBetween(2000.b, 4.kb) 3.kb.isBetween(3000.b, 4.kb) 3.kb.isBetween(2000.b, 3.kb) !3.kb.isBetween(1.kb, 2.kb)
Returns the equivalent data size with the given unit.
1000.kb.toUnit("mb") == 1.mb 1.mb.toUnit("kb") == 1000.kb
Returns the equivalent data size with a binary unit.
Returns this data size unchanged if it already has a binary unit.
1024.kb.toBinaryUnit() == 1000.kib 1024.mb.toBinaryUnit() == 1000.mib 1000.kib.toBinaryUnit() == 1000.kib 1000.b.toBinaryUnit() == 1000.b
Returns the equivalent data size with a decimal unit.
Returns this data size unchanged if it already has a decimal unit.
1000.kib.toDecimalUnit() == 1024.kb 1000.mib.toDecimalUnit() == 1024.mb 1000.kb.toDecimalUnit() == 1000.kb 1000.b.toDecimalUnit() == 1000.b
A quantity of binary data, represented as a
value
(e.g.30.5
) andunit
(e.g.mb
).