PocketMine-MP 5.15.1 git-fb9a74e8799c71ed8292cfa53abe7a4c9204629d
pocketmine\utils\Binary Class Reference
+ Collaboration diagram for pocketmine\utils\Binary:

Static Public Member Functions

static flipIntEndianness (int $value)
 
static flipLongEndianness (int $value)
 
static flipShortEndianness (int $value)
 
static printFloat (float $value)
 
static readBool (string $b)
 
static readByte (string $c)
 
static readDouble (string $str)
 
static readFloat (string $str)
 
static readInt (string $str)
 
static readLDouble (string $str)
 
static readLFloat (string $str)
 
static readLInt (string $str)
 
static readLLong (string $str)
 
static readLong (string $str)
 
static readLShort (string $str)
 
static readLTriad (string $str)
 
static readRoundedFloat (string $str, int $accuracy)
 
static readRoundedLFloat (string $str, int $accuracy)
 
static readShort (string $str)
 
static readSignedByte (string $c)
 
static readSignedLShort (string $str)
 
static readSignedShort (string $str)
 
static readTriad (string $str)
 
static readUnsignedVarInt (string $buffer, int &$offset)
 
static readUnsignedVarLong (string $buffer, int &$offset)
 
static readVarInt (string $buffer, int &$offset)
 
static readVarLong (string $buffer, int &$offset)
 
static signByte (int $value)
 
static signInt (int $value)
 
static signShort (int $value)
 
static unsignByte (int $value)
 
static unsignInt (int $value)
 
static unsignShort (int $value)
 
static writeBool (bool $b)
 
static writeByte (int $c)
 
static writeDouble (float $value)
 
static writeFloat (float $value)
 
static writeInt (int $value)
 
static writeLDouble (float $value)
 
static writeLFloat (float $value)
 
static writeLInt (int $value)
 
static writeLLong (int $value)
 
static writeLong (int $value)
 
static writeLShort (int $value)
 
static writeLTriad (int $value)
 
static writeShort (int $value)
 
static writeTriad (int $value)
 
static writeUnsignedVarInt (int $value)
 
static writeUnsignedVarLong (int $value)
 
static writeVarInt (int $v)
 
static writeVarLong (int $v)
 

Detailed Description

Definition at line 41 of file Binary.php.

Member Function Documentation

◆ flipIntEndianness()

static pocketmine\utils\Binary::flipIntEndianness ( int  $value)
static

Definition at line 77 of file Binary.php.

◆ flipLongEndianness()

static pocketmine\utils\Binary::flipLongEndianness ( int  $value)
static

Definition at line 81 of file Binary.php.

◆ flipShortEndianness()

static pocketmine\utils\Binary::flipShortEndianness ( int  $value)
static

Definition at line 73 of file Binary.php.

◆ printFloat()

static pocketmine\utils\Binary::printFloat ( float  $value)
static

Returns a printable floating-point number.

Definition at line 315 of file Binary.php.

◆ readBool()

static pocketmine\utils\Binary::readBool ( string  $b)
static

Reads a byte boolean

Definition at line 106 of file Binary.php.

◆ readByte()

static pocketmine\utils\Binary::readByte ( string  $c)
static

Reads an unsigned byte (0 - 255)

Exceptions
BinaryDataException

Definition at line 122 of file Binary.php.

◆ readDouble()

static pocketmine\utils\Binary::readDouble ( string  $str)
static

Reads an 8-byte floating-point number.

Exceptions
BinaryDataException

Definition at line 324 of file Binary.php.

◆ readFloat()

static pocketmine\utils\Binary::readFloat ( string  $str)
static

Reads a 4-byte floating-point number

Exceptions
BinaryDataException

Definition at line 267 of file Binary.php.

◆ readInt()

static pocketmine\utils\Binary::readInt ( string  $str)
static

Reads a 4-byte signed integer

Exceptions
BinaryDataException

Definition at line 235 of file Binary.php.

◆ readLDouble()

static pocketmine\utils\Binary::readLDouble ( string  $str)
static

Reads an 8-byte little-endian floating-point number.

Exceptions
BinaryDataException

Definition at line 340 of file Binary.php.

◆ readLFloat()

static pocketmine\utils\Binary::readLFloat ( string  $str)
static

Reads a 4-byte little-endian floating-point number.

Exceptions
BinaryDataException

Definition at line 292 of file Binary.php.

◆ readLInt()

static pocketmine\utils\Binary::readLInt ( string  $str)
static

Reads a 4-byte signed little-endian integer

Exceptions
BinaryDataException

Definition at line 251 of file Binary.php.

◆ readLLong()

static pocketmine\utils\Binary::readLLong ( string  $str)
static

Reads an 8-byte little-endian integer.

Exceptions
BinaryDataException

Definition at line 372 of file Binary.php.

◆ readLong()

static pocketmine\utils\Binary::readLong ( string  $str)
static

Reads an 8-byte integer.

Exceptions
BinaryDataException

Definition at line 356 of file Binary.php.

◆ readLShort()

static pocketmine\utils\Binary::readLShort ( string  $str)
static

Reads a 16-bit unsigned little-endian number

Exceptions
BinaryDataException

Definition at line 178 of file Binary.php.

◆ readLTriad()

static pocketmine\utils\Binary::readLTriad ( string  $str)
static

Reads a 3-byte little-endian number

Exceptions
BinaryDataException

Definition at line 219 of file Binary.php.

◆ readRoundedFloat()

static pocketmine\utils\Binary::readRoundedFloat ( string  $str,
int  $accuracy 
)
static

Reads a 4-byte floating-point number, rounded to the specified number of decimal places.

Exceptions
BinaryDataException

Definition at line 276 of file Binary.php.

◆ readRoundedLFloat()

static pocketmine\utils\Binary::readRoundedLFloat ( string  $str,
int  $accuracy 
)
static

Reads a 4-byte little-endian floating-point number rounded to the specified number of decimal places.

Exceptions
BinaryDataException

Definition at line 301 of file Binary.php.

◆ readShort()

static pocketmine\utils\Binary::readShort ( string  $str)
static

Reads a 16-bit unsigned big-endian number

Exceptions
BinaryDataException

Definition at line 153 of file Binary.php.

◆ readSignedByte()

static pocketmine\utils\Binary::readSignedByte ( string  $c)
static

Reads a signed byte (-128 - 127)

Exceptions
BinaryDataException

Definition at line 134 of file Binary.php.

◆ readSignedLShort()

static pocketmine\utils\Binary::readSignedLShort ( string  $str)
static

Reads a 16-bit signed little-endian number

Exceptions
BinaryDataException

Definition at line 187 of file Binary.php.

◆ readSignedShort()

static pocketmine\utils\Binary::readSignedShort ( string  $str)
static

Reads a 16-bit signed big-endian number

Exceptions
BinaryDataException

Definition at line 162 of file Binary.php.

◆ readTriad()

static pocketmine\utils\Binary::readTriad ( string  $str)
static

Reads a 3-byte big-endian number

Exceptions
BinaryDataException

Definition at line 203 of file Binary.php.

◆ readUnsignedVarInt()

static pocketmine\utils\Binary::readUnsignedVarInt ( string  $buffer,
int &  $offset 
)
static

Reads a 32-bit variable-length unsigned integer.

Parameters
int$offsetreference parameter
Exceptions
BinaryDataExceptionif the var-int did not end after 5 bytes or there were not enough bytes

Definition at line 403 of file Binary.php.

◆ readUnsignedVarLong()

static pocketmine\utils\Binary::readUnsignedVarLong ( string  $buffer,
int &  $offset 
)
static

Reads a 64-bit unsigned variable-length integer.

Parameters
int$offsetreference parameter
Exceptions
BinaryDataExceptionif the var-int did not end after 10 bytes or there were not enough bytes

Definition at line 470 of file Binary.php.

◆ readVarInt()

static pocketmine\utils\Binary::readVarInt ( string  $buffer,
int &  $offset 
)
static

Reads a 32-bit zigzag-encoded variable-length integer.

Parameters
int$offsetreference parameter
Exceptions
BinaryDataException

Definition at line 390 of file Binary.php.

◆ readVarLong()

static pocketmine\utils\Binary::readVarLong ( string  $buffer,
int &  $offset 
)
static

Reads a 64-bit zigzag-encoded variable-length integer.

Parameters
int$offsetreference parameter
Exceptions
BinaryDataException

Definition at line 457 of file Binary.php.

◆ signByte()

static pocketmine\utils\Binary::signByte ( int  $value)
static

Definition at line 49 of file Binary.php.

◆ signInt()

static pocketmine\utils\Binary::signInt ( int  $value)
static

Definition at line 65 of file Binary.php.

◆ signShort()

static pocketmine\utils\Binary::signShort ( int  $value)
static

Definition at line 57 of file Binary.php.

◆ unsignByte()

static pocketmine\utils\Binary::unsignByte ( int  $value)
static

Definition at line 53 of file Binary.php.

◆ unsignInt()

static pocketmine\utils\Binary::unsignInt ( int  $value)
static

Definition at line 69 of file Binary.php.

◆ unsignShort()

static pocketmine\utils\Binary::unsignShort ( int  $value)
static

Definition at line 61 of file Binary.php.

◆ writeBool()

static pocketmine\utils\Binary::writeBool ( bool  $b)
static

Writes a byte boolean

Definition at line 113 of file Binary.php.

◆ writeByte()

static pocketmine\utils\Binary::writeByte ( int  $c)
static

Writes an unsigned/signed byte

Definition at line 144 of file Binary.php.

◆ writeDouble()

static pocketmine\utils\Binary::writeDouble ( float  $value)
static

Writes an 8-byte floating-point number.

Definition at line 331 of file Binary.php.

◆ writeFloat()

static pocketmine\utils\Binary::writeFloat ( float  $value)
static

Writes a 4-byte floating-point number.

Definition at line 283 of file Binary.php.

◆ writeInt()

static pocketmine\utils\Binary::writeInt ( int  $value)
static

Writes a 4-byte integer

Definition at line 242 of file Binary.php.

◆ writeLDouble()

static pocketmine\utils\Binary::writeLDouble ( float  $value)
static

Writes an 8-byte floating-point little-endian number.

Definition at line 347 of file Binary.php.

◆ writeLFloat()

static pocketmine\utils\Binary::writeLFloat ( float  $value)
static

Writes a 4-byte little-endian floating-point number.

Definition at line 308 of file Binary.php.

◆ writeLInt()

static pocketmine\utils\Binary::writeLInt ( int  $value)
static

Writes a 4-byte signed little-endian integer

Definition at line 258 of file Binary.php.

◆ writeLLong()

static pocketmine\utils\Binary::writeLLong ( int  $value)
static

Writes an 8-byte little-endian integer.

Definition at line 379 of file Binary.php.

◆ writeLong()

static pocketmine\utils\Binary::writeLong ( int  $value)
static

Writes an 8-byte integer.

Definition at line 363 of file Binary.php.

◆ writeLShort()

static pocketmine\utils\Binary::writeLShort ( int  $value)
static

Writes a 16-bit signed/unsigned little-endian number

Definition at line 194 of file Binary.php.

◆ writeLTriad()

static pocketmine\utils\Binary::writeLTriad ( int  $value)
static

Writes a 3-byte little-endian number

Definition at line 226 of file Binary.php.

◆ writeShort()

static pocketmine\utils\Binary::writeShort ( int  $value)
static

Writes a 16-bit signed/unsigned big-endian number

Definition at line 169 of file Binary.php.

◆ writeTriad()

static pocketmine\utils\Binary::writeTriad ( int  $value)
static

Writes a 3-byte big-endian number

Definition at line 210 of file Binary.php.

◆ writeUnsignedVarInt()

static pocketmine\utils\Binary::writeUnsignedVarInt ( int  $value)
static

Writes a 32-bit unsigned integer as a variable-length integer.

Returns
string up to 5 bytes

Definition at line 433 of file Binary.php.

◆ writeUnsignedVarLong()

static pocketmine\utils\Binary::writeUnsignedVarLong ( int  $value)
static

Writes a 64-bit unsigned integer as a variable-length long.

Definition at line 497 of file Binary.php.

◆ writeVarInt()

static pocketmine\utils\Binary::writeVarInt ( int  $v)
static

Writes a 32-bit integer as a zigzag-encoded variable-length integer.

Definition at line 423 of file Binary.php.

◆ writeVarLong()

static pocketmine\utils\Binary::writeVarLong ( int  $v)
static

Writes a 64-bit integer as a zigzag-encoded variable-length long.

Definition at line 490 of file Binary.php.


The documentation for this class was generated from the following file: