Class org.as2lib.data.type.Bit

Description

Bit is represents a bit value.

Bit can be used for a different kind of formatting of a bit value. It allows to access the value as bit, kilo-bit, mega-bit, giga-bit, tera-bit, byte, kilo-byte, mega-byte, giga-byte and tera-byte.

Field Index

DEFAULT_FLOATING_POINTS

Method Index

new Bit()
getBit(), getBytes(), getGigaBit(), getGigaBytes(), getKiloBit(), getKiloBytes(), getMegaBit(), getMegaBytes(), getTeraBit(), getTeraBytes(), setFloatingPoints(), toString(), valueOf()

Constructor Detail

Bit

public function Bit(bit:Number)

Constructs a new Bit.

Parameters

bitvalue in bit

Field Detail

DEFAULT_FLOATING_POINTS

static public DEFAULT_FLOATING_POINTS:Number
Default floating points used.

Method Detail

setFloatingPoints

public function setFloatingPoints(fp:Number):Bit

Sets the used amount of values after the comma.

This method does not change anything if fp is smaller than 0 or not passed-in.

Parameters

fpamount of characters after the floating point

Return

the current instance

getBit

public function getBit(Void):Number

Returns the value in bit.

Return

value in bit

getBytes

public function getBytes(Void):Number

Returns the value in bytes.

Return

value in bytes

getKiloBit

public function getKiloBit(Void):Number

Returns the value in kilobit.

Return

value in kilobit

getKiloBytes

public function getKiloBytes(Void):Number

Returns the value in kilobytes.

Return

value in kilobytes

getMegaBit

public function getMegaBit(Void):Number

Returns the value in megabit.

Return

value in megabit

getMegaBytes

public function getMegaBytes(Void):Number

Returns the value in megabytes.

Return

value in megabytes

getGigaBit

public function getGigaBit(Void):Number

Returns the value in gigabit.

Return

value in gigabit

getGigaBytes

public function getGigaBytes(Void):Number

Returns the value in gigabytes.

Return

value in gigabytes

getTeraBit

public function getTeraBit(Void):Number

Returns the value in terabit.

Return

value in terabit

getTeraBytes

public function getTeraBytes(Void):Number

Returns the value in terabytes.

Return

value in terabytes

toString

public function toString():String

Extended toString method for a well formatted bit value.

This method uses the next matching size and adds the matching Shortname for it.

Examples: new BitFormat(1).toString(); // 1b new BitFormat(1234).toString(); // 1.21Kb new BitFormat(15002344).toString(); // 14.31Mb

Return

bits in the next matching size with the matchin unit

Specified By

toString() in org.as2lib.core.BasicInterface

Overrides

toString() in org.as2lib.core.BasicClass

See Also

valueOf

public function valueOf():Number