Example usage for android.util Base64 encode

List of usage examples for android.util Base64 encode

Introduction

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

Prototype

public static byte[] encode(byte[] input, int flags) 

Source Link

Document

Base64-encode the given data and return a newly allocated byte[] with the result.

Usage

From source file:Main.java

public static byte[] stringToBytes(String string) {
    return Base64.encode(string.getBytes(), Base64.DEFAULT);
}

From source file:Main.java

public static String encrypt(String str) {
    return new String(Base64.encode(str.getBytes(), Base64.DEFAULT));
}

From source file:Main.java

public static String getBASE64(String s) {
    return new String(Base64.encode(s.getBytes(), Base64.DEFAULT));
}

From source file:Main.java

public static byte[] base64EncodeByte(final String data) {
    return Base64.encode(data.getBytes(), Base64.DEFAULT);
}

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 encode(byte[] bytes) throws Exception {
    return new String(Base64.encode(bytes, Base64.DEFAULT));
}

From source file:Main.java

public static String base64Encrypt(byte[] paramArrayOfByte) {
    return new String(Base64.encode(paramArrayOfByte, 0));
}

From source file:Main.java

public static String getBasicAuth(String username, String password) {
    byte[] encoded = Base64.encode((username + ":" + password).getBytes(), 0);
    return "Basic " + new String(encoded);
}

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 String getEncodedBasicAuthenticationString(String details) {
    return "Basic " + Base64.encode(details.getBytes(), Base64.DEFAULT);
}