public LinkBuffer writeVarInt64(long value) throws IOException
    {

        byte[] buf = new byte[10];
        int locPtr = 0;

        while (true)
        {
            if ((value & ~0x7FL) == 0)
            {
                buf[locPtr++] = (byte) value;
                ensureCapacity(locPtr);
                current.put(buf, 0, locPtr);
                return this;
            }
            else
            {
                buf[locPtr++] = (byte) (((int) value & 0x7F) | 0x80);
                value >>>= 7;
            }
        }
    }
A list of ByteBuffers.

@author Ryan Rawson
protostuff-core/src/main/java/io/protostuff/LinkBuffer.java