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[] base64Encode(byte[] input) {
    return Base64.encode(input, Base64.DEFAULT); // Force base64 encoding to RFC3548 standard
}

From source file:Main.java

public static String encodeBase64String(String str) {
    try {//  w w  w  . ja v a 2  s . co  m

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

From source file:Main.java

public static byte[] encodeBySystem(byte[] data, int Base64Flags) {
    return Base64.encode(data, Base64Flags);
}

From source file:Main.java

public static String encodeBASE64(String s) {
    if (s == null)
        return null;
    return new String(Base64.encode(s.getBytes(), Base64.DEFAULT));
}

From source file:Main.java

public static String encodeByBase64(String string) {
    byte[] encode = Base64.encode(string.getBytes(), Base64.DEFAULT);
    String result = new String(encode);

    return result;
}

From source file:Main.java

public static String encode(String str, int time) {
    String result = new String(str);
    for (int i = 0; i < time; i++) {
        result = new String(Base64.encode(result.getBytes(), Base64.NO_WRAP));
    }//  w  w w.  j  a v  a2s  .c  o m
    return result;
}

From source file:Main.java

public static String base64EncryptUTF(byte[] paramArrayOfByte) throws UnsupportedEncodingException {
    return new String(Base64.encode(paramArrayOfByte, 0), "UTF-8");
}

From source file:Main.java

public static byte[] base64Encode(byte[] input) {
    return Base64.encode(input, Base64.NO_WRAP);
}

From source file:Main.java

public static byte[] encodeBase64(byte[] data) {
    if (data == null) {
        return null;
    }//from   ww w  . j a  va2  s.c  om
    return Base64.encode(data, Base64.DEFAULT);
}

From source file:Main.java

public static String base64Encode(byte[] in) {
    String encoded = null;//from w w  w .jav a  2 s . c  om
    try {
        encoded = new String(Base64.encode(in, Base64.URL_SAFE | Base64.NO_PADDING), "UTF8");
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    return encoded;
}