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/2Decodes the first (nested) NBT tag in the specified binary.
decode_byte/1*
decode_byte_array/1*
decode_double/1*
decode_element/3*
decode_element/4*
decode_float/1*
decode_int/1*
decode_int_array/1*
decode_long/1*
decode_long_array/1*
decode_short/1*
decode_string/1*
decode_tag/6*
read_next_raw/4*
tag_id_to_type/1*

Function Details

decode/2

decode(Binary::binary(), Options::erl_nbt:decode_options()) -> {ok, Nbt::erl_nbt:nbt()} | {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 *AND* the option ?OPTION_RETURN_REMAINDER is given, this remaining data will be returned as Rest.

Introduced in: 0.1.0

decode_byte/1 *

decode_byte(X1) -> any()

decode_byte_array/1 *

decode_byte_array(X1) -> any()

decode_double/1 *

decode_double(X1) -> any()

decode_element/3 *

decode_element(TypeId, Binary, Length) -> any()

decode_element/4 *

decode_element(TypeId, Binary, Remaining, Output) -> any()

decode_float/1 *

decode_float(X1) -> any()

decode_int/1 *

decode_int(X1) -> any()

decode_int_array/1 *

decode_int_array(X1) -> any()

decode_long/1 *

decode_long(X1) -> any()

decode_long_array/1 *

decode_long_array(X1) -> any()

decode_short/1 *

decode_short(X1) -> any()

decode_string/1 *

decode_string(X1) -> any()

decode_tag/6 *

decode_tag(Binary::binary(), Count::integer(), MaxChildren::integer(), Depth::integer(), MaxDepth::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()}}

read_next_raw/4 *

read_next_raw(Data, UnitLength, Remaining, Out) -> any()

tag_id_to_type/1 *

tag_id_to_type(Id) -> any()


Generated by EDoc