Example usage for org.apache.commons.codec.binary Base64 decodeBase64

List of usage examples for org.apache.commons.codec.binary Base64 decodeBase64

Introduction

In this page you can find the example usage for org.apache.commons.codec.binary Base64 decodeBase64.

Prototype

public static byte[] decodeBase64(final byte[] base64Data) 

Source Link

Document

Decodes Base64 data into octets

Usage

From source file:Main.java

public static byte[] decode(String base64) throws Exception {
    return Base64.decodeBase64(base64);
    //        return Base64.decode(base64.getBytes());
}

From source file:Main.java

public static byte[] fromBase64(final byte[] data) {
    if (data == null) {
        return null;
    }/*w ww. j av a  2s  .  c o m*/
    return Base64.decodeBase64(data);
}

From source file:com.claresco.tinman.servlet.XapiServletUtility.java

protected static String decodeBase64(String theSecret) throws UnsupportedEncodingException {
    Base64 decoder = new Base64();

    byte[] decodedBytes = decoder.decodeBase64(theSecret);
    return new String(decodedBytes, "UTF-8");
}

From source file:Main.java

public static byte[] decodeBASE64(String s) {
    if (s == null)
        return null;
    try {/* ww  w  . j av a  2  s .  c  o  m*/
        return Base64.decodeBase64(s.getBytes());
    } catch (Exception e) {
        return null;
    }
}

From source file:com.enonic.esl.util.Base64Util.java

public static byte[] decode(String data) {
    return Base64.decodeBase64(data.getBytes());
}

From source file:com.architexa.rse.DateUtil.java

public static Date getLicenseValidity(String licenseKey) {
    String[] parts = licenseKey.split("::");
    if (parts.length != 2 || !parts[0].equals("atxa"))
        return null;

    String newPass = new String(Base64.decodeBase64((parts[1]).getBytes()));
    String[] passParts = newPass.split("::");

    long expiry = Long.parseLong(passParts[2]);
    return new Date(expiry);
}

From source file:images.DecodingBase64.java

public static byte[] encodeFileToBase64Binary(String base64) {
    return Base64.decodeBase64(base64);
}

From source file:com.investment.king.util.HashUtil.java

public static byte[] base64ToByte(String data) throws IOException {
    return Base64.decodeBase64(data);
}

From source file:Main.java

/**
 * Descomprime uma string utilizando o GZIP
 * //w w w .ja v  a2s .c om
 * @param str
 * @param encoding
 * @return
 */
public static String gzipDecompressString(String str, String encoding) {
    String decompressedString = "";

    try {
        byte[] bytes = Base64.decodeBase64(str.getBytes(encoding));
        ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
        GZIPInputStream gzip = new GZIPInputStream(bais);
        Reader reader = new InputStreamReader(gzip, encoding);
        StringBuffer sbuf = new StringBuffer();
        char[] buffer = new char[32 * 1024];
        int nread;
        while ((nread = reader.read(buffer)) >= 0) {
            sbuf.append(buffer, 0, nread);
        }
        decompressedString = sbuf.toString();
        reader.close();
    } catch (Exception e) {
        e.printStackTrace();
    }

    return decompressedString;
}

From source file:br.gov.to.secad.aede.util.CriptografiaHash.java

static public String decodificar(String valor) {
    byte[] decoded = Base64.decodeBase64(valor.getBytes());
    String decodedString = new String(decoded);
    return decodedString;
}