Package org.apache.commons.codec.binary

Examples of org.apache.commons.codec.binary.Base64.encode()


            fs.create(file, true), cmp));
      final DataOutputBuffer dob = new DataOutputBuffer(REC_SIZE * 4 / 3 + 4);
      int seq = 0;
      while (infLen > 0) {
        rand.nextBytes(b);
        final byte[] b64enc = b64.encode(b); // ensures rand printable, no LF
        dob.reset();
        dob.writeInt(seq);
        System.arraycopy(dob.getData(), 0, b64enc, 0, dob.getLength());
        fout.write(b64enc);
        fout.write('\n');
View Full Code Here


    @Override
    public void marshal(Exchange exchange, Object graph, OutputStream stream) throws Exception {
        byte[] decoded = ExchangeHelper.convertToMandatoryType(exchange, byte[].class, graph);

        Base64 codec = createCodec();
        byte[] encoded = codec.encode(decoded);

        stream.write(encoded);
    }

    @Override
View Full Code Here

                password = "";

            if (type.equals(SSO_TYPE_URL_BASE64))
            {
                Base64 encoder = new Base64();
                userName = new String(encoder.encode(userName.getBytes()));
                password = new String(encoder.encode(password.getBytes()));
            }

            source.append(userName);
            source.append("&");
View Full Code Here

            if (type.equals(SSO_TYPE_URL_BASE64))
            {
                Base64 encoder = new Base64();
                userName = new String(encoder.encode(userName.getBytes()));
                password = new String(encoder.encode(password.getBytes()));
            }

            source.append(userName);
            source.append("&");
            source.append(passwordParam);
View Full Code Here

            String password = (String)request.getAttribute(SSO_REQUEST_ATTRIBUTE_PASSWORD);
            if (password == null) password = "";
            if (type.equalsIgnoreCase(SSO_TYPE_URL_BASE64))
            {
                Base64 encoder = new Base64() ;
                userName = new String(encoder.encode(userName.getBytes()));
                password = new String(encoder.encode(password.getBytes()));
            }
           
            // GET and POST accept args differently
            if ( method instanceof PostMethod )
View Full Code Here

            if (password == null) password = "";
            if (type.equalsIgnoreCase(SSO_TYPE_URL_BASE64))
            {
                Base64 encoder = new Base64() ;
                userName = new String(encoder.encode(userName.getBytes()));
                password = new String(encoder.encode(password.getBytes()));
            }
           
            // GET and POST accept args differently
            if ( method instanceof PostMethod )
            {
View Full Code Here

public class Base64UrlSafe {
    public static String encode(String var) throws ZanataServiceException {
        try {
            Base64 en = new Base64();
            String enVar = new String(en.encode(var.getBytes()), "UTF-8");
            String result = URLEncoder.encode(enVar, "UTF-8");
            return result;
        } catch (Exception e) {
            throw new ZanataServiceException(e);
        }
View Full Code Here

            fs.create(file, true), cmp));
      final DataOutputBuffer dob = new DataOutputBuffer(REC_SIZE * 4 / 3 + 4);
      int seq = 0;
      while (infLen > 0) {
        rand.nextBytes(b);
        final byte[] b64enc = b64.encode(b); // ensures rand printable, no LF
        dob.reset();
        dob.writeInt(seq);
        System.arraycopy(dob.getData(), 0, b64enc, 0, dob.getLength());
        fout.write(b64enc);
        fout.write('\n');
View Full Code Here

        }

        Base64 base64 = new Base64();

        try {
            byte[] byteData = base64.encode(bos.toByteArray());

            return new String(byteData);

        } catch (Throwable t) {
            String message =
View Full Code Here

    public static String xmlToBase64String(String xml) {

        // byte[] bytes = Base64.encode(xml);
        Base64 encoder = new Base64();
        byte[] bytes = encoder.encode(xml.getBytes());

        StringBuilder buf = new StringBuilder();
        for (byte b : bytes) {
            buf.append((char) Integer.parseInt(Integer.toHexString(b), 16));
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.