@Override
    public String deserialize(String topic, Headers headers, ByteBuffer data) {
        if (data == null) {
            return null;
        }

        if (data.hasArray()) {
            return new String(data.array(), data.position() + data.arrayOffset(), data.remaining(), encoding);
        }
        return new String(Utils.toArray(data), encoding);
    }
String encoding defaults to UTF8 and can be customized by setting the property key.deserializer.encoding,
value.deserializer.encoding or deserializer.encoding. The first two take precedence over the last.
clients/src/main/java/org/apache/kafka/common/serialization/StringDeserializer.java