@Override
    public void transferByteRangeTo(Output output, boolean utf8String, int fieldNumber,
            boolean repeated) throws IOException
    {
        final int length = readRawVarint32();
        if (length < 0)
            throw ProtobufException.negativeSize();

        if (utf8String)
        {
            // if it is a UTF string, we have to call the writeByteRange.

            if (buffer.hasArray())
            {
                output.writeByteRange(true, fieldNumber, buffer.array(),
                        buffer.arrayOffset() + buffer.position(), length, repeated);
                buffer.position(buffer.position() + length);
            }
            else
            {
                byte[] bytes = new byte[length];
                buffer.get(bytes);
                output.writeByteRange(true, fieldNumber, bytes, 0, bytes.length, repeated);
            }
        }
        else
        {
            // Do the potentially vastly more efficient potential splice call.
            if (buffer.remaining() < length)
                throw ProtobufException.misreportedSize();

            ByteBuffer dup = buffer.slice();
            dup.limit(length);

            output.writeBytes(fieldNumber, dup, repeated);

            buffer.position(buffer.position() + length);
        }

        // output.writeByteRange(utf8String, fieldNumber, buffer, offset, length, repeated);
        //
        // offset += length;
    }
Read a 64-bit little-endian integer from the internal byte buffer.
protostuff-core/src/main/java/io/protostuff/ByteBufferInput.java