public static TaskId readTaskIdFrom(final ByteBuffer buf, final int version) {
        final int subtopology = buf.getInt();
        final int partition = buf.getInt();
        final String namedTopology;
        if (version >= MIN_NAMED_TOPOLOGY_VERSION) {
            final int numNamedTopologyChars = buf.getInt();
            final StringBuilder namedTopologyBuilder = new StringBuilder();
            for (int i = 0; i < numNamedTopologyChars; ++i) {
                namedTopologyBuilder.append(buf.getChar());
            }
            namedTopology = namedTopologyBuilder.toString();
        } else {
            namedTopology = null;
        }
        return new TaskId(subtopology, partition, getNamedTopologyOrElseNull(namedTopology));
    }
@throws IOException if cannot read from input stream
streams/src/main/java/org/apache/kafka/streams/processor/internals/assignment/ConsumerProtocolUtils.java