ByteSize class

ByteSize handles how byte sizes are represented.

var size = new ByteSize(1024);
Implemented types

Constructors

ByteSize([num byteSize = 0])
Initialize class with the size in Bytes denoted by byteSize.
ByteSize.fromJson(Map<String, Object> entityMap)
Initialize ByteSize object from JSON object according to order of precedence i.e from 'b' -> 'PB', where 'b' has higher precedence to 'KB' and 'MB' has higher precedence to 'GB' and so on.

Properties

Bits int
Returns the size in Bits
no setter
Bytes num
Returns the size in Bytes
no setter
GigaBytes num
Returns the size in GigaBytes
no setter
hashCode int
The hash code for this object.
no setterinherited
KiloBytes num
Returns the size in KiloBytes
no setter
MegaBytes num
Returns the size in MegaBytes
no setter
PetaBytes num
Returns the size in PetaBytes
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
TeraBytes num
Returns the size in TeraBytes
no setter

Methods

add(ByteSize bs) ByteSize
Returns the sum of two ByteSize objects.
addBits(int value) ByteSize
Returns the sum of size in Bits and current ByteSize instance.
addBytes(num value) ByteSize
Returns the sum of size in Bytes and current ByteSize instance.
addGigaBytes(num value) ByteSize
Returns the sum of size in GigaBytes and current ByteSize instance.
addKiloBytes(num value) ByteSize
Returns the sum of size in KiloBytes and current ByteSize instance.
addMegaBytes(num value) ByteSize
Returns the sum of size in MegaBytes and current ByteSize instance.
addPetaBytes(num value) ByteSize
Returns the sum of size in PetaBytes and current ByteSize instance.
addTeraBytes(num value) ByteSize
Returns the sum of size in TeraBytes and current ByteSize instance.
compareTo(dynamic bs) int
Returns -1, 0 or 1 when passed another ByteSize object.
override
copy() ByteSize
Returns an exact copy of the ByteSize object
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
subtract(ByteSize bs) ByteSize
Returns the difference of two ByteSize objects.
toJson() Map<String, Object>
Converts ByteSize object to JSON object
toString([String symbol = 'KB', int precision = 2, String locale_LANG = 'en_US']) String
Returns the string representation of the ByteSize instance i.e passing the symbol, precision and or locale_LANG as arguments.
override

Operators

operator +(ByteSize bs) ByteSize
Returns the sum of two ByteSize objects.
operator -(ByteSize bs) ByteSize
Returns the difference of two ByteSize objects.
operator <(ByteSize bs) bool
Returns if current ByteSize instance is less than another.
operator <=(ByteSize bs) bool
Returns if current ByteSize instance is less than or equals another.
operator ==(dynamic bs) bool
Returns if current ByteSize instance is equal to another.
override
operator >(ByteSize bs) bool
Returns if current ByteSize instance is greater than another.
operator >=(ByteSize bs) bool
Returns if current ByteSize instance is greater than or equals another.

Static Methods

FromBits(dynamic value) ByteSize
Returns a ByteSize object initialized by size in Bits.
FromBytes(num value) ByteSize
Returns a ByteSize object initialized by size in Bytes.
FromGigaBytes(num value) ByteSize
Returns a ByteSize object initialized by size in GigaBytes.
FromKiloBytes(num value) ByteSize
Returns a ByteSize object initialized by size in KiloBytes.
FromMegaBytes(num value) ByteSize
Returns a ByteSize object initialized by size in MegaBytes.
FromPetaBytes(num value) ByteSize
Returns a ByteSize object initialized by size in PetaBytes.
FromTeraBytes(num value) ByteSize
Returns a ByteSize object initialized by size in TeraBytes.
GetMaxValue() ByteSize
Returns the maximum possible ByteSize objects.
GetMinValue() ByteSize
Returns the minimum possible ByteSize objects.
Parse(String value) ByteSize
Returns a ByteSize object by parsing a string value and throws an exception if argument is incorrectly formatted.
TryParse(String value) ParseOutput
Returns a ParseOutput object by parsing a string value.