Class ExTermEncoder


  • public class ExTermEncoder
    extends java.lang.Object
    Encodes an object into a binary ETF representation.
    Since:
    4.2.1
    See Also:
    pack(Object)
    • Constructor Summary

      Constructors 
      Constructor Description
      ExTermEncoder()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.nio.ByteBuffer pack​(java.lang.Object data)
      Encodes the provided object into an ETF buffer.
      • Methods inherited from class java.lang.Object

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

      • ExTermEncoder

        public ExTermEncoder()
    • Method Detail

      • pack

        public static java.nio.ByteBuffer pack​(java.lang.Object data)
        Encodes the provided object into an ETF buffer.

        The mapping is as follows:

        • String -> Binary
        • Map -> Map
        • Collection -> List | NIL
        • Byte -> Small Int
        • Integer, Short -> Int | Small Int
        • Long -> Small BigInt | Int | Small Int
        • Float, Double -> New Float
        • Boolean -> Atom(Boolean)
        • null -> Atom("nil")
        Parameters:
        data - The object to encode
        Returns:
        ByteBuffer with the encoded ETF term
        Throws:
        java.lang.UnsupportedOperationException - If there is no type mapping for the provided object