List of usage examples for android.util Base64 encodeToString
public static String encodeToString(byte[] input, int flags)
From source file:Main.java
private static String toBase64(byte[] src) { return Base64.encodeToString(src, Base64.NO_WRAP); }
From source file:Main.java
public static String base64Encode(String s) { if (s == null) { return s; }//from ww w. jav a2 s . c o m return Base64.encodeToString(s.getBytes(), Base64.NO_WRAP); }
From source file:Main.java
public static String bytesToString(byte[] bts) { String bmpStr = ""; try {// ww w . ja v a2 s . c om bmpStr = Base64.encodeToString(bts, Base64.DEFAULT); } catch (Exception e) { // TODO: handle exception } return bmpStr; }
From source file:Main.java
public static String getBasicHeader(String name, String password) { String str = Base64.encodeToString((name + ":" + password).getBytes(), Base64.NO_WRAP); return "Basic " + str; }
From source file:Main.java
public static String base64Encode(String str) { try {//w w w . j a va 2 s.c o m str = Base64.encodeToString(str.getBytes("UTF-8"), Base64.DEFAULT); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return str; }
From source file:Main.java
public static String getB64Auth(String login, String pass) { String source = login + ":" + pass; String ret = "Basic " + Base64.encodeToString(source.getBytes(), Base64.URL_SAFE | Base64.NO_WRAP); return ret;/*from ww w.j a v a2 s . c o m*/ }
From source file:Main.java
public static String encodeUrlSafeNoPadding(byte[] data) { if (data == null) { return null; }/*w w w .j av a2s . co m*/ return Base64.encodeToString(data, 11); }
From source file:Main.java
public static String encode(String toEncodeContent) { if (toEncodeContent == null) { return null; }// w w w . j av a 2s . com return Base64.encodeToString(toEncodeContent.getBytes(), Base64.DEFAULT); }
From source file:Main.java
public static String getBase64String(String value) throws UnsupportedEncodingException { return Base64.encodeToString(value.getBytes("UTF-8"), Base64.NO_WRAP); }
From source file:Main.java
public static String bitmap2JPGBase64(Bitmap bitmap) { return Base64.encodeToString(bitmap2JPGByteArray(bitmap), Base64.DEFAULT); }