Example usage for android.util Base64 DEFAULT

List of usage examples for android.util Base64 DEFAULT

Introduction

In this page you can find the example usage for android.util Base64 DEFAULT.

Prototype

int DEFAULT

To view the source code for android.util Base64 DEFAULT.

Click Source Link

Document

Default values for encoder/decoder flags.

Usage

From source file:Main.java

public static String getBase64Code(String str, long port) {
    byte[] b = Base64.encode(str.getBytes(), Base64.DEFAULT);
    return "http://127.0.0.1:" + port + "/play?enc=base64&url=" + new String(b) + "&taskid=&mediatype=m3u8";
}

From source file:Main.java

public static String decode(String str) {
    try {//from   w  w  w.  ja  v a  2s  .  c o m
        byte[] result = Base64.decode(str, Base64.DEFAULT);
        return new String(result);
    } catch (Exception e) {
        return str;
    }
}

From source file:Main.java

public static byte[] base64ToByte(String base64Str) {
    try {/* ww w . j a v a  2 s. com*/
        return Base64.decode(base64Str, Base64.DEFAULT);
    } catch (Exception e) {
        // TODO: handle exception
    }
    return new byte[0];
}

From source file:Main.java

public static String decodeBASE64(String key) throws Exception {
    byte[] data = Base64.decode(key.getBytes(), Base64.DEFAULT);
    String str = String.valueOf(data);
    return str;//from w w  w . j  a v  a  2s  . c  om
}

From source file:Main.java

public static String decodeBase64String(String str) {
    try {/*from   w  ww .  j a v a 2 s .  c  om*/
        return new String(Base64.decode(str, Base64.DEFAULT));
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}

From source file:Main.java

public static String encodeBASE64(String key) throws Exception {
    byte[] data = Base64.encode(key.getBytes(), Base64.DEFAULT);
    String str = String.valueOf(data);
    return str;// new String(Base64.encode(key.getBytes(),
               // Base64.DEFAULT),"UTF-8");
}

From source file:Main.java

public static byte[] base64Encode(byte[] input) {
    return Base64.encode(input, Base64.DEFAULT); // Force base64 encoding to RFC3548 standard
}

From source file:Main.java

public static byte[] base64Decode(byte[] input) {
    return Base64.decode(input, Base64.DEFAULT);
}

From source file:Main.java

public static String getEncodedBasicAuthenticationString(String details) {
    return "Basic " + Base64.encode(details.getBytes(), Base64.DEFAULT);
}

From source file:Main.java

public static String encodeBase64String(String str) {
    try {//from   ww w.j av  a2  s.  co  m

        return new String(Base64.encode(str.getBytes(), Base64.DEFAULT));
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}