PocketMine-MP 5.15.1 git-5ef247620a7c6301a849b54e5ef1009217729fc8
pocketmine\network\mcpe\compression\ZlibCompressor Class Reference
+ Inheritance diagram for pocketmine\network\mcpe\compression\ZlibCompressor:
+ Collaboration diagram for pocketmine\network\mcpe\compression\ZlibCompressor:

Public Member Functions

 __construct (private int $level, private ?int $minCompressionSize, private int $maxDecompressionSize)
 compress (string $payload)
 decompress (string $payload)
 getCompressionThreshold ()
 getNetworkId ()

Public Attributes

const DEFAULT_MAX_DECOMPRESSION_SIZE = 8 * 1024 * 1024

Detailed Description

Definition at line 36 of file ZlibCompressor.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\network\mcpe\compression\ZlibCompressor::__construct ( private int  $level,
private ?int  $minCompressionSize,
private int  $maxDecompressionSize 

Definition at line 50 of file ZlibCompressor.php.

Member Function Documentation

◆ compress()

pocketmine\network\mcpe\compression\ZlibCompressor::compress ( string  $payload)

Implements pocketmine\network\mcpe\compression\Compressor.

Definition at line 71 of file ZlibCompressor.php.

◆ decompress()

pocketmine\network\mcpe\compression\ZlibCompressor::decompress ( string  $payload)

◆ getCompressionThreshold()

pocketmine\network\mcpe\compression\ZlibCompressor::getCompressionThreshold ( )

Returns the minimum size of packet batch that the compressor will attempt to compress.

The compressor's output MUST still be valid input for the decompressor even if the compressor input is below this threshold. However, it may choose to use a cheaper compression option (e.g. zlib level 0, which simply wraps the data and doesn't attempt to compress it) to avoid wasting CPU time.

Implements pocketmine\network\mcpe\compression\Compressor.

Definition at line 56 of file ZlibCompressor.php.

◆ getNetworkId()

pocketmine\network\mcpe\compression\ZlibCompressor::getNetworkId ( )

Returns the canonical ID of this compressor, used to tell the remote end how to decompress a packet compressed with this compressor.


Implements pocketmine\network\mcpe\compression\Compressor.

Definition at line 80 of file ZlibCompressor.php.

Member Data Documentation


const pocketmine\network\mcpe\compression\ZlibCompressor::DEFAULT_LEVEL = 7

Definition at line 39 of file ZlibCompressor.php.


const pocketmine\network\mcpe\compression\ZlibCompressor::DEFAULT_MAX_DECOMPRESSION_SIZE = 8 * 1024 * 1024

Definition at line 41 of file ZlibCompressor.php.


const pocketmine\network\mcpe\compression\ZlibCompressor::DEFAULT_THRESHOLD = 256

Definition at line 40 of file ZlibCompressor.php.

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