Package com.yahoo.fs4

Class MapEncoder


  • public class MapEncoder
    extends Object
    A static utility for encoding values to the binary map representation used in fs4 packets.
    Author:
    bratseth
    • Constructor Detail

      • MapEncoder

        public MapEncoder()
    • Method Detail

      • encodeSingleValue

        public static int encodeSingleValue​(String mapName,
                                            String key,
                                            Object value,
                                            ByteBuffer buffer)
        Encodes a single value as a complete binary map. Does nothing if the value is null. Returns the number of maps encoded - 0 or 1
      • encodeMap

        public static int encodeMap​(String mapName,
                                    Map<String,​?> map,
                                    ByteBuffer buffer)
        Encodes a map as binary. Does nothing if the value is null. Returns the number of maps encoded - 0 or 1
      • encodeMultiMap

        public static <T> int encodeMultiMap​(String mapName,
                                             Map<String,​List<T>> map,
                                             ByteBuffer buffer)
        Encodes a multi-map as binary. Does nothing if the value is null. Returns the number of maps encoded - 0 or 1