Class ExTermDecoder

    • Constructor Detail

      • ExTermDecoder

        public ExTermDecoder()
    • Method Detail

      • unpack

        public static Object unpack​(ByteBuffer buffer)
        Unpacks the provided term into a java object.

        The mapping is as follows:

        • Small Int | Int -> Integer
        • Small BigInt -> Long
        • Float | New Float -> Double
        • Small Atom | Atom -> Boolean | null | String
        • Binary | String -> String
        • List | NIL -> List
        • Map -> Map
        Parameters:
        buffer - The ByteBuffer containing the encoded term
        Returns:
        The java object
        Throws:
        IllegalArgumentException - If the buffer does not start with the version byte 131 or contains an unsupported tag
      • unpackMap

        public static Map<String,​Object> unpackMap​(ByteBuffer buffer)
        Unpacks the provided term into a java Map.

        The mapping is as follows:

        • Small Int | Int -> Integer
        • Small BigInt -> Long
        • Float | New Float -> Double
        • Small Atom | Atom -> Boolean | null | String
        • Binary | String -> String
        • List | NIL -> List
        • Map -> Map
        Parameters:
        buffer - The ByteBuffer containing the encoded term
        Returns:
        The parsed Map instance
        Throws:
        IllegalArgumentException - If the buffer does not start with a Map term, does not have the right version byte, or the format includes an unsupported tag
      • unpackList

        public static List<Object> unpackList​(ByteBuffer buffer)
        Unpacks the provided term into a java List.

        The mapping is as follows:

        • Small Int | Int -> Integer
        • Small BigInt -> Long
        • Float | New Float -> Double
        • Small Atom | Atom -> Boolean | null | String
        • Binary | String -> String
        • List | NIL -> List
        • Map -> Map
        Parameters:
        buffer - The ByteBuffer containing the encoded term
        Returns:
        The parsed List instance
        Throws:
        IllegalArgumentException - If the buffer does not start with a List or NIL term, does not have the right version byte, or the format includes an unsupported tag