ByteSize class

ByteSize handles how byte sizes are represented.

var size = new ByteSize(1024);
Implemented types
  • Comparable

Constructors

ByteSize([num byteSize = 0])
Initialize class with the size in Bytes denoted by byteSize. [...]

Properties

Bits → int
Returns the size in Bits
read-only
Bytes → num
Returns the size in Bytes
read-only
GigaBytes → num
Returns the size in GigaBytes
read-only
KiloBytes → num
Returns the size in KiloBytes
read-only
MegaBytes → num
Returns the size in MegaBytes
read-only
PetaBytes → num
Returns the size in PetaBytes
read-only
TeraBytes → num
Returns the size in TeraBytes
read-only
hashCode → int
The hash code for this object. [...]
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

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
Subtract(ByteSize bs) ByteSize
Returns the difference of two ByteSize objects.
ToString([String symbol = 'KB', int precision = 2, Locale locale_LANG = Locale.en_US]) → String
Returns the string representation of the ByteSize instance i.e passing the symbol, precision and or locale_LANG as arguments. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() → String
Returns a string representation of this object.
inherited

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(int 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. [...]