private static byte[] getUtf8(Object value) {
        if (value == null) {
            return Utf8.toBytes("");
        } else if (value instanceof Tensor) {
            return TypedBinaryFormat.encode((Tensor)value);
        } else {
            return Utf8.toBytes(value.toString());
        }
    }
A static utility for encoding values to the binary map representation used in fs4 packets.

@author bratseth
container-search/src/main/java/com/yahoo/fs4/MapEncoder.java