Class ByteSize

Description

A representation of a Byte size. Provides easy conversion between B, KB, MB, etc as well as a pretty string reprentation

Located in /harmoni/core/Primitives/Numbers/ByteSize.class.php (line 26)

SObject
   |
   --Magnitude
      |
      --Number
         |
         --Integer
            |
            --ByteSize
Method Summary
string asKBString ()
string asMBString ()
object ByteSize fromString (string $stringValue, [optional $class = 'ByteSize'])
integer kiloBytes ()
integer megaBytes ()
float multipleOfPowerOf2 (integer $power)
string printableString ()
string suffixForPower (integer $power)
integer value ()
object ByteSize withValue (integer $value, [optional $class = 'ByteSize'])
object ByteSize zero ([optional $class = 'ByteSize'])
void _setValue (mixed $value)
Methods
asKBString (line 145)

Answer the string in kilo bytes (kB)

  • since: 10/11/05
  • access: public
string asKBString ()
asMBString (line 156)

Answer the string in mega bytes (MB)

  • since: 10/11/05
  • access: public
string asMBString ()
fromString (line 67)

Answer a new object with the string value specified.

  • since: 7/14/05
  • access: public
object ByteSize fromString (string $stringValue, [optional $class = 'ByteSize'])
  • string $stringValue: String representation of the size
  • optional $class: string $class The class to instantiate. Do NOT use outside of this package.

Redefinition of:
Integer::fromString()
Answer a new object with the value specified
kiloBytes (line 198)

Answer the value in Kilo Bytes KB

  • since: 10/11/05
  • access: public
integer kiloBytes ()
megaBytes (line 209)

Answer the value in Mega Bytes (MB)

  • since: 10/11/05
  • access: public
integer megaBytes ()
multipleOfPowerOf2 (line 187)

Answer the value as a multiple of 2^$power.

Ex: for the number in kilo bytes (in computer-terms), $power = 10;

  • since: 10/11/05
  • access: public
float multipleOfPowerOf2 (integer $power)
  • integer $power: 0 for bytes, 10 for kilobyes, 20 for megabytes, etc.
printableString (line 124)

Answer a String whose characters are a description of the receiver.

Override this method as needed to provide a better representation

  • since: 7/11/05
  • access: public
string printableString ()

Redefinition of:
Number::printableString()
Answer a String whose characters are a description of the receiver.
suffixForPower (line 43)

Answer the string suffix for the desired muliple of 2^10 bytes i.e. 0 -> B, 10 -> kB, 20 -> MB, 30 -> GB, etc.

  • since: 10/11/05
  • access: public
string suffixForPower (integer $power)
  • integer $power: A multiple of 10; Range, 0-80
value (line 174)

Answer the PHP primitive value of the reciever.

We need to store our internal representation as a float to allow for very large integers, but we never want to return a decimal number of bytes.

  • since: 7/14/05
  • access: public
integer value ()

Redefinition of:
Number::value()
Answer the PHP primitive value of the reciever.
withValue (line 95)

Answer a new object with the value specified

  • since: 7/14/05
  • access: public
object ByteSize withValue (integer $value, [optional $class = 'ByteSize'])
  • integer $value: Integer number of Bytes
  • optional $class: string $class The class to instantiate. Do NOT use outside of this package.

Redefinition of:
Integer::withValue()
Answer a new object with the value specified
zero (line 108)

Answer a new object with the value zero

  • since: 7/14/05
  • access: public
object ByteSize zero ([optional $class = 'ByteSize'])
  • optional $class: string $class The class to instantiate. Do NOT use outside of this package.

Redefinition of:
Integer::zero()
Answer a new object with the value zero
_setValue (line 225)

Set the internal value to a PHP primitive.

  • since: 7/14/05
  • access: private
void _setValue (mixed $value)
  • mixed $value

Redefinition of:
Integer::_setValue()
Set the internal value to a PHP primitive.

Inherited Methods

Inherited From Integer

Integer::dividedBy()
Integer::fromString()
Integer::multipliedBy()
Integer::plus()
Integer::withValue()
Integer::zero()
Integer::_setValue()

Inherited From Number

Number::abs()
Number::asDouble()
Number::asFloat()
Number::asInteger()
Number::asNumber()
Number::ceiling()
Number::dividedBy()
Number::floor()
Number::fromString()
Number::isEqualTo()
Number::isLessThan()
Number::minus()
Number::modIntegerQuotient()
Number::modulo()
Number::multipliedBy()
Number::negated()
Number::plus()
Number::printableString()
Number::reciprical()
Number::remainder()
Number::remIntegerQuotient()
Number::truncated()
Number::value()
Number::withValue()
Number::zero()
Number::_setValue()

Inherited From Magnitude

Magnitude::isBetween()
Magnitude::isEqualTo()
Magnitude::isGreaterThan()
Magnitude::isGreaterThanOrEqualTo()
Magnitude::isLessThan()
Magnitude::isLessThanOrEqualTo()
Magnitude::max()
Magnitude::min()

Inherited From SObject

SObject::asA()
SObject::asString()
SObject::copy()
SObject::copySameFrom()
SObject::copyTwoLevel()
SObject::deepCopy()
SObject::isEqual()
SObject::isEqualTo()
SObject::isNotEqualTo()
SObject::isNotReferenceTo()
SObject::isReferenceTo()
SObject::newFrom()
SObject::postCopy()
SObject::printableString()
SObject::shallowCopy()
SObject::_deepCopyArray()

Documentation generated on Wed, 19 Sep 2007 10:21:56 -0400 by phpDocumentor 1.3.0RC3