Access keys

Bit

Kind of class: class
Inherits from: BasicClass
Known subclasses:
Version: 1.1
Author: Martin Heidegger
Classpath: org.as2lib.data.type.Bit
File last modified: Thursday, 13 October 2005, 15:21:00
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.

Constructor

Bit

function Bit (
bit:Number)
Constructs a new Bit.
Parameters:
bit:
value in bit

Class properties

DEFAULT_FLOATING_POINTS

static DEFAULT_FLOATING_POINTS:Number = 2
(read,write)
Default floating points used.

Instance methods

getBit

function getBit (
Void) : Number
Returns the value in bit.
Returns:
value in bit

getBytes

function getBytes (
Void) : Number
Returns the value in bytes.
Returns:
value in bytes

getGigaBit

function getGigaBit (
Void) : Number
Returns the value in gigabit.
Returns:
value in gigabit

getGigaBytes

function getGigaBytes (
Void) : Number
Returns the value in gigabytes.
Returns:
value in gigabytes

getKiloBit

function getKiloBit (
Void) : Number
Returns the value in kilobit.
Returns:
value in kilobit

getKiloBytes

function getKiloBytes (
Void) : Number
Returns the value in kilobytes.
Returns:
value in kilobytes

getMegaBit

function getMegaBit (
Void) : Number
Returns the value in megabit.
Returns:
value in megabit

getMegaBytes

function getMegaBytes (
Void) : Number
Returns the value in megabytes.
Returns:
value in megabytes

getTeraBit

function getTeraBit (
Void) : Number
Returns the value in terabit.
Returns:
value in terabit

getTeraBytes

function getTeraBytes (
Void) : Number
Returns the value in terabytes.
Returns:
value in terabytes

setFloatingPoints

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:
fp:
amount of characters after the floating point
Returns:
the current instance

toString

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
Returns:
bits in the next matching size with the matchin unit

valueOf

function valueOf (
) : Number