static int putVarInt32AndGetOffset(final int value,
            final byte[] buffer, final int variableOffset)
    {
        switch (ProtobufOutput.computeRawVarint32Size(value))
        {
            case 1:
                buffer[variableOffset + 4] = (byte) value;
                return variableOffset + 4;

            case 2:
                buffer[variableOffset + 3] = (byte) ((value & 0x7F) | 0x80);
                buffer[variableOffset + 4] = (byte) (value >>> 7);
                return variableOffset + 3;

            case 3:
                buffer[variableOffset + 2] = (byte) ((value & 0x7F) | 0x80);
                buffer[variableOffset + 3] = (byte) ((value >>> 7 & 0x7F) | 0x80);
                buffer[variableOffset + 4] = (byte) (value >>> 14);
                return variableOffset + 2;

            case 4:
                buffer[variableOffset + 1] = (byte) ((value & 0x7F) | 0x80);
                buffer[variableOffset + 2] = (byte) ((value >>> 7 & 0x7F) | 0x80);
                buffer[variableOffset + 3] = (byte) ((value >>> 14 & 0x7F) | 0x80);
                buffer[variableOffset + 4] = (byte) (value >>> 21);
                return variableOffset + 1;

            default:
                buffer[variableOffset] = (byte) ((value & 0x7F) | 0x80);
                buffer[variableOffset + 1] = (byte) ((value >>> 7 & 0x7F) | 0x80);
                buffer[variableOffset + 2] = (byte) ((value >>> 14 & 0x7F) | 0x80);
                buffer[variableOffset + 3] = (byte) ((value >>> 21 & 0x7F) | 0x80);
                buffer[variableOffset + 4] = (byte) (value >>> 28);
                return variableOffset;
        }

    }
Returns the offset where the first byte is written. This method assumes that 5 bytes will be writable starting at
the {@code variableOffset}.
protostuff-core/src/main/java/io/protostuff/IOUtil.java