modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/XSDDataTypeConverter.java [76:185]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        private Base64Binary() {
        }

        /**
         * 
         */
        public static byte[] decode(char[] data, int off, int len) {
            char[] ibuf = new char[4];
            int ibufcount = 0;
            byte[] obuf = new byte[len / 4 * 3 + 3];
            int obufcount = 0;
            for (int i = off; i < off + len; i++) {
                char ch = data[i];
                if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) {
                    ibuf[ibufcount++] = ch;
                    if (ibufcount == ibuf.length) {
                        ibufcount = 0;
                        obufcount += decode0(ibuf, obuf, obufcount);
                    }
                }
            }
            if (obufcount == obuf.length) {
                return obuf;
            }
            byte[] ret = new byte[obufcount];
            System.arraycopy(obuf, 0, ret, 0, obufcount);
            return ret;
        }

        /**
         * 
         */
        public static void decode(char[] data, int off, int len, OutputStream ostream) throws IOException {
            char[] ibuf = new char[4];
            int ibufcount = 0;
            byte[] obuf = new byte[3];
            for (int i = off; i < off + len; i++) {
                char ch = data[i];
                if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) {
                    ibuf[ibufcount++] = ch;
                    if (ibufcount == ibuf.length) {
                        ibufcount = 0;
                        int obufcount = decode0(ibuf, obuf, 0);
                        ostream.write(obuf, 0, obufcount);
                    }
                }
            }
        }

        /**
         * 
         */
        public static byte[] decode(String data) {
            char[] ibuf = new char[4];
            int ibufcount = 0;
            byte[] obuf = new byte[data.length() / 4 * 3 + 3];
            int obufcount = 0;
            for (int i = 0; i < data.length(); i++) {
                char ch = data.charAt(i);
                if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) {
                    ibuf[ibufcount++] = ch;
                    if (ibufcount == ibuf.length) {
                        ibufcount = 0;
                        obufcount += decode0(ibuf, obuf, obufcount);
                    }
                }
            }
            if (obufcount == obuf.length) {
                return obuf;
            }
            byte[] ret = new byte[obufcount];
            System.arraycopy(obuf, 0, ret, 0, obufcount);
            return ret;
        }

        /**
         * 
         */
        public static void decode(String data, OutputStream ostream) throws IOException {
            char[] ibuf = new char[4];
            int ibufcount = 0;
            byte[] obuf = new byte[3];
            for (int i = 0; i < data.length(); i++) {
                char ch = data.charAt(i);
                if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) {
                    ibuf[ibufcount++] = ch;
                    if (ibufcount == ibuf.length) {
                        ibufcount = 0;
                        int obufcount = decode0(ibuf, obuf, 0);
                        ostream.write(obuf, 0, obufcount);
                    }
                }
            }
        }

        private static int decode0(char[] ibuf, byte[] obuf, int index) {
            int wp = index;
            int outlen = 3;
            if (ibuf[3] == S_BASE64PAD) {
                outlen = 2;
            }
            if (ibuf[2] == S_BASE64PAD) {
                outlen = 1;
            }
            int b0 = S_DECODETABLE[ibuf[0]];
            int b1 = S_DECODETABLE[ibuf[1]];
            int b2 = S_DECODETABLE[ibuf[2]];
            int b3 = S_DECODETABLE[ibuf[3]];
            switch (outlen) {
                case 1:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



testing/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/Base64Binary.java [50:159]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    private Base64Binary() {
    }

    /**
     * 
     */
    public static byte[] decode(char[] data, int off, int len) {
        char[] ibuf = new char[4];
        int ibufcount = 0;
        byte[] obuf = new byte[len / 4 * 3 + 3];
        int obufcount = 0;
        for (int i = off; i < off + len; i++) {
            char ch = data[i];
            if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) {
                ibuf[ibufcount++] = ch;
                if (ibufcount == ibuf.length) {
                    ibufcount = 0;
                    obufcount += decode0(ibuf, obuf, obufcount);
                }
            }
        }
        if (obufcount == obuf.length) {
            return obuf;
        }
        byte[] ret = new byte[obufcount];
        System.arraycopy(obuf, 0, ret, 0, obufcount);
        return ret;
    }

    /**
     * 
     */
    public static void decode(char[] data, int off, int len, OutputStream ostream) throws IOException {
        char[] ibuf = new char[4];
        int ibufcount = 0;
        byte[] obuf = new byte[3];
        for (int i = off; i < off + len; i++) {
            char ch = data[i];
            if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) {
                ibuf[ibufcount++] = ch;
                if (ibufcount == ibuf.length) {
                    ibufcount = 0;
                    int obufcount = decode0(ibuf, obuf, 0);
                    ostream.write(obuf, 0, obufcount);
                }
            }
        }
    }

    /**
     * 
     */
    public static byte[] decode(String data) {
        char[] ibuf = new char[4];
        int ibufcount = 0;
        byte[] obuf = new byte[data.length() / 4 * 3 + 3];
        int obufcount = 0;
        for (int i = 0; i < data.length(); i++) {
            char ch = data.charAt(i);
            if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) {
                ibuf[ibufcount++] = ch;
                if (ibufcount == ibuf.length) {
                    ibufcount = 0;
                    obufcount += decode0(ibuf, obuf, obufcount);
                }
            }
        }
        if (obufcount == obuf.length) {
            return obuf;
        }
        byte[] ret = new byte[obufcount];
        System.arraycopy(obuf, 0, ret, 0, obufcount);
        return ret;
    }

    /**
     * 
     */
    public static void decode(String data, OutputStream ostream) throws IOException {
        char[] ibuf = new char[4];
        int ibufcount = 0;
        byte[] obuf = new byte[3];
        for (int i = 0; i < data.length(); i++) {
            char ch = data.charAt(i);
            if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) {
                ibuf[ibufcount++] = ch;
                if (ibufcount == ibuf.length) {
                    ibufcount = 0;
                    int obufcount = decode0(ibuf, obuf, 0);
                    ostream.write(obuf, 0, obufcount);
                }
            }
        }
    }

    private static int decode0(char[] ibuf, byte[] obuf, int index) {
        int wp = index;
        int outlen = 3;
        if (ibuf[3] == S_BASE64PAD) {
            outlen = 2;
        }
        if (ibuf[2] == S_BASE64PAD) {
            outlen = 1;
        }
        int b0 = S_DECODETABLE[ibuf[0]];
        int b1 = S_DECODETABLE[ibuf[1]];
        int b2 = S_DECODETABLE[ibuf[2]];
        int b3 = S_DECODETABLE[ibuf[3]];
        switch (outlen) {
            case 1:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



