Module erl_nbt_decode

Provides decoding/parsing functions for NBT data.

Copyright © (C) 2021 hypothermic.nl

Authors: Matthijs Bakker (matthijs at hypothermic .nl).

Description

Provides decoding/parsing functions for NBT data

Function Index

decode/1Decodes the first (nested) NBT tag in the specified binary.
decode_byte/1*
decode_double/1*
decode_float/1*
decode_int/1*
decode_long/1*
decode_short/1*
decode_string/1*
decode_tag/4*

Function Details

decode/1

decode(Binary::binary()) -> {ok, Nbt::erl_nbt:nbt(), Rest::binary()} | {error, {max_depth_reached, Depth::integer()}} | {error, {max_count_reached, Count::integer()}} | {error, {unknown_tag_id, EncounteredTagId::integer()}}

Binary: The binary to read the NBT tag from

returns: A tuple containing {ok, Nbt, Remainder} where NBT is a map (same as type erl_nbt:nbt()) and Remainder is an (empty) binary or an error tuple containing {error, {Reason, Details}}

Decodes the first (nested) NBT tag in the specified binary.

This function reads the first NBT tag from a binary. If it is a compound tag, it will read all children (including nested compound tags.)

If the given binary has remaining data after the NBT tag, this remaining data will be returned as Rest.

Introduced in: 0.1.0

decode_byte/1 *

decode_byte(X1) -> any()

decode_double/1 *

decode_double(X1) -> any()

decode_float/1 *

decode_float(X1) -> any()

decode_int/1 *

decode_int(X1) -> any()

decode_long/1 *

decode_long(X1) -> any()

decode_short/1 *

decode_short(X1) -> any()

decode_string/1 *

decode_string(X1) -> any()

decode_tag/4 *

decode_tag(Binary::binary(), Count::integer(), Depth::integer(), Output::map()) -> {ok, Nbt::erl_nbt:nbt(), Rest::binary()} | {error, {max_depth_reached, Depth::integer()}} | {error, {max_count_reached, Count::integer()}} | {error, {unknown_tag_id, EncounteredTagId::integer()}}


Generated by EDoc