public static int decodeTo(final byte[] output, int outOffset,
            final String str, int inOffset, final int inLen)
    {
        if (inLen == 0)
            return 0;

        if (inLen % 4 != 0)
            throw new IllegalArgumentException("Input block size is not 4");

        int withoutPaddingLen = inLen, limit = inOffset + inLen;
        while (str.charAt(--limit) == pad)
            withoutPaddingLen--;

        // Create result array of exact required size.
        final int outLen = ((withoutPaddingLen) * 3) / 4;
        assert (output.length - outOffset) >= outLen;

        decode(str, inOffset, inLen, output, outOffset, outLen);

        return outLen;
    }
Returns the length of the decoded base64 input (written to the provided {@code output} byte array). The
{@code output} byte array must have enough capacity or it will fail.
protostuff-api/src/main/java/io/protostuff/B64Code.java