PocketMine-MP 5.23.3 git-f7687af337d001ddbcc47b8e773f014a33faa662
Loading...
Searching...
No Matches
pocketmine\nbt\BaseNbtSerializer Class Reference
+ Inheritance diagram for pocketmine\nbt\BaseNbtSerializer:
+ Collaboration diagram for pocketmine\nbt\BaseNbtSerializer:

Public Member Functions

 read (string $buffer, int &$offset=0, int $maxDepth=0)
 
 readByte ()
 
 readByteArray ()
 
 readDouble ()
 
 readFloat ()
 
 readHeadless (string $buffer, int $rootType, int &$offset=0, int $maxDepth=0)
 
 readInt ()
 
 readIntArray ()
 
 readLong ()
 
 readMultiple (string $buffer, int $maxDepth=0)
 
 readShort ()
 
 readSignedByte ()
 
 readSignedShort ()
 
 readString ()
 
 write (TreeRoot $data)
 
 writeByte (int $v)
 
 writeByteArray (string $v)
 
 writeDouble (float $v)
 
 writeFloat (float $v)
 
 writeHeadless (Tag $data)
 
 writeInt (int $v)
 
 writeIntArray (array $array)
 
 writeLong (int $v)
 
 writeMultiple (array $data)
 
 writeShort (int $v)
 
 writeString (string $v)
 

Static Protected Member Functions

static checkReadStringLength (int $len)
 
static checkWriteStringLength (int $len)
 

Protected Attributes

 $buffer
 

Detailed Description

Base Named Binary Tag encoder/decoder

Definition at line 35 of file BaseNbtSerializer.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\nbt\BaseNbtSerializer::__construct ( )

Definition at line 39 of file BaseNbtSerializer.php.

Member Function Documentation

◆ checkReadStringLength()

static pocketmine\nbt\BaseNbtSerializer::checkReadStringLength ( int $len)
staticprotected
Exceptions
NbtDataException

Definition at line 185 of file BaseNbtSerializer.php.

◆ checkWriteStringLength()

static pocketmine\nbt\BaseNbtSerializer::checkWriteStringLength ( int $len)
staticprotected
Exceptions

InvalidArgumentException

Definition at line 195 of file BaseNbtSerializer.php.

◆ read()

pocketmine\nbt\BaseNbtSerializer::read ( string $buffer,
int & $offset = 0,
int $maxDepth = 0 )

Decodes NBT from the given binary string and returns it.

Parameters
int$offsetreference parameter
Exceptions
NbtDataException

Definition at line 64 of file BaseNbtSerializer.php.

◆ readByte()

pocketmine\nbt\BaseNbtSerializer::readByte ( )
Exceptions
BinaryDataException

Implements pocketmine\nbt\NbtStreamReader.

Definition at line 157 of file BaseNbtSerializer.php.

◆ readByteArray()

pocketmine\nbt\BaseNbtSerializer::readByteArray ( )
Exceptions
BinaryDataException

Implements pocketmine\nbt\NbtStreamReader.

Definition at line 169 of file BaseNbtSerializer.php.

◆ readDouble()

pocketmine\nbt\NbtStreamReader::readDouble ( )
inherited

◆ readFloat()

pocketmine\nbt\NbtStreamReader::readFloat ( )
inherited

◆ readHeadless()

pocketmine\nbt\BaseNbtSerializer::readHeadless ( string $buffer,
int $rootType,
int & $offset = 0,
int $maxDepth = 0 )

Reads a tag without a header from the buffer and returns it. The tag does not have a name, and the type is not specified by the binary data. Only the tag's raw binary value is present. This could be used if the expected root type is always the same.

This format is not usually seen in the wild, but it is used in some places in the Minecraft: Bedrock network protocol.

Exceptions
NbtDataException

Definition at line 87 of file BaseNbtSerializer.php.

◆ readInt()

pocketmine\nbt\NbtStreamReader::readInt ( )
inherited

◆ readIntArray()

pocketmine\nbt\NbtStreamReader::readIntArray ( )
inherited

◆ readLong()

pocketmine\nbt\NbtStreamReader::readLong ( )
inherited

◆ readMultiple()

pocketmine\nbt\BaseNbtSerializer::readMultiple ( string $buffer,
int $maxDepth = 0 )

Decodes a list of NBT tags into objects and returns them.

TODO: This is only necessary because we don't have a streams API worth mentioning. Get rid of this in the future.

Returns
TreeRoot[]
Exceptions
NbtDataException

Definition at line 104 of file BaseNbtSerializer.php.

◆ readShort()

pocketmine\nbt\NbtStreamReader::readShort ( )
inherited

◆ readSignedByte()

pocketmine\nbt\BaseNbtSerializer::readSignedByte ( )
Exceptions
BinaryDataException

Implements pocketmine\nbt\NbtStreamReader.

Definition at line 161 of file BaseNbtSerializer.php.

◆ readSignedShort()

pocketmine\nbt\NbtStreamReader::readSignedShort ( )
inherited

◆ readString()

pocketmine\nbt\BaseNbtSerializer::readString ( )
Exceptions
BinaryDataException

Implements pocketmine\nbt\NbtStreamReader.

Reimplemented in pocketmine\network\mcpe\protocol\serializer\NetworkNbtSerializer.

Definition at line 202 of file BaseNbtSerializer.php.

◆ write()

pocketmine\nbt\BaseNbtSerializer::write ( TreeRoot $data)

Definition at line 126 of file BaseNbtSerializer.php.

◆ writeByte()

pocketmine\nbt\BaseNbtSerializer::writeByte ( int $v)

Implements pocketmine\nbt\NbtStreamWriter.

Definition at line 165 of file BaseNbtSerializer.php.

◆ writeByteArray()

pocketmine\nbt\BaseNbtSerializer::writeByteArray ( string $v)

Implements pocketmine\nbt\NbtStreamWriter.

Definition at line 177 of file BaseNbtSerializer.php.

◆ writeHeadless()

pocketmine\nbt\BaseNbtSerializer::writeHeadless ( Tag $data)

Writes a nameless tag without any header information. The reader of the data must know what type to expect, as it is not specified in the data.

See also
BaseNbtSerializer::readHeadless()

Definition at line 140 of file BaseNbtSerializer.php.

◆ writeIntArray()

pocketmine\nbt\NbtStreamWriter::writeIntArray ( array $array)
inherited

◆ writeMultiple()

pocketmine\nbt\BaseNbtSerializer::writeMultiple ( array $data)
Parameters
TreeRoot[]$data

Definition at line 149 of file BaseNbtSerializer.php.

◆ writeString()

pocketmine\nbt\BaseNbtSerializer::writeString ( string $v)
Exceptions

InvalidArgumentException if the string is too long

Implements pocketmine\nbt\NbtStreamWriter.

Reimplemented in pocketmine\network\mcpe\protocol\serializer\NetworkNbtSerializer.

Definition at line 209 of file BaseNbtSerializer.php.

Member Data Documentation

◆ $buffer

pocketmine\nbt\BaseNbtSerializer::$buffer
protected

Definition at line 37 of file BaseNbtSerializer.php.


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