CooperBytes
in package
implements
Stringable
FinalYes
A CASC byte size (CASC.md ยง6.9) -- `512MiB`, `10GB`, or `!bytes("512MiB")` -- as a whole number of bytes, matching the Elixir original's `{:bytes, count}`.
The count follows the integer rule (CooperInteger): a native int
when it fits in 64 bits, a CooperInteger beyond -- 20000000PiB
was once a load error here and loads in the reference.
Table of Contents
Interfaces
- Stringable
Properties
- $bytes : int|CooperInteger
- The size in bytes.
Methods
- __construct() : mixed
- __toString() : string
- The size in its base unit -- `"536870912B"` -- which is also valid CASC if fed back in.
- equals() : bool
Properties
$bytes read-only
The size in bytes.
public
int|CooperInteger
$bytes
Methods
__construct()
public
__construct(int|CooperInteger $bytes) : mixed
Parameters
- $bytes : int|CooperInteger
-
the size in bytes; a
CooperIntegerthat fits is kept as anint
__toString()
The size in its base unit -- `"536870912B"` -- which is also valid CASC if fed back in.
public
__toString() : string
Return values
string —the byte count with a B suffix
equals()
public
equals(mixed $other) : bool
Parameters
- $other : mixed
-
the value to compare against
Return values
bool —true for a byte size of the same count