Bertex v1.3.0 Bertex View Source

This is a work TOTALLY based on @mojombo and @eproxus work: More at: https://github.com/eproxus/bert.erl and http://github.com/mojombo/bert.erl

Link to this section Summary

Functions

iex> Bertex.decode(<<131,108,0,0,0,6,97,42,100,0,6,98,97,110,97,110,97,104,3,100,0,2,120,121,97,5,97,10,109,0,0,0,5,114,111,98,111,116,104,2,100,0,4,98,101,114,116,100,0,4,116,114,117,101,104,2,100,0,4,98,101,114,116,100,0,5,102,97,108,115,101,106>>) [42, :banana, {:xy, 5, 10}, “robot”, true, false]

iex> Bertex.encode([42, :banana, {:xy, 5, 10}, “robot”, true, false]) <<131,108,0,0,0,6,97,42,100,0,6,98,97,110,97,110,97,104,3,100,0,2,120,121,97,5,97,10,109,0,0,0,5,114,111,98,111,116,104,2,100,0,4,98,101,114,116,100,0,4,116,114,117,101,104,2,100,0,4,98,101,114,116,100,0,5,102,97,108,115,101,106>>

Link to this section Functions

Link to this function decode(bin) View Source
decode(binary) :: term

iex> Bertex.decode(<<131,108,0,0,0,6,97,42,100,0,6,98,97,110,97,110,97,104,3,100,0,2,120,121,97,5,97,10,109,0,0,0,5,114,111,98,111,116,104,2,100,0,4,98,101,114,116,100,0,4,116,114,117,101,104,2,100,0,4,98,101,114,116,100,0,5,102,97,108,115,101,106>>) [42, :banana, {:xy, 5, 10}, “robot”, true, false]

Link to this function encode(term) View Source
encode(term) :: binary

iex> Bertex.encode([42, :banana, {:xy, 5, 10}, “robot”, true, false]) <<131,108,0,0,0,6,97,42,100,0,6,98,97,110,97,110,97,104,3,100,0,2,120,121,97,5,97,10,109,0,0,0,5,114,111,98,111,116,104,2,100,0,4,98,101,114,116,100,0,4,116,114,117,101,104,2,100,0,4,98,101,114,116,100,0,5,102,97,108,115,101,106>>

Link to this function safe_decode(bin) View Source
safe_decode(binary) :: term