Module msgpack

A MessagePack to and from erlang terms library based on http://wiki.msgpack.org/display/MSGPACK/Format+specification.

Copyright © (C) 2013-2020, Jan Henry Nystrom <JanHenryNystrom@gmail.com> -------------------------------------------------------------------

Authors: Jan Henry Nystrom (JanHenryNystrom@gmail.com).

Description

A MessagePack to and from erlang terms library based on http://wiki.msgpack.org/display/MSGPACK/Format+specification.

MessagePack is represented as follows:

msgpack : map | array | integers | floats | boolean | raw map : {[{msgpack, msgpack}*]} array : [msgpack*] integers : integer | {pos_fixnum, integer} | {neg_fixnum, integer} | {uint8, integer} | {uint16, integer} | {uint32, integer} | {uint64, integer} | {int8, integer} | {int16, integer} | {int632, integer} | {int64, integer} floats : float | {'float', float} | {'double', float} nil : nil boolean : 'true' | 'false' raw : binary

Data Types

float_type()

float_type() = float | double

floats()

floats() = float() | {float_type(), float()}

integer_type()

integer_type() = pos_fixnum | neg_fixnum | uint8 | uint16 | uint32 | uint64 | int8 | int16 | int32 | int64

integers()

integers() = integer() | {integer_type(), integer()}

msgpack()

msgpack() = msgpack_map() | msgpack_array() | integers() | floats() | boolean() | raw()

msgpack_array()

msgpack_array() = [msgpack()]

msgpack_map()

msgpack_map() = {[msgpack()]}

opt()

opt() = {atom_strings, boolean()} | binary | iolist

raw()

raw() = binary()

Function Index

decode/1 Decodes the binary into a structured Erlang term.
decode/2 Decodes the binary into a structured Erlang.
encode/1 Encodes the structured Erlang term as an iolist.
encode/2 Encodes the structured Erlang term as an iolist or binary.

Function Details

decode/1

decode(Binary::binary()) -> msgpack()

Decodes the binary into a structured Erlang term. Equivalent of decode(MSGPACK, []) -> Term.

decode/2

decode(Binary::binary(), Opts::[opt()] | #opts{return_type = iolist | binary, number_types = boolean()}) -> msgpack()

Decodes the binary into a structured Erlang. Decode will give an exception if the binary is not well formed MSGPACK. Options are: number_types -> decode into {Type, Value} for number types.

encode/1

encode(Term::msgpack()) -> iolist()

Encodes the structured Erlang term as an iolist. Equivalent of encode(Term, []) -> MSGPACK.

encode/2

encode(Term::msgpack(), Opts::[opt()] | #opts{return_type = iolist | binary, number_types = boolean()}) -> iolist() | binary()

Encodes the structured Erlang term as an iolist or binary. Encode will give an exception if the erlang term is not well formed. Options are: binary -> a binary is returned iolist -> a iolist is returned


Generated by EDoc