private static LinkedBuffer writeUTF8VarDelimited(final CharSequence str, final int index,
            final int len, final int lowerLimit, int expectedSize,
            final WriteSession session, final LinkedBuffer lb)
            throws IOException
    {
        int lastSize = session.size, offset = lb.offset, withIntOffset = offset + expectedSize;

        // the buffer could very well be almost-full.
        if (withIntOffset + len > lb.buffer.length)
        {
            // flush what we have.
            offset = session.flush(lb.buffer, lb.start, lb.offset - lb.start);
            withIntOffset = offset + expectedSize;

            // if true, the string is too large to fit in the buffer
            if (withIntOffset + len > lb.buffer.length)
            {
                // not enough space for the string.
                lb.offset = withIntOffset;

                // slow path
                final LinkedBuffer rb = StringSerializer.writeUTF8(str, index, len,
                        lb.buffer, withIntOffset, lb.buffer.length, session, lb);

                int size = session.size - lastSize;

                if (size < lowerLimit)
                {
                    session.size += (--expectedSize);

                    // we've nothing existing to flush
                    // move one slot to the right
                    int o = ++offset;

                    for (; --expectedSize > 0; size >>>= 7)
                        lb.buffer[o++] = (byte) ((size & 0x7F) | 0x80);

                    lb.buffer[o] = (byte) (size);

                    // flush and reset
                    lb.offset = session.flush(lb, lb.buffer, offset,
                            lb.offset - offset);

                    assert rb != lb;
                    // flush and reset nodes
                    flushAndReset(lb.next, session);

                    return lb;
                }

                // update size
                session.size += expectedSize;

                for (; --expectedSize > 0; size >>>= 7)
                    lb.buffer[offset++] = (byte) ((size & 0x7F) | 0x80);

                lb.buffer[offset] = (byte) (size);

                assert rb != lb;
                // flush and reset nodes
                flushAndReset(lb, session);

                return lb;
            }
        }

        // everything fits
        lb.offset = withIntOffset;

        final LinkedBuffer rb = StringSerializer.writeUTF8(str, index, len, session, lb);

        int size = session.size - lastSize;

        if (size < lowerLimit)
        {
            // if the buffer was fully used
            // or if the string was atleast 683 bytes
            // for this method, expected size only either be 2/3/4/5
            if (rb != lb || expectedSize != 2)
            {
                // flush it
                session.size += (--expectedSize);

                // move one slot to the right
                int existingOffset = offset, o = ++offset;

                for (; --expectedSize > 0; size >>>= 7)
                    lb.buffer[o++] = (byte) ((size & 0x7F) | 0x80);

                lb.buffer[o] = (byte) (size);

                if (existingOffset == lb.start)
                {
                    // nothing was written prior to this string
                    // flush and reset
                    lb.offset = session.flush(lb, lb.buffer, offset, lb.offset - offset);
                }
                else
                {
                    // flush and reset
                    lb.offset = session.flush(lb.buffer, lb.start, existingOffset - lb.start,
                            lb.buffer, offset, lb.offset - offset);
                }

                if (rb != lb)
                {
                    // flush and reset nodes
                    flushAndReset(lb.next, session);
                }

                return lb;
            }

            // move one slot to the left
            System.arraycopy(lb.buffer, withIntOffset, lb.buffer, withIntOffset - 1,
                    lb.offset - withIntOffset);

            expectedSize--;
            lb.offset--;
        }

        // update size
        session.size += expectedSize;

        for (; --expectedSize > 0; size >>>= 7)
            lb.buffer[offset++] = (byte) ((size & 0x7F) | 0x80);

        lb.buffer[offset] = (byte) (size);

        if (rb != lb)
        {
            // flush and reset nodes
            flushAndReset(lb, session);
        }

        return lb;
    }
The length of the utf8 bytes is written first before the string - which is fixed 2-bytes.
protostuff-api/src/main/java/io/protostuff/StreamedStringSerializer.java