Class ExTermDecoder

    • Constructor Summary

      Constructors 
      Constructor Description
      ExTermDecoder()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Object unpack​(java.nio.ByteBuffer buffer)
      Unpacks the provided term into a java object.
      static java.util.List<java.lang.Object> unpackList​(java.nio.ByteBuffer buffer)
      Unpacks the provided term into a java List.
      static java.util.Map<java.lang.String,​java.lang.Object> unpackMap​(java.nio.ByteBuffer buffer)
      Unpacks the provided term into a java Map.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ExTermDecoder

        public ExTermDecoder()
    • Method Detail

      • unpack

        public static java.lang.Object unpack​(java.nio.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:
        java.lang.IllegalArgumentException - If the buffer does not start with the version byte 131 or contains an unsupported tag
      • unpackMap

        public static java.util.Map<java.lang.String,​java.lang.Object> unpackMap​(java.nio.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:
        java.lang.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 java.util.List<java.lang.Object> unpackList​(java.nio.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:
        java.lang.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