Binary
in package
Table of Contents
- SIZEOF_DOUBLE = 8
- SIZEOF_FLOAT = 4
- SIZEOF_INT = 4
- SIZEOF_LONG = 8
- SIZEOF_SHORT = 2
- flipIntEndianness() : int
- flipLongEndianness() : int
- flipShortEndianness() : int
- printFloat() : string
- Returns a printable floating-point number.
- readBool() : bool
- Reads a byte boolean
- readByte() : int
- Reads an unsigned byte (0 - 255)
- readDouble() : float
- Reads an 8-byte floating-point number.
- readFloat() : float
- Reads a 4-byte floating-point number
- readInt() : int
- Reads a 4-byte signed integer
- readLDouble() : float
- Reads an 8-byte little-endian floating-point number.
- readLFloat() : float
- Reads a 4-byte little-endian floating-point number.
- readLInt() : int
- Reads a 4-byte signed little-endian integer
- readLLong() : int
- Reads an 8-byte little-endian integer.
- readLong() : int
- Reads an 8-byte integer.
- readLShort() : int
- Reads a 16-bit unsigned little-endian number
- readLTriad() : int
- Reads a 3-byte little-endian number
- readRoundedFloat() : float
- Reads a 4-byte floating-point number, rounded to the specified number of decimal places.
- readRoundedLFloat() : float
- Reads a 4-byte little-endian floating-point number rounded to the specified number of decimal places.
- readShort() : int
- Reads a 16-bit unsigned big-endian number
- readSignedByte() : int
- Reads a signed byte (-128 - 127)
- readSignedLShort() : int
- Reads a 16-bit signed little-endian number
- readSignedShort() : int
- Reads a 16-bit signed big-endian number
- readTriad() : int
- Reads a 3-byte big-endian number
- readUnsignedVarInt() : int
- Reads a 32-bit variable-length unsigned integer.
- readUnsignedVarLong() : int
- Reads a 64-bit unsigned variable-length integer.
- readVarInt() : int
- Reads a 32-bit zigzag-encoded variable-length integer.
- readVarLong() : int
- Reads a 64-bit zigzag-encoded variable-length integer.
- signByte() : int
- signInt() : int
- signShort() : int
- unsignByte() : int
- unsignInt() : int
- unsignShort() : int
- writeBool() : string
- Writes a byte boolean
- writeByte() : string
- Writes an unsigned/signed byte
- writeDouble() : string
- Writes an 8-byte floating-point number.
- writeFloat() : string
- Writes a 4-byte floating-point number.
- writeInt() : string
- Writes a 4-byte integer
- writeLDouble() : string
- Writes an 8-byte floating-point little-endian number.
- writeLFloat() : string
- Writes a 4-byte little-endian floating-point number.
- writeLInt() : string
- Writes a 4-byte signed little-endian integer
- writeLLong() : string
- Writes an 8-byte little-endian integer.
- writeLong() : string
- Writes an 8-byte integer.
- writeLShort() : string
- Writes a 16-bit signed/unsigned little-endian number
- writeLTriad() : string
- Writes a 3-byte little-endian number
- writeShort() : string
- Writes a 16-bit signed/unsigned big-endian number
- writeTriad() : string
- Writes a 3-byte big-endian number
- writeUnsignedVarInt() : string
- Writes a 32-bit unsigned integer as a variable-length integer.
- writeUnsignedVarLong() : string
- Writes a 64-bit unsigned integer as a variable-length long.
- writeVarInt() : string
- Writes a 32-bit integer as a zigzag-encoded variable-length integer.
- writeVarLong() : string
- Writes a 64-bit integer as a zigzag-encoded variable-length long.
- safeUnpack() : array<string|int, mixed>
Constants
SIZEOF_DOUBLE
private
mixed
SIZEOF_DOUBLE
= 8
SIZEOF_FLOAT
private
mixed
SIZEOF_FLOAT
= 4
SIZEOF_INT
private
mixed
SIZEOF_INT
= 4
SIZEOF_LONG
private
mixed
SIZEOF_LONG
= 8
SIZEOF_SHORT
private
mixed
SIZEOF_SHORT
= 2
Methods
flipIntEndianness()
public
static flipIntEndianness(int $value) : int
Parameters
- $value : int
Return values
int —flipLongEndianness()
public
static flipLongEndianness(int $value) : int
Parameters
- $value : int
Return values
int —flipShortEndianness()
public
static flipShortEndianness(int $value) : int
Parameters
- $value : int
Return values
int —printFloat()
Returns a printable floating-point number.
public
static printFloat(float $value) : string
Parameters
- $value : float
Return values
string —readBool()
Reads a byte boolean
public
static readBool(string $b) : bool
Parameters
- $b : string
Return values
bool —readByte()
Reads an unsigned byte (0 - 255)
public
static readByte(string $c) : int
Parameters
- $c : string
Tags
Return values
int —readDouble()
Reads an 8-byte floating-point number.
public
static readDouble(string $str) : float
Parameters
- $str : string
Tags
Return values
float —readFloat()
Reads a 4-byte floating-point number
public
static readFloat(string $str) : float
Parameters
- $str : string
Tags
Return values
float —readInt()
Reads a 4-byte signed integer
public
static readInt(string $str) : int
Parameters
- $str : string
Tags
Return values
int —readLDouble()
Reads an 8-byte little-endian floating-point number.
public
static readLDouble(string $str) : float
Parameters
- $str : string
Tags
Return values
float —readLFloat()
Reads a 4-byte little-endian floating-point number.
public
static readLFloat(string $str) : float
Parameters
- $str : string
Tags
Return values
float —readLInt()
Reads a 4-byte signed little-endian integer
public
static readLInt(string $str) : int
Parameters
- $str : string
Tags
Return values
int —readLLong()
Reads an 8-byte little-endian integer.
public
static readLLong(string $str) : int
Parameters
- $str : string
Tags
Return values
int —readLong()
Reads an 8-byte integer.
public
static readLong(string $str) : int
Parameters
- $str : string
Tags
Return values
int —readLShort()
Reads a 16-bit unsigned little-endian number
public
static readLShort(string $str) : int
Parameters
- $str : string
Tags
Return values
int —readLTriad()
Reads a 3-byte little-endian number
public
static readLTriad(string $str) : int
Parameters
- $str : string
Tags
Return values
int —readRoundedFloat()
Reads a 4-byte floating-point number, rounded to the specified number of decimal places.
public
static readRoundedFloat(string $str, int $accuracy) : float
Parameters
- $str : string
- $accuracy : int
Tags
Return values
float —readRoundedLFloat()
Reads a 4-byte little-endian floating-point number rounded to the specified number of decimal places.
public
static readRoundedLFloat(string $str, int $accuracy) : float
Parameters
- $str : string
- $accuracy : int
Tags
Return values
float —readShort()
Reads a 16-bit unsigned big-endian number
public
static readShort(string $str) : int
Parameters
- $str : string
Tags
Return values
int —readSignedByte()
Reads a signed byte (-128 - 127)
public
static readSignedByte(string $c) : int
Parameters
- $c : string
Tags
Return values
int —readSignedLShort()
Reads a 16-bit signed little-endian number
public
static readSignedLShort(string $str) : int
Parameters
- $str : string
Tags
Return values
int —readSignedShort()
Reads a 16-bit signed big-endian number
public
static readSignedShort(string $str) : int
Parameters
- $str : string
Tags
Return values
int —readTriad()
Reads a 3-byte big-endian number
public
static readTriad(string $str) : int
Parameters
- $str : string
Tags
Return values
int —readUnsignedVarInt()
Reads a 32-bit variable-length unsigned integer.
public
static readUnsignedVarInt(string $buffer, int &$offset) : int
Parameters
- $buffer : string
- $offset : int
-
reference parameter
Tags
Return values
int —readUnsignedVarLong()
Reads a 64-bit unsigned variable-length integer.
public
static readUnsignedVarLong(string $buffer, int &$offset) : int
Parameters
- $buffer : string
- $offset : int
-
reference parameter
Tags
Return values
int —readVarInt()
Reads a 32-bit zigzag-encoded variable-length integer.
public
static readVarInt(string $buffer, int &$offset) : int
Parameters
- $buffer : string
- $offset : int
-
reference parameter
Tags
Return values
int —readVarLong()
Reads a 64-bit zigzag-encoded variable-length integer.
public
static readVarLong(string $buffer, int &$offset) : int
Parameters
- $buffer : string
- $offset : int
-
reference parameter
Tags
Return values
int —signByte()
public
static signByte(int $value) : int
Parameters
- $value : int
Return values
int —signInt()
public
static signInt(int $value) : int
Parameters
- $value : int
Return values
int —signShort()
public
static signShort(int $value) : int
Parameters
- $value : int
Return values
int —unsignByte()
public
static unsignByte(int $value) : int
Parameters
- $value : int
Return values
int —unsignInt()
public
static unsignInt(int $value) : int
Parameters
- $value : int
Return values
int —unsignShort()
public
static unsignShort(int $value) : int
Parameters
- $value : int
Return values
int —writeBool()
Writes a byte boolean
public
static writeBool(bool $b) : string
Parameters
- $b : bool
Return values
string —writeByte()
Writes an unsigned/signed byte
public
static writeByte(int $c) : string
Parameters
- $c : int
Return values
string —writeDouble()
Writes an 8-byte floating-point number.
public
static writeDouble(float $value) : string
Parameters
- $value : float
Return values
string —writeFloat()
Writes a 4-byte floating-point number.
public
static writeFloat(float $value) : string
Parameters
- $value : float
Return values
string —writeInt()
Writes a 4-byte integer
public
static writeInt(int $value) : string
Parameters
- $value : int
Return values
string —writeLDouble()
Writes an 8-byte floating-point little-endian number.
public
static writeLDouble(float $value) : string
Parameters
- $value : float
Return values
string —writeLFloat()
Writes a 4-byte little-endian floating-point number.
public
static writeLFloat(float $value) : string
Parameters
- $value : float
Return values
string —writeLInt()
Writes a 4-byte signed little-endian integer
public
static writeLInt(int $value) : string
Parameters
- $value : int
Return values
string —writeLLong()
Writes an 8-byte little-endian integer.
public
static writeLLong(int $value) : string
Parameters
- $value : int
Return values
string —writeLong()
Writes an 8-byte integer.
public
static writeLong(int $value) : string
Parameters
- $value : int
Return values
string —writeLShort()
Writes a 16-bit signed/unsigned little-endian number
public
static writeLShort(int $value) : string
Parameters
- $value : int
Return values
string —writeLTriad()
Writes a 3-byte little-endian number
public
static writeLTriad(int $value) : string
Parameters
- $value : int
Return values
string —writeShort()
Writes a 16-bit signed/unsigned big-endian number
public
static writeShort(int $value) : string
Parameters
- $value : int
Return values
string —writeTriad()
Writes a 3-byte big-endian number
public
static writeTriad(int $value) : string
Parameters
- $value : int
Return values
string —writeUnsignedVarInt()
Writes a 32-bit unsigned integer as a variable-length integer.
public
static writeUnsignedVarInt(int $value) : string
Parameters
- $value : int
Return values
string —up to 5 bytes
writeUnsignedVarLong()
Writes a 64-bit unsigned integer as a variable-length long.
public
static writeUnsignedVarLong(int $value) : string
Parameters
- $value : int
Return values
string —writeVarInt()
Writes a 32-bit integer as a zigzag-encoded variable-length integer.
public
static writeVarInt(int $v) : string
Parameters
- $v : int
Return values
string —writeVarLong()
Writes a 64-bit integer as a zigzag-encoded variable-length long.
public
static writeVarLong(int $v) : string
Parameters
- $v : int
Return values
string —safeUnpack()
private
static safeUnpack(string $formatCode, string $bytes, int $needLength) : array<string|int, mixed>
Parameters
- $formatCode : string
- $bytes : string
- $needLength : int