class LinkFormatCodec implements ContentCodec {

    @Override
    public byte[] valueToBytes(Object value, Map<String, String> parameters) {
        if (value instanceof Map) {
            Map<String, Map<String, String>> valueMap = (Map<String, Map<String, String>>) value;
            String bodyString = valueMap.entrySet().stream().map(e -> e.getKey() + ";" + e.getValue().entrySet().stream().map(e2 -> e2.getKey() + "=\"" + e2.getValue() + "\"").collect(joining(";"))).collect(joining(","));
            return bodyString.getBytes();
        }
        else {
            log.warn("Unable to serialize non-map value: {}", value);
            return new byte[0];
        }
    }

}